Commit graph

273 commits

Author SHA1 Message Date
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
Jeroen Hoekx
74e21e6154 Fixup unicode varReplace templating.
The original patches should have conflicted?
53bde0bf51 vs efde61e537
2012-05-10 10:11:14 +02:00
Michael DeHaan
36639186e0 Merge pull request #362 from jhoekx/uppercase-vars
Allow camelCase variables in varReplace.
2012-05-11 10:06:21 -07:00
John Kleint
83b9a43e60 Add test for large output; fix indentation. 2012-05-11 11:38:15 -04:00
Jeroen Hoekx
dc60f2d844 Allow camelCase variables in varreplace. 2012-05-11 14:14:53 +02:00
Jeroen Hoekx
2bbc05185e Make no_engine the default templating action. 2012-05-09 16:15:43 +02:00
Jeroen Hoekx
82144fd543 Support nested variables in varReplace. 2012-05-09 16:15:43 +02:00
Jeroen Hoekx
e09572a8e1 Inventory: undefined group -> ungrouped.
Also change test name collision.
2012-05-08 09:44:59 +02:00
Jeroen Hoekx
d419a13ca7 Inventory: support list of vars in host. 2012-05-08 09:44:29 +02:00
Michael DeHaan
157d21b1c3 Add tests for new advanced inventory features (groups of groups, group variables) in the default INI format file. 2012-05-06 18:01:11 -04:00
Michael DeHaan
1a00e2635e Further work on making the YAML inventory parser use the new inventory objects. 2012-05-06 17:03:17 -04:00
Michael DeHaan
256377166a Reinstate external inventory script support this time using the new more OO-ey inventory system.
Next up: YAML format.
2012-05-06 14:47:05 -04:00
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.
2012-05-05 16:31:03 -04:00
Jeroen Hoekx
03541baba7 Define 'inventory_hostname' variable for hosts. 2012-05-02 09:56:58 +02:00
Jeroen Hoekx
029fe1273c Modify /usr/bin/ansible and playbooks to use the new async API. 2012-05-01 18:38:26 -04:00
Jeroen Hoekx
b87710a1df Introduce group_names in template variables.
This is a list of all the groups a host is in.
2012-04-28 18:23:44 +02:00
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
2012-04-26 19:57:07 -04:00
Jeroen Hoekx
cc579a8aa2 Fix tests for facter and the ansible_facts API. 2012-04-24 17:01:48 +02:00
Jeroen Hoekx
2dc9a563ef Allow modules to return facts.
If the module result contains "ansible_facts", that will be added to the setup
cache.
2012-04-23 21:28:12 +02:00
Michael DeHaan
c0c691089d Fix bug in src. Should not code this early :) 2012-04-20 08:09:43 -04:00
Jeroen Hoekx
903e4f6eae Support dicts in inventory vars. 2012-04-19 09:40:17 +02:00
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.
2012-04-18 22:23:33 -04:00
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.
2012-04-18 21:12:48 -04:00
Jeroen Hoekx
6f09b41eb5 Don't test modules that aren't present.
Also account for path difference in sleep in different distributions.
2012-04-17 13:30:30 +02:00
Michael DeHaan
3f26a1c7f6 verbose option is not being used, so remove it. debug variable still exists. 2012-04-16 23:47:41 -04:00
Michael DeHaan
9ce27be878 Remove extra_vars tests 2012-04-16 23:03:04 -04:00
Jeroen Hoekx
8c3206c99f Return a copy of the host variables. 2012-04-16 10:59:34 +02:00
Jeroen Hoekx
961ccdb2f4 List hosts in no group in the ungrouped group. 2012-04-16 10:55:08 +02:00
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.
2012-04-16 10:38:35 +02:00
Jeroen Hoekx
54f4526160 Export SSH port number as host variable. 2012-04-16 09:16:29 +02:00
Jeroen Hoekx
f04041b37d Ignore port numbers in simple inventory format 2012-04-16 09:16:29 +02:00
Jeroen Hoekx
746f1b92ae Reimplement the class method on Runner. 2012-04-16 09:16:29 +02:00
Jeroen Hoekx
195e6d617b Add tests for Inventory class. 2012-04-16 09:16:29 +02:00
Michael DeHaan
08c593bee1 Warn if no hosts matched 2012-04-11 21:05:46 -04:00
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.
2012-04-11 20:27:17 -04:00
Michael DeHaan
e103bdda93 Rename test class to match what it is testing 2012-04-11 20:16:28 -04:00
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.
2012-04-11 20:12:01 -04:00
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)
2012-04-10 21:17:02 -04:00
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.
2012-04-10 20:58:40 -04:00
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.
2012-04-06 12:11:25 -04:00
Michael DeHaan
2a2b5ed73c Polling timing change results in need to change events file for tests. 2012-04-02 20:10:06 -04:00
Michael DeHaan
4792021f47 Fix syntax error in user patch 2012-04-02 20:08:40 -04:00
Michael DeHaan
2511992659 Surface module debug (-D) to /usr/bin/ansible also 2012-03-31 11:45:29 -04:00
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.
2012-03-31 11:18:26 -04:00
Michael DeHaan
3ded27fe35 Treat module args as strings everywhere to avoid unneccessary shlex and requoting 2012-03-30 22:47:58 -04:00
Michael DeHaan
6db87a5018 Minor style fix, update test to match quote fix patch 2012-03-30 21:57:34 -04:00
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)
2012-03-25 19:05:27 -04:00
Michael DeHaan
44d4dede92 Split conditional imports in playbook into subfunction, fix small bug in event reporting on playbook
actions.
2012-03-23 21:03:25 -04:00
Michael DeHaan
6ab615c724 Code cleanup for playbooks, also added 'on_skipped' callback 2012-03-23 20:51:26 -04:00
Michael DeHaan
3814a46bbf Move playbook for user commands into examples dir 2012-03-22 00:33:10 -04:00
Michael DeHaan
6aa10691c1 Merge pull request #93 from sfromm/user-module
User module
2012-03-22 19:24:53 -07:00
Stephen Fromm
999bead9ed Add playbook to test user module 2012-03-22 11:36:11 -07:00
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.
2012-03-21 20:00:48 -04:00
Michael DeHaan
a5f4ca50b8 Ratchet up logging a few notches prior to controlling w/ verbosity settings 2012-03-20 22:29:21 -04:00
Michael DeHaan
b5c62ec068 Enhance logging, way to gate verbosity levels pending. 2012-03-20 21:44:01 -04:00
Michael DeHaan
dfbe591cc0 Add "only_if" capability, which allows task steps to be skipped if they do not match a conditional. 2012-03-20 19:55:04 -04:00
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!
2012-03-19 22:42:31 -04:00
Michael DeHaan
5ed2b894d9 Add an additional way to dereference a variable in a playbook, $foo
(Using varReplace function originally from yum, thanks Seth)
2012-03-19 19:32:38 -04:00
Michael DeHaan
c1fe0dd719 Quote long variables in playbooks when feeding them to the setup command 2012-03-18 19:50:22 -04:00
Michael DeHaan
5371a9e497 Regression tests for playbooks, logging the events they call via callbacks. 2012-03-18 19:25:56 -04:00
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.
2012-03-18 18:50:25 -04:00
Michael DeHaan
45abe3c16b Add unit tests for playbooks, and fix an error caught by one 2012-03-18 18:29:11 -04:00
Michael DeHaan
4bde4926c3 Modules don't have to return JSON, key=value pairs is ok. 2012-03-14 21:16:15 -04:00
Michael DeHaan
40fd778e2c 'shell' is a magic module that executes the command module with shell=True 2012-03-14 20:40:06 -04:00
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.
2012-03-14 20:02:29 -04:00
Michael DeHaan
696b67f935 Fix async to use the new argfiles method (wrapping brain around rock, really must write module development guide) 2012-03-14 19:57:56 -04:00
Michael DeHaan
cb5929dad7 Setup module tests 2012-04-04 11:55:24 -04:00
Michael DeHaan
c71afe35d6 Async tests complete. Fixed bug in async_wrapper 2012-04-04 11:30:14 -04:00
Michael DeHaan
fae3a71899 WIP on async tests 2012-04-04 11:24:22 -04:00
Michael DeHaan
f8eab8ed7e Here are those tests I talked about previously :) 2012-04-04 11:11:31 -04:00