Commit Graph

11994 Commits (5ac292e12d5e1515beb34028346d76bb68398fc8)

Author SHA1 Message Date
Michael DeHaan 2177b773c8 Rename tests to test, use old directory name. 11 years ago
Michael DeHaan de600f0040 Move integration tests into tests_new. 11 years ago
Michael DeHaan 379fe02104 Move inventory tests into subdir, prune non-integration tests. 11 years ago
Michael DeHaan fe7d3773ae Various tests using datafiles are being moved into the integration test framework (tests_new right now).
The unit test infrastructure will remain for things that are mocked out and testable with out filesystem
side effects, and a few cases of things that might not be quite so much (like inventory) that can still
benefit from heavy access to the API.

See the 'tests_new/integration' directory, this will soon fold into tests_new.
11 years ago
Michael DeHaan 0581746a80 Removing tests from units that are now implemented in the new upgraded test system. Once
we're a little further along the units directory will be reserved to pure-API tests.
11 years ago
James Cammarata 701af19fad Removing non-ascii logging test for now 11 years ago
Michael DeHaan 6fb02650ff Remove tests for things that are now using the playbook based 'test_new' infra. Units will remain here
after refactoring, WIP, more to come.
11 years ago
Martin Thorsen Ranang 7e23ed345f Avoid breaking on unicode input when logging to syslog in modules
After commit 254f87e, non-ascii input broke logging to syslog.
11 years ago
James Cammarata 9c9a940af6 Merge branch 'fix-5679' of https://github.com/jirutka/ansible into jirutka-fix-5679 11 years ago
Ilya Kuznetsov 0658847ea6 Allow equal sign in single-line ini variables 11 years ago
Michael DeHaan c91ceddfac Add the start of an integration test structure using Ansible playbooks, also added an assert action plugin to make writing those easier. 11 years ago
Richard C Isaacson 6feeb16636 Reverting unarchive tests.
We run into some problems because tar --diff will take into account the file ownership and fail if they don't match.

The real-world implication of this is that we could be doing more unarchives then we need to be doing.
11 years ago
Richard Isaacson eb4a730933 Merge pull request #5969 from risaacson/pull_5136
Updates for the unarchive module and action_plugin.
11 years ago
Richard C Isaacson 598b9c6b7c Cleanup per notes.
Some small changes to per notes from @mpdehann.
11 years ago
Richard C Isaacson cb7c2b7524 Updates for the unarchive module and action_plugin.
There is a bit going on with the changes here. Most of the changes are cleanup of files so that they line up with the standard files.

PR #5136 was merged into the current devel and brought up to working order. A few bug fixes had to be done to get the code to test correctly. Thanks out to @pib!

Issue #5431 was not able to be confirmed as it behaved as expected with a sudo user.

Tests were added via a playbook with archive files to verify functionality.

All tests fire clean including custom playbooks across multiple linux and solaris systems.
11 years ago
Jacob Weber 35742fe008 Add regex_replace jinja2 filter 11 years ago
James Cammarata ce0b1a8a96 Fixing tests for git 11 years ago
James Tanner 89c89c8ed2 Re-add synchronize unit tests 11 years ago
James Cammarata 3260e695f4 Make tmp paths in TestRunner dynamic based on pid
Fixes #4723
11 years ago
James Cammarata ca0ec800d8 Revising method for parsing ranges from --limit subsets
Also added a new test (test_subset_range) for future validation.

Fixes #4620
11 years ago
Jakub Jirutka 012e3ae206 Fixes #5679: lineinfile ignores newline in line argument 11 years ago
jctanner 59d99c17b3 Merge pull request #5337 from bob-smith/bugfixFQDNParsing
Fix inventory parsing so that FQDN can be parsed without throwing ssh port error
11 years ago
Michael DeHaan 8e5b7d3095 Remove code underlying when_* and only_if, which are deprecated features slated for removal in the 1.5 release. 11 years ago
John Barker 4bf9f714d0 Fix inventory parsing so that FQDN can be parsed without throwing ssh
port parsing errors
Fixes problesm introduced by 948d019fef
Adds testcases to defend
11 years ago
Matthew Thode c0a7f51671 tests depend on the default encoding being utf8
So we set the utils default encoding to be utf8
11 years ago
willthames 40a44ce6ea Ensure test_command tests are actually correct
Using
```
assert 'changed' in result
```
doesn't actually check if something is changed, which is presumably
the reason for the assertion. What is actually needed is
```
assert result.get('changed')
```
which checks that changed is set and not False. Tests still pass after
this change
11 years ago
Eric Johnson 8ff58eb46e fixes #4954 plus updates for gcutil/v1beta16 tests 11 years ago
Rene Moser b5580389f6 host: added test playbook 11 years ago
James Tanner 4391cbfd91 Fix git bare test in el6 by adding origin to remote 11 years ago
jctanner ad5012f930 Merge pull request #4691 from cg-soft/git-bare-ref-repo-support
Add support for bare git reference repos
11 years ago
James Tanner 9e197d3958 Fix bool comparision in recursive copy tests 11 years ago
James Tanner 33242cacf3 Merge pull request #4375 from pfalcon/ansible
copy: Implement recursive copying if src is a directory.
11 years ago
jctanner 9a7765daf7 Merge pull request #4351 from 2m/leading-range-fix
Allow leading ranges in the inventory host entries.
11 years ago
Christian Goetze f41d4ac390 Add support for bare git reference repos
This adds two parameters to the git module:

  bare (boolean)
    Indicates this is to be a bare repositori

  reference (string)
    Indicates the path or url to the reference repo.
    Check out the "--reference" option in the "git clone"
    man page

Added appropriate tests.
11 years ago
James Tanner d154bf8781 Revert templating enhancements from 73dbab70 e6c28658 d409352c 9858b1f2 4587528b 9b1fe455 214b0b05 8d3db803 7f9504d1 5031104c 35cb9dc2 2bd8cb57 1e85c754 11 years ago
Michael DeHaan 603db60828 Merge pull request #4288 from sivel/3725-regex
Add regex (search, match, regex) jinja2 filters. Fixes #3725
11 years ago
Michael DeHaan 3778b39115 Merge pull request #4380 from joshkehn/lineinfile_validate
Added validate option to lineinfile
11 years ago
Michael DeHaan 5031104c3a Finishing touches on template cleanup. 11 years ago
Michael DeHaan 35cb9dc22f Work in progress about cleaning up template code. 11 years ago
Michael DeHaan baa13a5cc7 Merge pull request #4395 from erjohnso/devel
adding Google Compute Engine modules and inventory plugin
11 years ago
Martynas Mickevicius 7ecb5fbc9c Handle comment on inventory group line. 11 years ago
Martynas Mickevicius 44279ce34f Allow leading ranges in the inventory host entries. 11 years ago
Jascha Geerds 76ed19d279 Fix TestInventory class by explicitly using /bin/bash 11 years ago
Paul Sokolovsky 3ad61ef310 copy: Add testcase for recursive copy. 11 years ago
Michael DeHaan 43df00550d Merge pull request #3827 from mscherer/disable_callbacks
add a way for callback to disable itself
11 years ago
Michael DeHaan 2032489617 Prune legacy tests -- many of these are not part of the official API or documented syntax. 11 years ago
Michael DeHaan e8b043332f Remove some obsolete tests (mechanism of error detection suboptimal, replacements pending) 11 years ago
Michael DeHaan add45d2ca9 Fixup legacy var detector. 11 years ago
Michael DeHaan 709ffda3d1 Tweak only_if deprecation detector. 11 years ago
Michael DeHaan 25dc0ef8d7 Remove out of date tests. 11 years ago
Michael DeHaan 800f12618e Remove out of date tests. 11 years ago
Matt Martz 61525a97df Add regex (search, match, regex) jinja2 filters. Fixes #3725 11 years ago
Eric Johnson 9ca824c16d adding Google Compute Engine modules and inventory plugin 11 years ago
Michael DeHaan 8fc46a3a5a Return inventory objects in the order they are presented. Additionally, fix host slicing such that it works on Python terms with
zero indexed lists and a non-inclusive final element.
11 years ago
Joshua Kehn cc0c908cee Added validate option to lineinfile
The validate option is constructed similarly to the template command's
validate option. TestRunner.py has been updated to include two new
tests, one for passing and one for failing validation.
11 years ago
Matt Martz 535ce97067 Add fileglob Jinja2 filter. Fixes #3563 11 years ago
Michael DeHaan ef28d62846 Update TestUtils.py
tests shouldn't be making symlinks to system dirs, also fixes unit test report on OS X.
11 years ago
Jasper Capel d4dec5f577 Allow creating empty inventory
Instantiating the Inventory class with host_list=None now results in an
empty inventory instead of an error.
11 years ago
Michael Scherer 399d57a651 add more tests :
- test part of ansible.runner.filter_plugins.core
 - test ansible.utils.unfrackpath
11 years ago
James Cammarata 3b801dec72 Merge branch 'failed_when' of https://github.com/hnakamur/ansible into hnakamur-failed_when 11 years ago
James Cammarata aac3090909 Merge branch 'play_remote_user' of https://github.com/bcoca/ansible into bcoca-play_remote_user 11 years ago
Hiroaki Nakamura 2357194b39 Add failed_when module variable.
Implementation note: Ternery operator trick for python prior to 2.5 is used.
(test and [when_true_value] or [when_false_value])[0]
http://stackoverflow.com/questions/394809/ternary-conditional-operator-in-python#comment1466794_394887
11 years ago
James Cammarata 8d0487c31e Removing broken tests for now 11 years ago
Brian Coca d47c48e30a Added remote_user to plays
Still compatible with user: but deprecating it so we can have
a matching remote_user: in tasks, cannot be user: because of the
module of the same name. #3932

Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
11 years ago
Michael Scherer a0b73b18c3 add one last test, for combined range, which make ansible.inventory.expand_hosts
covered to 100%
11 years ago
Michael Scherer 64d35cb3b6 test that using non ordered range of char send a exception 11 years ago
Michael Scherer 4f69b63fec add test for incorrect format in range host 11 years ago
Michael Scherer 835fdd1ec2 add test for missing end in host range 11 years ago
Michael Scherer 2aea8a6368 add a test to verify ansible detect invalid range 11 years ago
Michael Scherer 7fec9c3eba add a test to cover bound stepping in inventory 11 years ago
James Cammarata 157b697a83 Merge branch 'always_run-6' of https://github.com/stoned/ansible into stoned-always_run-6 11 years ago
Michael Scherer ddd582269c increase test coverage of inventory by around 5% according to nose 11 years ago
Stoned Elipot f0743fc32a Introduce the 'always_run' task clause.
The 'always_run' task clause allows one to execute a task even in
check mode.

While here implement Runner.noop_on_check() to check if a runner
really should execute its task, with respect to check mode option
and 'always_run' clause.

Also add the optional 'jinja2' argument to check_conditional() :
it allows to give this function a jinja2 expression without exposing
the 'jinja2_compare' implementation mechanism.
11 years ago
Petr Svoboda e3adfbf5f8 Add tests for undefined variable detection
Tests `test_playbook_undefined_varsX_fail` check if ansible detects
undefined variables when `error_on_undefined_vars` is enabled. These
tests fail without "Improve behavior with error_on_undefined_vars
enabled" patch.

Tests `test_playbook_undefined_varsX_ignore` check if ansible ignores
undefined variables when `error_on_undefined_vars` is disabled.

Also modify PlayBook._run_task_internal() so error_on_undefined_vars is
testable.
11 years ago
Michael Scherer b655d5798b add tests for the -i option when used with raw string for ipv4
and ipv6 addresses.
11 years ago
Michael Scherer 498a550f01 add test for the disabling of callback plugins 11 years ago
Michael DeHaan 4bdbe4dc4f Remove some test prints 11 years ago
Michael DeHaan 76fd769704 Merge pull request #3685 from mspaulding06/indexed_items
Indexed items lookup plugin
11 years ago
Michael DeHaan 3ebbb56479 Merge pull request #3654 from MaxIV-KitsControls/devel
Fix nested loop for more than 3 elements
11 years ago
Matt Spaulding b7154cf2cf Add tests for indexed_items lookup plugin 11 years ago
Vincent Hardion 09ef7751e1 Fix nested loop for more than 3 elements
- combine flatten list for each nested level instead once at the end
11 years ago
Stoned Elipot a1503c4d59 stringify conditional before handing it to Jinja2 for evaluation.
This should fix simple conditionals like:

    when: ansible_selinux

While here add tests for ansible.utils.check_conditional() in
"jinja2_compare mode".
11 years ago
Michael DeHaan 88720516a1 Merge branch 'changed_when' of git://github.com/stoned/ansible into changed_when 11 years ago
Tin Tvrtkovic 4a732c1e9f Enabled the use of extra vars in playbook file paths when including playbooks from other playbooks. 11 years ago
Stoned Elipot eb45f07ae3 Introduce 'changed_when' keyword to override a task's changed status with the evaluation of a Jinja2 expression 11 years ago
Stoned Elipot baf868f825 Add test for 'ignore_errors:' 12 years ago
Dale Sedivec b32131c867 expanduser on each component of plug-in paths
ansible.constants was calling expanduser (by way of shell_expand_path)
on the entire configured value for the library and *_plugins
configuration values, but these values have always been interpreted as
multiple directories separated by os.pathsep.  Thus, if you supplied
multiple directories for one of these values, typically only the first
(at least on *nix) would have e.g. "~" expanded to HOME.

Now PluginLoader does expansion on each individual path in each of
these variables.
12 years ago
George Miroshnykov c642ba77ae Added basic support for hash_behaviour=merge in roles
Dict vars passed to roles are now properly merged
instead of simply overriding dict vars that are
coming from vars_files.
12 years ago
Michael DeHaan 4ae3ef8af9 Disable inventory test 12 years ago
Pol Llovet 4432c01ceb Handle '#' in var strings by splitting on ' #'
If someone has a " #" in a quoted var string, it
will interpret that as a comment and refuse to
load the inventory file due to an unbalanced
quote. Noisy failure > unexpected behavior.
12 years ago
Pol Llovet ba78360c52 Remove inline comments from inventory tokenizing. 12 years ago
Michael DeHaan a9fcea5893 Merge branch 'escape' of git://github.com/ngrilly/ansible into repr 12 years ago
Dale Sedivec 611d56dc4c Plug-ins loaded from top-level plug-in directory
PluginLoader._get_paths, as of 391fb98e, was only finding plug-ins that
were in a subdirectory of one of the basedirs (i.e. in a category
directory).  For example, action_plugins/foo.py would never be loaded,
but action_plugins/bar/foo.py would work.

This makes it so that "uncategorized" plug-ins in the top level of a
directory such as action_plugins will be loaded, though plug-ins in a
"category" subdirectory will still be preferred.  For example,
action_plugins/bar/foo.py would be preferred over action_plugins/foo.py.
12 years ago
Nicolas Grilly 75ceb80572 Escape args injected in new style modules 12 years ago
David Simon 190ce16bab Dealing with invalid symlinks and symlink permissions 12 years ago
Dale Sedivec 515fd9e915 copy action plug-in check mode respects force=no
The copy action accepts force=no, which tells it not to replace an
existing file even if it differs from the source.  The copy action
plug-in wasn't respecting this option when operated in check mode, so it
would report that changes are necessary in check mode even though copy
would make no changes when run normally.

Runner._remote_md5 was changed to make the logic for setting rc perhaps
a little more clear, and to make sure that rc=0 when the file does not
exist.
12 years ago
Michael DeHaan 7c6341718e Merge branch 'combine_vars' of git://github.com/laggyluke/ansible into exp
Conflicts:
	lib/ansible/inventory/vars_plugins/group_vars.py
	lib/ansible/runner/__init__.py
	lib/ansible/utils/__init__.py
	test/TestPlayBook.py
12 years ago
willthames 377bc31311 Prevent premature substitution of variables into tasks
As documented in #2623, early variable substitution causes when_
tests to fail and possibly other side effects.

I can see the reason for this early substitution, likely introduced
in 1dfe60a6, to allow many playbook parameters to be templated.
This is a valid goal, but the recursive nature of the utils.template
function means that it goes too far.

At this point removing tasks from the list of parameters to be
substituted seems sufficient to make my tests pass. It may be the
case that other parameters should be excluded, but I suspect not.

Adding a test case. I would prefer to analyse not just the aggregate
statistics but also whether the results are as expected - I can't
see an easy way to do that with the available callbacks at present.
12 years ago
Michael DeHaan 81a926547c Some continued work on new-style templates and associated test code changes. Legacy template functions
are marked with "legacy_" for possible future removal.
12 years ago
Michael DeHaan b09ef21ec9 Add code to flag legacy templating like $foo.{bar} as deprecated in favor of Jinja2 {{ foo.bar }} so we
can remove the legacy system at a later date.
12 years ago
Michael DeHaan e8085ad40c Since we removed the (undocumented) playbook include + with_items code, fix the tests to
compensate.
12 years ago
willthames 9d87733f98 Test case and fix for shlex.split unicode bug
When operating on a unicode string in python 2.6, shlex.split returns
a result that does not work with the file constructor.

To reproduce this requires a task include that is templated (this is
because the templated string is a unicode result, whereas a non-
templated string is a non-unicode string)

    [will@centos6.3] $ python
    Python 2.6.6 (r266:84292, Sep 11 2012, 08:34:23)
    [GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import shlex
    >>> shlex.split(u'abc')
    ['a\x00\x00\x00b\x00\x00\x00c\x00\x00\x00']

    [will@fedora17] $ python
    Python 2.7.3 (default, Jul 24 2012, 10:05:38)
    [GCC 4.7.0 20120507 (Red Hat 4.7.0-5)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import shlex
    >>> shlex.split(u'abc')
    ['abc']

The proposed fix (coercing the include parameters to string before the
shlex.split) may not be ideal but it does fix the bug for my test case.
12 years ago
George Miroshnykov 6826aa7360 Tweaked merge_hash to also affect Runner behavior 12 years ago
Michael DeHaan 7116c83c4a Standardize test output 12 years ago
Michael DeHaan 2c783c7145 Disable a test temporarily 12 years ago
Michael DeHaan cdaa2085ee Preliminary ability to use Jinja2 {{ }} to replace ${foo.bar} in playbooks. Can't use both at the same time per line. 12 years ago
tin ca581840ef Added additional lineinfile documentation.
A little more unit testing.
12 years ago
tin f9b70822d2 Fixed to the lineinfile module.
Added the backrefs parameter to the lineinfile module.
Added tests for the backrefs functionality of the lineinfile module.
12 years ago
Javier Candeira ca6c36e1ac password lookup plugin, with working tests and documentation 12 years ago
Michael DeHaan 839dff8eae Disable filter test for now since it should really be testing at a lower level. 12 years ago
Daniel Hokka Zakrisson 1f8805d9e0 Add some tests for directory-based inventory 12 years ago
Devin Bayer fca1167a0e add to_nice_yaml|json filters 12 years ago
Yves Dorfsman cff8cdd428 Using the _get_test and _get_stage methods. 12 years ago
Yves Dorfsman 943829c9b7 Added test cases for lineinfile. 12 years ago
Mike Grozak 171a01deac Cron module upgrades
- added cron_file attribute: if specified, the file with appropriate
job is created in /etc/cron.d directory. Also, you can store multiple
jobs in one file. state='absent' attribute is handled in the following
way in this case: if after the deletion of the job from the file specified
by cron_file variable the file is empty, the file is deleted, otherwise
not.
  - fixed the behaviour, when the backupfile is saved forever in /tmp
folder, even if the backup= atribute is not set (os.unlink() is called if
backup is not True).
  - added some comments to the unobvious places
12 years ago
Rune Kaagaard 7a8b27f716 Fixing bug with unicode templates.
The utils.md5s() function would break when calculating checksums
for non-ascii characters. Convert to utf-8 first.
12 years ago
Daniel Hokka Zakrisson a79373f6b2 Make template_ds the only templater
Instead of having to remember when to use which one, rename template_ds
to template and move the last bit of code from template to varReplace
(which gets used for all string replacements, in the end).

This means that you can template any data type without worrying about
whether it's a string or not, and the right thing will happen.
12 years ago
Juha Litola 2796603c92 Removed apt_key tests, as they didn't test the real functionality.
Tests used heavily mocked version of the apt_key code, which meant that
it didn't properly test real life scenario.
12 years ago
Jayson Vantuyl ad6373430b add apt_key module
Pretty straightforward.  Give it a URL with an exported GPG key for signing an
Apt repository.  It downloads it and will install it using apt-key.  It's even
smart enough to tell if it's already there (i.e. actually tells you if it
changed or not).
12 years ago
Jayson Vantuyl 13ddd39db9 add with_sequence lookup plugin
Plugin allows you to do easy counts for items.
12 years ago
Daniel Hokka Zakrisson 87b2378e22 Resolve variable references inside variables
Fixes the case where variable x is '$y' and y is a dict(foo='bar') and
an attempt to access ${x.foo} is made.
12 years ago
Michael DeHaan 04195e202d Merge pull request #1747 from njharman/alpharange
Alphabetic inventory hostname patterns.
12 years ago
Michael DeHaan 4bcdd24688 Merge pull request #1776 from junegunn/inventory-group-var-ws
Allows whitespaces around assignment operators when defining group variables
12 years ago
Michael DeHaan dede11750c Merge pull request #1775 from dagwieers/boolean-yes-no
Make use of yes/no booleans in playbooks
12 years ago
Junegunn Choi 7fbb7e079a Fix hostname expansion bug in inventory parser 12 years ago
Junegunn Choi daf797804b Allows whitespaces around assignment operators
when defining group variables
12 years ago
Dag Wieers 66fb7fd9de Make use of yes/no booleans in playbooks
At the moment Ansible prefers yes/no for module booleans, however booleans in playbooks are still using True/False, rather than yes/no. This changes modifies boolean uses in playbooks (and man pages) to favor yes/no rather than True/False.

This change includes:

- Adaptation of documentation and examples to favor yes/no
- Modification to manpage output to favor yes/no (the docsite output already favors yes/no)
12 years ago
Michael DeHaan 70bb7d1e54 Merge pull request #1696 from gregorg/enhance_limit
Allow regex to be used to select hosts in addition to fnmatch pattern
12 years ago
Daniel Hokka Zakrisson 54b45e9bd4 Allow intersecting host patterns by using &
This allows patterns such as webservers:!debian:&datacenter1 to target
hosts in the webservers group, that are not in the debian group, but are
in the datacenter1 group. It also parses patterns left to right.
12 years ago
Norman J. Harman Jr 6603737e4d Alphabetic inventory hostname patterns.
- Code, docs, tests.
  - Also added test of large range 000-142 to verify alpha range did not
    break this.
12 years ago
Gregory Duchatelet 8bc1b69c58 Add a unit test to subset limiting via a regex, and some doc in man
page.
12 years ago
Brian Coca 6a1e2aaff5 moved override matching string to variable changed test template to match Signed-off-by: Brian Coca <briancoca+ansible@gmail.com>
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
12 years ago
Brian Coca d751d88b48 added test for template overrides Signed-off-by: Brian Coca <briancoca+ansible@gmail.com>
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
12 years ago
Daniel Hokka Zakrisson 0c70abfaa9 Make sure any existing groups gets reused 12 years ago
Michael DeHaan 0c4b30a471 Aliased node test doesn't make sense locally, so remove it. 12 years ago
Michael DeHaan 9985995a9d Make tests use the local connection type, fix missing callback in tests. 12 years ago
Daniel Hokka Zakrisson e74ffd6764 Lookup plugin arguments need to be templated 12 years ago
Daniel Hokka Zakrisson eebbbd3f0e Make parameterized playbook includes work with vars as a list
Fixes #1610.
12 years ago
Daniel Hokka Zakrisson 5752d2a850 Fix lookup plugin test properly 12 years ago
Daniel Hokka Zakrisson d2dce1d63f Make lookup plugin replacements part of the main variable logic 12 years ago
Daniel Hokka Zakrisson f91fa9f765 Fix lookup plugin test 12 years ago
Daniel Hokka Zakrisson 9c095b72b9 Add parameterized playbook includes
Also makes with_* work with them.

Fixes #1162.
12 years ago
Daniel Hokka Zakrisson 383dc30560 Rename varReplaceWithItems to template_ds 12 years ago
Daniel Hokka Zakrisson 43419d7b20 Add tests for lookup plugins 12 years ago
Daniel Hokka Zakrisson 47082a9171 Add $LOOKUP(<lookup plugin>,<data>) as a templating option
Also moves file and pipe to lookup_plugins.
12 years ago
Daniel Hokka Zakrisson 40af8eff14 Add testcase for first_available_file 12 years ago
Daniel Hokka Zakrisson 56314f7225 Add test case for non-existing variable in varReplaceWithItems 12 years ago
Daniel Hokka Zakrisson fbda2d4628 Use default port if ansible_ssh_port is not set for the delegated node
Also add testcase for it.
12 years ago
Daniel Hokka Zakrisson efe83daf19 Fix ${var.$other_var} and add test cases for it 12 years ago
Michael DeHaan 6ba30170dd Make group_vars and host_vars available to usr/bin/ansible, and make vars_plugins exist 12 years ago
Michael DeHaan e04dab904a Use previous proven multiprocessing logic as the simplification didn't have the same Ctrl-C handling and may
be subject to race issues, though still don't pass Runner to each.  Still seems performant.
12 years ago
Michael DeHaan f8e946b71d Merge branch 'varfind-cleanups' of git://github.com/dhozac/ansible into devel 12 years ago
Daniel Hokka Zakrisson 1449c8ac67 Fix ansible_ssh_host again
This time with unit tests to ensure it keeps working.
12 years ago
Daniel Hokka Zakrisson c9c5fc1456 Merge varFind and varLookup 12 years ago
Michael DeHaan cbc12f0dba Various performance streamlining and making the file features usable in all modules without daisy chaining. 12 years ago
Michael DeHaan 6fa1a49037 Fix the basic templating system such that when the template ends in '$', life continues as normal. 12 years ago
willthames 5a769a5a4d Fixed tests to reflect desired configuration behaviour
Test for when environment variable and configuration file
variable both set now tests that the environment variable takes
precedence

Removed logic that would never be triggered from
lib/ansible/constants.py
12 years ago
Michael DeHaan 0837a29e51 Only expand lists in templating inside of module action lines, to avoid breaking usage with with_items and "in" statements, etc 12 years ago
Michael DeHaan 7583704144 "force=" code under the file module is problematic, remove it 12 years ago
Michael DeHaan c5d2f6b0d3 implement lookup plugins for arbitrary enumeration over arbitrary things. See the mailing list for some cool examples. 12 years ago
Jeroen Hoekx 23a62f5a78 Return multiple groups from inventory API. 12 years ago
Jeroen Hoekx 30c019447b Fix typo in inventory API test script. 12 years ago
Daniel Hokka Zakrisson 695b4bcb46 Allow non-string types in with_items variables 12 years ago
Daniel Hokka Zakrisson 6477bdc6fc Use a regexp to filter out arguments instead
pipes.quote is a bit overzealous for what we want to do, quoting ;
and other characters that you most likely want to use in your shell
invocations. The regexp is the best I could come up with to be able
to only replace the parts of the arguments that shouldn't be
executed.
12 years ago
Michael DeHaan 22f3aef4dc remove test for private function that is no longer present 12 years ago
Daniel Hokka Zakrisson dfee6e19ca Replace lists with a comma-separated join 12 years ago
Daniel Hokka Zakrisson 4b29c2cf74 Revert pull request #1091
Automatic quoting of variables in only_if breaks existing playbooks
where entire statements are put in a variable, and other cases. See
issue #1120 for details.
12 years ago
Michael DeHaan 06cfc52afd fix tests and change nosetests flags so asserts show what comparisons failed 12 years ago
Daniel Hokka Zakrisson 9e4fac5ebd Create a string parser for varReplace instead of using re
This fixes a few issues,
- ${foo}${bar} would be parsed as a variable named foo}${bar,
  which wouldn't be easily fixed without breaking ${foo.${bar}}
- allows escaping . in variable parts so e.g.
  ${hostvars.{test.example.com}.foo} works

This is slower than using re. 3 million templating calls take about
about twice as long to complete with this compared to the regexp,
from ~65 seconds to ~115 seconds on my laptop.
12 years ago
Daniel Hokka Zakrisson b55ef665ba Fix only_if statements referencing non-string types
This fixes e.g. only_if: ${task.changed} which would always
evaluate to true due to it having been replaced by a string for its
boolean value. Also adds a test case to ensure it doesn't get
missed again.
12 years ago
Daniel Hokka Zakrisson 51216dcfae Add tests for varReplace repr 12 years ago
Michael DeHaan 4ded8cb3b3 Change $FILE{} and $PIPE{} to $FILE() and $PIPE() 12 years ago
Daniel Hokka Zakrisson cc948f339c Allow including files through variables
$FILE{file} will be replaced with the contents of "file"
$PIPE{cat file} will be replaced with the output of "cat file"
12 years ago
Michael DeHaan b8c4bb9e6e Revert "Allow including files through variables"
This reverts commit bf47bb4753.

Conflicts:

	lib/ansible/utils.py
	test/TestUtils.py
12 years ago
Michael DeHaan b2af95e4a6 Change $FILE{} and $PIPE{} to $FILE() and $PIPE() 12 years ago
Michael DeHaan e1ecb95b3d Delete test that was coded against *local* resolv.conf -- obviously not going to be the same between people's computers 12 years ago
Michael DeHaan 08b70949c7 Fix a test and a typo in an example 12 years ago
Aleksej Romanov eefe66f1cc Squashed commit of the following:
commit 80a26a8175b779b707bc08e9d28c451c30ee4ada
Merge: b25b9fd 61e9b27
Author: Michael DeHaan <michael.dehaan@gmail.com>
Date:   Tue Sep 18 21:01:47 2012 -0400

    Merge branch 'devel' of git://github.com/alopropoz/ansible into file-force

commit 61e9b27df2
Merge: 3f6f329 16bf3e1
Author: Aleksej Romanov <alopropoz2@yandex.ru>
Date:   Thu Sep 13 20:48:02 2012 +0700

    Merge remote branch 'upstream/devel' into devel

commit 3f6f3291df
Author: Aleksej Romanov <alopropoz2@yandex.ru>
Date:   Thu Sep 13 20:41:31 2012 +0700

    'force' option for 'file' module.

commit 6223bba941
Author: Aleksej Romanov <alopropoz2@yandex.ru>
Date:   Thu Sep 13 20:40:19 2012 +0700

    changed = True when changing symlink referent, #1008. Needed for tests.
12 years ago
Michael DeHaan b25b9fd840 Merge pull request #1058 from jkleint/devel
Support iteration over command output in with_items.
12 years ago
John Kleint 2a002f5c0b Support iteration over command output in with_items.
When the output of a command is stored in a register, this will create a
stdout_lines field in the result object that contains stdout split into a list
of lines.  This list can then be iterated over using with_items.
12 years ago
Daniel Hokka Zakrisson 9e78b10ae3 Add test data file 12 years ago
Daniel Hokka Zakrisson bf47bb4753 Allow including files through variables
$FILE{file} will be replaced with the contents of "file"
$PIPE{cat file} will be replaced with the output of "cat file"
12 years ago
Michael DeHaan 04555f525e Fix a test from a previous pull request. 12 years ago
John Kleint 1f8696f5c1 Fix inventory.get_hosts when hosts is a list. 12 years ago
Brian Coca 83d1028a21 - Makefile now works with freebsd (date command options are diff)
date still issues warning and ignores TZ

- Updated tests to work inside bsd jails (127 addresses are an issue)
Signed-off-by: Brian Coca <briancoca+ansible@gmail.com>
12 years ago
Michael DeHaan 508c04b85b remove svn tests 12 years ago
Dane Summers eb49ee38ae full test case for subversion, minimal tests for git 12 years ago
Dave Peticolas b42e835aab Always load group_vars and host_vars. 12 years ago
Michael DeHaan 9041adddaa Add support for ranged patterns like webservers[0-49] for hitting the first 50 webservers. 12 years ago
Michael DeHaan de21cb27d8 Remove tests that involve network effects -- makes things faster and they are not really deep tests here either way. 12 years ago
Michael DeHaan 259f2dc4de Various retooling of the internal code behind inventory pattern matching in support of pending support
for host ranges.
12 years ago
Dave Peticolas 08272dc25d Remove unused imports. 12 years ago
Michael DeHaan 1c9b43df1b more whitespace 12 years ago
Petros Moisiadis 2ac4acbf97 fixes for tests 12 years ago
Will Thames 845a7ac5ae test_one not working as tests after skipped test failing, because
on_skipped callback being passed an extra item parameter that it wasn't
expecting.
Fixed it so that on_skipped in TestCallbacks accepts and ignores the
extra parameter
Extra parameter was added in 4b9b9a8a5b
but not really clear why from commit message
12 years ago
Michael DeHaan d79900b434 Merge pull request #732 from willthames/fix_git_fail_json
Fixes for git module when it fails.
12 years ago
u348095 e863ba0cec Fixes for git module when it fails.
* module.fail_json *must* have msg argument
Using http://github.com/ rather than git://github.com/ as it gets through more
firewalls
12 years ago
Michael DeHaan fe558f680a Fix some failing tests, script tests seem to indicate magic variables are not being provided
to scripted inventory so need to investigate this.
12 years ago
Michael DeHaan 47cead3603 Merge pull request #727 from sfromm/git
Git module ported to use module magic
12 years ago
willthames 1bcba4f4a2 test/TestRunner.py now executes false with no directory prefix
as it is /bin/false on many systems but /usr/bin/false on OS X
test/playbook1.yml now just does command true, rather than command /bin/true,
again so that it works on OS X

Changed from using which false to just using command false to
make it simpler and also match how playbook1.yml works
12 years ago
Stephen Fromm 90bf67cf56 Make test_git functional in TestRunner.py 12 years ago
Michael DeHaan 8fa4dc3920 Small change to previous patch, make ranges of hosts inclusive. 12 years ago
Chin Fang e3b2521f01 Added a host expansion feature to ansible's inventory parsing 12 years ago
Michael DeHaan dde11baa56 Remove YAML inventory tests since this is now deprecated. 12 years ago
Michael DeHaan 9e62fd42b5 update test utils code 12 years ago
Michael DeHaan 867b2437cc consolidate output code in callbacks.py, from utils, remove extra functions 12 years ago
Michael DeHaan 279b5965b8 Much streamlining around setup steps in playbooks, now only run setup once per play. 12 years ago
Michael DeHaan 931f9f1a61 Setup module no longer saves to disk, as templates are mostly useful in playbooks and this allows lots of simplifications
around file pathing and removes occasional permissions conflicts depending on how things are used.
12 years ago
Michael DeHaan 60f295f7a0 Squashed commit of the following:
commit 4430ce3eefcdff0b0ceffea0ef66ea8e876a807d
Merge: 631783b 649963c
Author: Michael DeHaan <michael.dehaan@gmail.com>
Date:   Thu Jul 12 01:28:43 2012 -0400

    Merge branch 'host-groups' of https://github.com/dagwieers/ansible into daggroups

commit 649963ca2c
Author: Dag Wieërs <dag@wieers.com>
Date:   Thu Jul 12 23:01:00 2012 +0200

    Added comments in the example yaml file as requested

commit 7f9718f185
Author: Dag Wieërs <dag@wieers.com>
Date:   Thu Jul 12 22:49:38 2012 +0200

    Add the default nose color too, to test specific overrides

commit eb63b9e899
Author: Dag Wieërs <dag@wieers.com>
Date:   Thu Jul 12 22:44:35 2012 +0200

    Introduce comics and cartoons to test yaml groups defined on a per-node basis

commit aa13d23307
Author: Dag Wieërs <dag@wieers.com>
Date:   Thu Jul 12 19:33:15 2012 +0200

    A small fix to revert to old state

commit 264ebaa77c
Author: Dag Wieërs <dag@wieers.com>
Date:   Thu Jul 12 19:31:51 2012 +0200

    Combine both yaml unit tests into one example file

commit 7db49a8048
Author: Dag Wieërs <dag@wieers.com>
Date:   Thu Jul 12 16:46:53 2012 +0200

    Might as well fix this too

commit f36c6c8c5b
Author: Dag Wieërs <dag@wieers.com>
Date:   Thu Jul 12 16:42:00 2012 +0200

    Added unit tests for host-groups patch

    For the unit test I chose to keep the original yaml file in place as a reference.

    This patch also includes a fix.

commit a96f681352
Author: Dag Wieërs <dag@wieers.com>
Date:   Thu Jul 12 12:30:43 2012 +0200

    Allow groups to be defined on a per-host basis

    This makes it possible to define on a per-host basis what groups a host is in.
    When managing a large set of systems it makes it easier to ensure each of the
    systems is defined in a set of groups (e.g. production/qa/development,
    linux/solaris/aix) rather than having to add systems to multiple disconnected
    groups.

    ----
      - host: system01

      - host: system02

      - host: system03

      - group: linux
        hosts:
        - system01
        - system02

      - group: solaris
        hosts:
        - system03

      - group: production
        hosts:
        - system01
        - system03

      - group: qa
        - system02

      - group: dbserver
        hosts:
        - system01

      - group: ntpserver
        hosts:
        - system02

      - group: webserver
        - system03
    ----

    Can be redefined as:

    ----
      - host: system01
        groups: [ linux, production, dbserver ]

      - host: system02
        groups: [ linux, qa, ntpserver ]

      - host: system03
        groups: [ solaris, production, webserver ]
    ----
12 years ago
Michael DeHaan efac68b636 Remove the -D module debug flag, which no longer is functional due to sudo pty requirements, and replace with -v/--verbose.
This flag will show playbook output from non-failing commands.  -v is also added to /usr/bin/ansible, but not  yet used.

I also gutted some internals code dealing with 'invocations' which allowed the callback to know what module invoked
it.  This is not something 0.5 does or needed, so callbacks have been simplified.
13 years ago
Jeroen Hoekx d592e15dcc Correctly add ungrouped hosts to 'ungrouped' in YAML inventory. 13 years ago
Daniel Hokka Zakrisson 031c75e53a Update tests to reflect new API 13 years ago
Daniel Hokka Zakrisson 24d73b0fe6 Add tests of iterative templating 13 years ago
Daniel Hokka Zakrisson 05a7a3725b Add tests of host exclusions 13 years ago
Michael DeHaan bd893b765b Merge pull request #459 from dhozac/with_items-variable
Allow a variable in with_items
13 years ago
Stephen Fromm 9cf182c225 Add assemble module
This adds a module that concatenates (ie. assembles) a file from
fragments in a directory in alphabetical order.  It chains the file
module afterward to fix up ownership and permission.  This also adds
tests for the assemble module with fragments in assemble.d.
13 years ago
Daniel Hokka Zakrisson a05da2d312 Allow with_items to specify a variable 13 years ago
John Kleint 70837469c6 Properly template list of hosts in playbooks.
In playbooks, hosts can be a YAML list. We templated the list before
converting it to a semicolon-separated string, which actually templated its
repr. This converts to a string first. A basic unit test is included.
13 years ago
Matt Goodall 639763c138 Allow "=" in k-v values. 13 years ago
Michael DeHaan 8e88667f82 Fix hosts being in multiple groups, and duplicate host references in the same inventory file. 13 years ago
Jeroen Hoekx ecc0b0770c If /usr/share/dict/words does not exist, use cracklib-small to test large output. 13 years ago
Michael DeHaan d4f660edc3 Do not run unit tests against the EVENTS code because it is subject to change and that does not mean anything is broken.
If we want to test playbooks, it's best to test the result of a playbook to make sure it does the correct thing.  Also
remove playbook2/3 yml which were not used.
13 years ago
Michael DeHaan f8807da57b Merge pull request #363 from jhoekx/template-only-if
Fix correct variable expansion in includes only_if.
13 years ago
Jeroen Hoekx cd9f926b5f Fix correct variable expansion in includes only_if.
There's not need to run the complete include through the templating engine.
Several variables were not included before the conditional was evaluated.
13 years ago
Jeroen Hoekx 3cbc229990 Support list indexing in varReplace. 13 years ago
Jeroen Hoekx 74e21e6154 Fixup unicode varReplace templating.
The original patches should have conflicted?
53bde0bf51 vs efde61e537
13 years ago
Michael DeHaan 36639186e0 Merge pull request #362 from jhoekx/uppercase-vars
Allow camelCase variables in varReplace.
13 years ago
John Kleint 83b9a43e60 Add test for large output; fix indentation. 13 years ago
Jeroen Hoekx dc60f2d844 Allow camelCase variables in varreplace. 13 years ago
Jeroen Hoekx 2bbc05185e Make no_engine the default templating action. 13 years ago
Jeroen Hoekx 82144fd543 Support nested variables in varReplace. 13 years ago
Jeroen Hoekx e09572a8e1 Inventory: undefined group -> ungrouped.
Also change test name collision.
13 years ago
Jeroen Hoekx d419a13ca7 Inventory: support list of vars in host. 13 years ago
Michael DeHaan 157d21b1c3 Add tests for new advanced inventory features (groups of groups, group variables) in the default INI format file. 13 years ago
Michael DeHaan 1a00e2635e Further work on making the YAML inventory parser use the new inventory objects. 13 years ago
Michael DeHaan 256377166a Reinstate external inventory script support this time using the new more OO-ey inventory system.
Next up: YAML format.
13 years ago
Michael DeHaan 0669ce858a Refactored inventory to make it object oriented, need to make YAML format and executable script
format compatible with this still, and add some tests for INI-style groups of groups
and variables.
13 years ago
Jeroen Hoekx 03541baba7 Define 'inventory_hostname' variable for hosts. 13 years ago
Jeroen Hoekx 029fe1273c Modify /usr/bin/ansible and playbooks to use the new async API. 13 years ago
Jeroen Hoekx b87710a1df Introduce group_names in template variables.
This is a list of all the groups a host is in.
13 years ago
Michael DeHaan b9982fc17b Reinstate --extra-vars, which can do things in playbooks like:
ansible-playbook release-my-app.yml --extra-vars="version=123"

And make $version available in the playbook without re-editing the file
13 years ago
Jeroen Hoekx cc579a8aa2 Fix tests for facter and the ansible_facts API. 13 years ago
Jeroen Hoekx 2dc9a563ef Allow modules to return facts.
If the module result contains "ansible_facts", that will be added to the setup
cache.
13 years ago
Michael DeHaan c0c691089d Fix bug in src. Should not code this early :) 13 years ago
Jeroen Hoekx 903e4f6eae Support dicts in inventory vars. 13 years ago
Michael DeHaan 30d06dbcea Don't force down ansible facts back to setup, the setup module won't like parsing them on input and that
data is already there.
13 years ago
Michael DeHaan da0209dbc4 The fetch module really should preserve the whole directory structure being fetched to allow subsequent calls,
particularly in playbook, to recreate the host tree structure.  Making it thus.
13 years ago
Jeroen Hoekx 6f09b41eb5 Don't test modules that aren't present.
Also account for path difference in sleep in different distributions.
13 years ago
Michael DeHaan 3f26a1c7f6 verbose option is not being used, so remove it. debug variable still exists. 13 years ago
Michael DeHaan 9ce27be878 Remove extra_vars tests 13 years ago
Jeroen Hoekx 8c3206c99f Return a copy of the host variables. 13 years ago
Jeroen Hoekx 961ccdb2f4 List hosts in no group in the ungrouped group. 13 years ago
Jeroen Hoekx 3a24aa9a70 Add YAML inventory format.
See test/yaml_hosts for an example.

Hosts can be part of multiple groups.

Groups can also have variables, inherited by the hosts.
There is no variable scope, last variable seen wins.
13 years ago
Jeroen Hoekx 54f4526160 Export SSH port number as host variable. 13 years ago
Jeroen Hoekx f04041b37d Ignore port numbers in simple inventory format 13 years ago
Jeroen Hoekx 746f1b92ae Reimplement the class method on Runner. 13 years ago
Jeroen Hoekx 195e6d617b Add tests for Inventory class. 13 years ago
Michael DeHaan 08c593bee1 Warn if no hosts matched 13 years ago
Michael DeHaan b9e3b053f9 Simplify playbook tests so things are not timing dependent in the poll section, which is leading to tests
not being consistent between runs, even though there wasn't an error.  Now we'll just check the final change
counts, which should be just as solid and lead to less churn in the events file.
13 years ago
Michael DeHaan e103bdda93 Rename test class to match what it is testing 13 years ago
Michael DeHaan 245aa9bf8e Some tweaks to the fetch module. 'err' return was for stderr, so that should be empty string.
Some minor code shortening.  Added a test to TestRunner.
13 years ago
Michael DeHaan 51e4faf7aa Update test file -- we probably should not include the poll as the number of polls is changing between test
runs (that's ok, it's not intended to be realtime accurate)
13 years ago
Michael DeHaan 1d75a29ec9 Allow variables coming in from the playbook and the API to be expressed as dictionaries throughout their full life cycle
such that nested data can be made available in templates and playbooks.
13 years ago
Michael DeHaan eed4a2b717 Update tests to use 127.0.0.2 to bypass the smart "use local connection" code, and also to reflect
that commands now trigger change events.
13 years ago
Michael DeHaan 2a2b5ed73c Polling timing change results in need to change events file for tests. 13 years ago
Michael DeHaan 4792021f47 Fix syntax error in user patch 13 years ago
Michael DeHaan 2511992659 Surface module debug (-D) to /usr/bin/ansible also 13 years ago
Michael DeHaan 96a22b582b Disable ohai test as it's hanging for whatever reason, but doesn't do this in real life.
Run tests in verbose mode.
13 years ago
Michael DeHaan 3ded27fe35 Treat module args as strings everywhere to avoid unneccessary shlex and requoting 13 years ago
Michael DeHaan 6db87a5018 Minor style fix, update test to match quote fix patch 13 years ago
Michael DeHaan 6dda6f12dc Applying callback model to runner, and using that in playbooks, so output can be more immediate in playbooks.
(Runner still does not use callbacks for default output)
13 years ago
Michael DeHaan 44d4dede92 Split conditional imports in playbook into subfunction, fix small bug in event reporting on playbook
actions.
13 years ago
Michael DeHaan 6ab615c724 Code cleanup for playbooks, also added 'on_skipped' callback 13 years ago
Michael DeHaan 3814a46bbf Move playbook for user commands into examples dir 13 years ago
Michael DeHaan 6aa10691c1 Merge pull request #93 from sfromm/user-module
User module
13 years ago
Stephen Fromm 999bead9ed Add playbook to test user module 13 years ago
Michael DeHaan e6406fa5a7 Allow variable expressions to be stored as variables themselves, do some things to allow setup strings
to more easily contain spaces without being mangled, which is neccessary because of the above.
13 years ago
Michael DeHaan a5f4ca50b8 Ratchet up logging a few notches prior to controlling w/ verbosity settings 13 years ago
Michael DeHaan b5c62ec068 Enhance logging, way to gate verbosity levels pending. 13 years ago
Michael DeHaan dfbe591cc0 Add "only_if" capability, which allows task steps to be skipped if they do not match a conditional. 13 years ago
Michael DeHaan 4de7bbb169 Allow conditional imports, see examples/playbook3.yml comments for a full explanation. Extensive
refactoring of playbooks now warranted, which we'll do before we move on.   This variable assignment
system makes nearly all possible magic possible, for we can use these variables however we like,
even as module names!
13 years ago
Michael DeHaan 5ed2b894d9 Add an additional way to dereference a variable in a playbook, $foo
(Using varReplace function originally from yum, thanks Seth)
13 years ago
Michael DeHaan c1fe0dd719 Quote long variables in playbooks when feeding them to the setup command 13 years ago
Michael DeHaan 5371a9e497 Regression tests for playbooks, logging the events they call via callbacks. 13 years ago
Michael DeHaan b15c8e9cb1 Playbook test upgrades, made some notes about callbacks we need to add. Still need to compare events
recieved vs expected so we can be notified if this test breaks, and also to add some more detailed
playbooks that use includes & async, etc.
13 years ago
Michael DeHaan 45abe3c16b Add unit tests for playbooks, and fix an error caught by one 13 years ago
Michael DeHaan 4bde4926c3 Modules don't have to return JSON, key=value pairs is ok. 13 years ago
Michael DeHaan 40fd778e2c 'shell' is a magic module that executes the command module with shell=True 13 years ago
Michael DeHaan 73d20b81c6 Add basic test of yum module (VERY basic) just to make sure syntax remains ok. Need to do something
trivial for service and git module also.
13 years ago
Michael DeHaan 696b67f935 Fix async to use the new argfiles method (wrapping brain around rock, really must write module development guide) 13 years ago
Michael DeHaan cb5929dad7 Setup module tests 13 years ago
Michael DeHaan c71afe35d6 Async tests complete. Fixed bug in async_wrapper 13 years ago
Michael DeHaan fae3a71899 WIP on async tests 13 years ago
Michael DeHaan f8eab8ed7e Here are those tests I talked about previously :) 13 years ago