Commit graph

319 commits

Author SHA1 Message Date
Michael Scherer
498a550f01 add test for the disabling of callback plugins 2013-08-15 00:05:33 +02:00
Michael DeHaan
4bdbe4dc4f Remove some test prints 2013-08-10 17:37:04 -04:00
Michael DeHaan
76fd769704 Merge pull request #3685 from mspaulding06/indexed_items
Indexed items lookup plugin
2013-08-03 11:36:51 -07:00
Michael DeHaan
3ebbb56479 Merge pull request #3654 from MaxIV-KitsControls/devel
Fix nested loop for more than 3 elements
2013-08-01 17:11:26 -07:00
Matt Spaulding
b7154cf2cf Add tests for indexed_items lookup plugin 2013-07-28 14:16:25 -07:00
Vincent Hardion
09ef7751e1 Fix nested loop for more than 3 elements
- combine flatten list for each nested level instead once at the end
2013-07-24 14:19:13 +02:00
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".
2013-07-23 22:24:53 +02:00
Michael DeHaan
88720516a1 Merge branch 'changed_when' of git://github.com/stoned/ansible into changed_when 2013-07-21 10:14:03 -04:00
Tin Tvrtkovic
4a732c1e9f Enabled the use of extra vars in playbook file paths when including playbooks from other playbooks. 2013-07-18 22:45:18 +02:00
Stoned Elipot
eb45f07ae3 Introduce 'changed_when' keyword to override a task's changed status with the evaluation of a Jinja2 expression 2013-07-14 21:07:45 +02:00
Stoned Elipot
baf868f825 Add test for 'ignore_errors:' 2013-07-01 02:31:16 +02:00
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.
2013-06-22 17:01:12 -05:00
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.
2013-06-19 09:14:20 +03:00
Michael DeHaan
4ae3ef8af9 Disable inventory test 2013-06-03 11:52:42 -04:00
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.
2013-05-31 12:34:45 -06:00
Pol Llovet
ba78360c52 Remove inline comments from inventory tokenizing. 2013-05-30 14:12:23 -06:00
Michael DeHaan
a9fcea5893 Merge branch 'escape' of git://github.com/ngrilly/ansible into repr 2013-05-29 18:29:16 -04:00
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.
2013-05-24 17:05:28 -05:00
Nicolas Grilly
75ceb80572 Escape args injected in new style modules 2013-05-24 01:01:07 +02:00
David Simon
190ce16bab Dealing with invalid symlinks and symlink permissions 2013-05-09 15:35:05 -04:00
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.
2013-04-16 20:22:51 -04:00
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
2013-04-16 20:06:06 -04:00
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.
2013-04-12 09:17:03 +10:00
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.
2013-04-10 19:09:57 -04:00
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.
2013-04-10 17:52:35 -04:00
Michael DeHaan
e8085ad40c Since we removed the (undocumented) playbook include + with_items code, fix the tests to
compensate.
2013-04-10 15:08:18 -04:00
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.
2013-04-08 14:47:43 +10:00
George Miroshnykov
6826aa7360 Tweaked merge_hash to also affect Runner behavior 2013-04-06 13:06:38 +03:00
Michael DeHaan
7116c83c4a Standardize test output 2013-04-05 13:13:33 -04:00
Michael DeHaan
2c783c7145 Disable a test temporarily 2013-04-05 13:12:46 -04:00
Michael DeHaan
cdaa2085ee Preliminary ability to use Jinja2 {{ }} to replace ${foo.bar} in playbooks. Can't use both at the same time per line. 2013-04-03 01:04:16 -04:00
tin
ca581840ef Added additional lineinfile documentation.
A little more unit testing.
2013-03-27 01:31:58 +01:00
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.
2013-03-27 01:31:58 +01:00
Javier Candeira
ca6c36e1ac password lookup plugin, with working tests and documentation 2013-03-10 13:36:53 +11:00
Michael DeHaan
839dff8eae Disable filter test for now since it should really be testing at a lower level. 2013-03-01 17:42:14 -05:00
Daniel Hokka Zakrisson
1f8805d9e0 Add some tests for directory-based inventory 2013-03-01 23:34:14 +01:00
Devin Bayer
fca1167a0e add to_nice_yaml|json filters 2013-02-28 17:07:02 +01:00
Yves Dorfsman
cff8cdd428 Using the _get_test and _get_stage methods. 2013-02-23 12:50:18 -05:00
Yves Dorfsman
943829c9b7 Added test cases for lineinfile. 2013-02-23 12:50:18 -05:00
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
2013-02-09 11:11:19 -05:00
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.
2013-02-05 14:49:59 +01:00
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.
2013-02-03 14:01:54 +01:00
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.
2013-01-25 17:10:04 +02:00
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).
2013-01-15 17:34:38 -08:00
Jayson Vantuyl
13ddd39db9 add with_sequence lookup plugin
Plugin allows you to do easy counts for items.
2013-01-09 15:30:24 -08:00
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.
2013-01-09 13:45:55 +01:00
Michael DeHaan
04195e202d Merge pull request #1747 from njharman/alpharange
Alphabetic inventory hostname patterns.
2012-12-17 16:52:11 -08:00
Michael DeHaan
4bcdd24688 Merge pull request #1776 from junegunn/inventory-group-var-ws
Allows whitespaces around assignment operators when defining group variables
2012-12-17 16:51:49 -08:00
Michael DeHaan
dede11750c Merge pull request #1775 from dagwieers/boolean-yes-no
Make use of yes/no booleans in playbooks
2012-12-15 11:53:48 -08:00
Junegunn Choi
7fbb7e079a Fix hostname expansion bug in inventory parser 2012-12-16 01:49:12 +09:00
Junegunn Choi
daf797804b Allows whitespaces around assignment operators
when defining group variables
2012-12-14 20:43:29 +09:00
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)
2012-12-14 11:56:53 +01:00
Michael DeHaan
70bb7d1e54 Merge pull request #1696 from gregorg/enhance_limit
Allow regex to be used to select hosts in addition to fnmatch pattern
2012-12-12 14:51:44 -08:00
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.
2012-12-12 11:36:12 +01:00
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.
2012-12-10 20:48:38 -06:00
Gregory Duchatelet
8bc1b69c58 Add a unit test to subset limiting via a regex, and some doc in man
page.
2012-12-02 10:18:58 +01:00
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>
2012-11-26 10:41:13 -05:00
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>
2012-11-26 10:41:13 -05:00
Daniel Hokka Zakrisson
0c70abfaa9 Make sure any existing groups gets reused 2012-11-25 12:42:30 +01:00
Michael DeHaan
0c4b30a471 Aliased node test doesn't make sense locally, so remove it. 2012-11-19 10:45:10 -05:00
Michael DeHaan
9985995a9d Make tests use the local connection type, fix missing callback in tests. 2012-11-19 10:30:30 -05:00
Daniel Hokka Zakrisson
e74ffd6764 Lookup plugin arguments need to be templated 2012-11-14 11:17:30 +01:00
Daniel Hokka Zakrisson
eebbbd3f0e Make parameterized playbook includes work with vars as a list
Fixes #1610.
2012-11-13 12:12:18 +01:00
Daniel Hokka Zakrisson
5752d2a850 Fix lookup plugin test properly 2012-11-13 12:09:42 +01:00
Daniel Hokka Zakrisson
d2dce1d63f Make lookup plugin replacements part of the main variable logic 2012-11-13 02:18:05 +01:00
Daniel Hokka Zakrisson
f91fa9f765 Fix lookup plugin test 2012-11-13 02:13:10 +01:00
Daniel Hokka Zakrisson
9c095b72b9 Add parameterized playbook includes
Also makes with_* work with them.

Fixes #1162.
2012-11-09 15:43:49 +01:00
Daniel Hokka Zakrisson
383dc30560 Rename varReplaceWithItems to template_ds 2012-11-09 15:43:29 +01:00
Daniel Hokka Zakrisson
43419d7b20 Add tests for lookup plugins 2012-11-07 23:21:26 +01:00
Daniel Hokka Zakrisson
47082a9171 Add $LOOKUP(<lookup plugin>,<data>) as a templating option
Also moves file and pipe to lookup_plugins.
2012-11-07 23:17:29 +01:00
Daniel Hokka Zakrisson
40af8eff14 Add testcase for first_available_file 2012-11-06 20:57:35 +01:00
Daniel Hokka Zakrisson
56314f7225 Add test case for non-existing variable in varReplaceWithItems 2012-11-01 19:24:53 +01:00
Daniel Hokka Zakrisson
fbda2d4628 Use default port if ansible_ssh_port is not set for the delegated node
Also add testcase for it.
2012-11-01 12:00:49 +01:00
Daniel Hokka Zakrisson
efe83daf19 Fix ${var.$other_var} and add test cases for it 2012-10-30 13:05:45 +01:00
Michael DeHaan
6ba30170dd Make group_vars and host_vars available to usr/bin/ansible, and make vars_plugins exist 2012-10-26 19:55:59 -04:00
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.
2012-10-26 18:11:38 -04:00
Michael DeHaan
f8e946b71d Merge branch 'varfind-cleanups' of git://github.com/dhozac/ansible into devel 2012-10-25 20:14:20 -04:00
Daniel Hokka Zakrisson
1449c8ac67 Fix ansible_ssh_host again
This time with unit tests to ensure it keeps working.
2012-10-21 21:22:56 +02:00
Daniel Hokka Zakrisson
c9c5fc1456 Merge varFind and varLookup 2012-10-21 20:32:02 +02:00
Michael DeHaan
cbc12f0dba Various performance streamlining and making the file features usable in all modules without daisy chaining. 2012-10-20 22:55:09 -04:00
Michael DeHaan
6fa1a49037 Fix the basic templating system such that when the template ends in '$', life continues as normal. 2012-10-20 10:57:52 -04:00
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
2012-10-18 12:53:30 +10:00
Michael DeHaan
0837a29e51 Only expand lists in templating inside of module action lines, to avoid breaking usage with with_items and "in" statements, etc 2012-10-17 19:35:12 -04:00
Michael DeHaan
7583704144 "force=" code under the file module is problematic, remove it 2012-10-16 18:14:42 -04:00
Michael DeHaan
c5d2f6b0d3 implement lookup plugins for arbitrary enumeration over arbitrary things. See the mailing list for some cool examples. 2012-10-12 20:07:05 -04:00
Jeroen Hoekx
23a62f5a78 Return multiple groups from inventory API. 2012-10-10 18:35:45 +02:00
Jeroen Hoekx
30c019447b Fix typo in inventory API test script. 2012-10-10 18:17:24 +02:00
Daniel Hokka Zakrisson
695b4bcb46 Allow non-string types in with_items variables 2012-10-01 17:07:51 +02:00
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.
2012-10-01 12:13:17 +02:00
Michael DeHaan
22f3aef4dc remove test for private function that is no longer present 2012-09-30 20:49:16 -04:00
Daniel Hokka Zakrisson
dfee6e19ca Replace lists with a comma-separated join 2012-09-30 11:41:44 +02:00
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.
2012-09-28 13:58:23 +02:00
Michael DeHaan
06cfc52afd fix tests and change nosetests flags so asserts show what comparisons failed 2012-09-27 22:12:15 -04:00
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.
2012-09-28 01:03:34 +02:00
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.
2012-09-27 18:36:52 +02:00
Daniel Hokka Zakrisson
51216dcfae Add tests for varReplace repr 2012-09-25 20:14:58 -04:00
Michael DeHaan
4ded8cb3b3 Change $FILE{} and $PIPE{} to $FILE() and $PIPE() 2012-09-19 17:58:16 +02:00
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"
2012-09-19 17:57:17 +02:00
Michael DeHaan
b8c4bb9e6e Revert "Allow including files through variables"
This reverts commit bf47bb4753.

Conflicts:

	lib/ansible/utils.py
	test/TestUtils.py
2012-09-19 10:31:23 -04:00
Michael DeHaan
b2af95e4a6 Change $FILE{} and $PIPE{} to $FILE() and $PIPE() 2012-09-18 21:34:55 -04:00
Michael DeHaan
e1ecb95b3d Delete test that was coded against *local* resolv.conf -- obviously not going to be the same between people's computers 2012-09-18 21:16:35 -04:00
Michael DeHaan
08b70949c7 Fix a test and a typo in an example 2012-09-18 21:10:07 -04:00
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.
2012-09-18 21:04:42 -04:00
Michael DeHaan
b25b9fd840 Merge pull request #1058 from jkleint/devel
Support iteration over command output in with_items.
2012-09-18 17:55:40 -07:00
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.
2012-09-17 16:57:33 -04:00
Daniel Hokka Zakrisson
9e78b10ae3 Add test data file 2012-09-17 18:31:49 +02:00
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"
2012-09-17 16:03:59 +02:00
Michael DeHaan
04555f525e Fix a test from a previous pull request. 2012-09-11 18:04:54 -04:00
John Kleint
1f8696f5c1 Fix inventory.get_hosts when hosts is a list. 2012-09-11 13:00:40 -04:00
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>
2012-08-29 09:46:05 -04:00
Michael DeHaan
508c04b85b remove svn tests 2012-08-28 20:30:14 -04:00
Dane Summers
eb49ee38ae full test case for subversion, minimal tests for git 2012-08-23 00:08:38 -04:00
Dave Peticolas
b42e835aab Always load group_vars and host_vars. 2012-08-13 21:08:05 -07:00
Michael DeHaan
9041adddaa Add support for ranged patterns like webservers[0-49] for hitting the first 50 webservers. 2012-08-11 13:49:18 -04:00
Michael DeHaan
de21cb27d8 Remove tests that involve network effects -- makes things faster and they are not really deep tests here either way. 2012-08-11 11:38:45 -04:00
Michael DeHaan
259f2dc4de Various retooling of the internal code behind inventory pattern matching in support of pending support
for host ranges.
2012-08-11 11:36:59 -04:00
Dave Peticolas
08272dc25d Remove unused imports. 2012-08-09 21:35:22 -07:00
Michael DeHaan
1c9b43df1b more whitespace 2012-08-06 21:00:21 -04:00
Petros Moisiadis
2ac4acbf97 fixes for tests 2012-08-01 22:17:16 +03:00
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
2012-08-01 12:35:17 +10:00
Michael DeHaan
d79900b434 Merge pull request #732 from willthames/fix_git_fail_json
Fixes for git module when it fails.
2012-07-31 05:04:47 -07:00
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
2012-07-31 12:59:22 +10:00
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.
2012-07-30 19:21:49 -04:00
Michael DeHaan
47cead3603 Merge pull request #727 from sfromm/git
Git module ported to use module magic
2012-07-30 13:40:36 -07:00
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
2012-07-30 21:39:58 +10:00
Stephen Fromm
90bf67cf56 Make test_git functional in TestRunner.py 2012-07-29 22:40:12 -07:00
Michael DeHaan
8fa4dc3920 Small change to previous patch, make ranges of hosts inclusive. 2012-07-24 20:10:05 -04:00
Chin Fang
e3b2521f01 Added a host expansion feature to ansible's inventory parsing 2012-07-24 12:38:52 -07:00
Michael DeHaan
dde11baa56 Remove YAML inventory tests since this is now deprecated. 2012-07-20 11:31:28 -04:00
Michael DeHaan
9e62fd42b5 update test utils code 2012-07-16 20:28:32 -04:00
Michael DeHaan
867b2437cc consolidate output code in callbacks.py, from utils, remove extra functions 2012-07-15 10:12:49 -04:00
Michael DeHaan
279b5965b8 Much streamlining around setup steps in playbooks, now only run setup once per play. 2012-07-14 12:24:19 -04:00
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.
2012-07-14 11:59:12 -04:00
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 ]
    ----
2012-07-12 01:29:51 -04:00
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.
2012-06-19 21:57:43 -04:00
Jeroen Hoekx
d592e15dcc Correctly add ungrouped hosts to 'ungrouped' in YAML inventory. 2012-06-27 08:26:01 +02:00
Daniel Hokka Zakrisson
031c75e53a Update tests to reflect new API 2012-06-18 00:13:12 +02:00
Daniel Hokka Zakrisson
24d73b0fe6 Add tests of iterative templating 2012-06-16 13:13:01 +02:00
Daniel Hokka Zakrisson
05a7a3725b Add tests of host exclusions 2012-06-15 19:09:04 +02:00
Michael DeHaan
bd893b765b Merge pull request #459 from dhozac/with_items-variable
Allow a variable in with_items
2012-06-13 19:18:51 -07:00
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.
2012-06-11 23:09:54 -07:00
Daniel Hokka Zakrisson
a05da2d312 Allow with_items to specify a variable 2012-06-09 21:59:22 +02:00
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.
2012-05-31 16:06:21 -04:00
Matt Goodall
639763c138 Allow "=" in k-v values. 2012-05-23 00:58:05 +01:00
Michael DeHaan
8e88667f82 Fix hosts being in multiple groups, and duplicate host references in the same inventory file. 2012-05-19 17:24:54 -04:00
Jeroen Hoekx
ecc0b0770c If /usr/share/dict/words does not exist, use cracklib-small to test large output. 2012-05-15 14:26:43 +02:00
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.
2012-05-09 23:21:44 -04:00
Michael DeHaan
f8807da57b Merge pull request #363 from jhoekx/template-only-if
Fix correct variable expansion in includes only_if.
2012-05-11 15:55:09 -07:00
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.
2012-05-11 15:55:33 +02:00
Jeroen Hoekx
3cbc229990 Support list indexing in varReplace. 2012-05-10 19:25:28 +02:00