Commit Graph

435 Commits (91a30e59e4606fde6cc9aece0e45b8f57b4bb7a3)

Author SHA1 Message Date
jctanner 587d3c368b Fix synchronize+vagrant dest assertions that were incorrect. (#16291)
Addresses #16284
8 years ago
Dag Wieers d91df20620 Fix unit tests for module_name commit #16087 8 years ago
Brian Coca a529a60478 raw should not use default executable (#16085)
also removed unused cruft in script
8 years ago
James Cammarata fbec2d9692 Expand return code values returned by TQM and strategies
This allows the PlaybookExecutor to receive more information regarding
what happened internal to the TaskQueueManager and strategy, to determine
things like whether or not the play iteration should stop.

Fixes #15523
8 years ago
James Cammarata 61f132a609 Adding unit tests for playbook group/host vars 8 years ago
Toshio Kuratomi 5a3493be5f Port urls.py to python3 and other byte vs text fixes (#16124)
* Port urls.py to python3

Fixes (largely normalizing byte vs text strings) for python3

* Rework what we do with attributes that aren't set already.

* Comments
8 years ago
Matt Clay 7a533406f9 Merge pull request #13145 from Mic92/devel
lxc connection plugin
8 years ago
Saran Ahluwalia fda927a14b added failing test for testing if executable is not empty string 8 years ago
Toshio Kuratomi f86df7c88b Test that task.args are also set properly (#15950) 8 years ago
Adrian Likins 644f0fb190 Merge pull request #15178 from alikins/galaxy_info_output
galaxy info displayed 'galaxy_info' section wrong [fix for #15177]
8 years ago
jctanner c52cea8db3 Add a framework, fixtures and test for common synchronize scenarios. (#15983)
* Add a framework, fixtures and test for common synchronize scenarios.

Addresses #15905
8 years ago
jctanner 373b23cc24 Fix mock loader for osx /etc symlinks (#16074)
Fix role based unit tests for osx via mock.patch
8 years ago
Adrian Likins 1468538414 galaxy info displayed 'galaxy_info' section wrong
The output of 'ansible-galaxy info' was formatting the
'galaxy_info' key with one char per line.

Previously, when building the output string, items in
role_info that had a dict for value, the label for
it's key ('galaxy_info' for ex) was being added to
the text list in addition to being appended. Only
the append is needed.

Also added a unit test in test/units/cli/test_galaxy.py,
but skip it on py3 until galaxy is py3 compatible.

fixes #15177
8 years ago
jctanner 018d3c3118 Add a new vmware inventory script backed by pyvmomi (#15967)
Add a new dynamic vmware inventory script backed by pyvmomi
8 years ago
Jörg Thalheim 88482234e6
lxc connection plugin 8 years ago
Brian Coca 329c62e914 docker was deprecated, test now reflects new name 8 years ago
Toshio Kuratomi b41b6b2ec5 Update test off make_become for ssh pty race mitigation (#15931) 8 years ago
Robin Roth 85477fa215 Don't use 'from ansible.module_utils import foo' style here as it breaks (#15756)
py.test"
8 years ago
Toshio Kuratomi c1cc9f1f23 Merge pull request #15845 from abadger/ziploader-constants
Ship constants to the modules via internal module params rather than a secondary dict
8 years ago
Toshio Kuratomi 186337db28 Ship constants to the modules via internal module params rather than a secondary dict. 8 years ago
Matt Davis bc7405efc9 Merge pull request #15797 from robinro/patch-1
reduce async timeout in unittests
8 years ago
Matt Martz 196453b9b2 Merge pull request #13771 from sivel/binary-modules
First pass at allowing binary modules
8 years ago
Matt Martz 0faddfa168 Move binary module detection into executor/module_common.py 8 years ago
Matt Martz 3466e73c50 Resolve test failures 8 years ago
Toshio Kuratomi 292f0ed0d6 If we can't squash for any reason, then simply do not optimize the items loop.
Also add more squashing testcases

Fixes #15649
8 years ago
Toshio Kuratomi 8a184381af Strip junk after JSON return. (#15822)
Fixes #15601
8 years ago
Toshio Kuratomi c730af5dc2 Remove reload from arg related tests. Changes to how ziploader passes args mean we don't need reload anymore. (#15782) 8 years ago
Robin Roth 254cf9ea68 reduce async timeout
reduce from 3 sec to 0.1 sec; the 3 sec sleep was about half of the total unittest time on my development machine...
8 years ago
Toshio Kuratomi 5c7ad654db Add some more tests for item squashing 8 years ago
nitzmahone 133395db30 add jimi-c's unit test for squashed skip results, tweaked is_skipped() logic to pass 8 years ago
Robin Roth 1d6608e84f Dist version fix for Red Hat and more tests (#15663)
* add tests for centos6, rhel6 and rhel7

* gen_distribution_version_testcase with python2.6

* remove unused imports

* fix redhat/vmware/... parsing

* add centos7 test case
8 years ago
Toshio Kuratomi 487e6562ca Fix ziploader for the cornercase of ansible invoking ansible.
* Make ziploader's ansible and ansible.module_utils libraries into
  namespace packages.
* Move __version__ and __author__ from ansible/__init__ to
  ansible/release.py.  This is because namespace packages only load one
  __init__.py.  If that is not the __init__.py with the author and
  version info then those won't be available.
* In ziplaoder, move the version ito ANSIBLE_CONSTANTS.
* Change PluginLoader to properly construct the path to the plugins even
  when namespace packages are present.
8 years ago
Toshio Kuratomi d652b2edc0 Fix for unittests on python2.6 or less 8 years ago
Toshio Kuratomi 7e1fbe2e03 Some algorithmic unittests for the apt and docker modules 8 years ago
Tegan Snyder bf0da4aa3c add centrify dzdo escalation (#15219)
add dzdo context, and test
8 years ago
Toshio Kuratomi 44e21f7062 Allow AnsibleModules to be instantiated more than once in a module
Fix SELINUX monkeypatch in test_basic
8 years ago
Toshio Kuratomi 03126f7097 Fix cut and paste error of test code 8 years ago
Toshio Kuratomi 0a31c24938 Merge pull request #15419 from nitzmahone/module_debug_arg_override
add _load_params debug overrides for module args/file passed on cmdline
8 years ago
James Cammarata 6eefc11c39 Make the loop variable (item by default) settable per task
Required for include+with* tasks which may include files that also
have tasks containing a with* loop.

Fixes #12736
8 years ago
nitzmahone 5b336832af add _load_params debug overrides for module args/file passed on cmdline
Updated python module wrapper explode method to drop 'args' file next to module.
Both execute() and excommunicate() debug methods now pass the module args via file to enable debuggers that are picky about stdin.
Updated unit tests to use a context manager for masking/restoring default streams and argv.
8 years ago
Robin Roth 49cdc565c5 remove nose.tools use 8 years ago
Robin Roth 4088aa2b4c get rid of assert_in 8 years ago
Robin Roth 692bf51fde move gen_testcase to hacking/tests
* also use json instead of pprint
8 years ago
Robin Roth 37188ea336 cleanup tests
* use nose test generator
* more comments
* move facts import inside the skipped function, fix python3 warning
8 years ago
Robin Roth 2b104fe6ad fix tests for SLES and CoreOS
* include #15230
8 years ago
Robin Roth 3c883d8a6d add testcases from refactor PR 8 years ago
Toshio Kuratomi 208ad36ce4 Merge pull request #15344 from abadger/ziploader
Ziploader "recursive imports" and caching
8 years ago
Jonathon Klobucar 7bee994e1c Fix for serial when percent amount is less than one host (#15396)
Ansible when there was a percentage that was calculated to be less than
1.0 would run all hosts as the value for a rolling update.

The error is due to the fact that Python will round a
float that is under 1.0 to 0, which will trigger the case of
0 hosts. The 0 host case tells ansible to run all hosts.

The fix will see if the percentage calculation after int
conversion is 0 and will else to 1 host.
8 years ago
Toshio Kuratomi 75546678d9 Fix unittests 8 years ago
Toshio Kuratomi dcc5dfdf81 Controller-side module caching.
This makes our recursive, ast.parse performance measures as fast as
pre-ziploader baseline.

Since this unittest isn't testing that the returned module data is
correct we don't need to worry about os.rename not having any module
data.  Should devise a separate test for the module and caching code
8 years ago
Strahinja Kustudić eed6cf5dad Adds 'ansible_check_mode' boolean magic variable
* Makes it possible to pass any options variable to VariableManager
  by changing `load_options_vars(options)` in `lib/ansible/utils/vars.py`
8 years ago
Toshio Kuratomi 4b0aa1214c Ziploader
* Ziploader proof of concept (jimi-c)

* Cleanups to proof of concept ziploader branch:

* python3 compatible base64 encoding
* zipfile compression (still need to enable toggling this off for
  systems without zlib support in python)
* Allow non-wildcard imports (still need to make this recusrsive so that
  we can have module_utils code that imports other module_utils code.)
* Better tracebacks: module filename is kept and module_utils directory
  is kept so that tracebacks show the real filenames that the errors
  appear in.

* Make sure we import modules that are used into the module_utils files that they are used in.

* Set ansible version in a more pythonic way for ziploader than we were doing in module replacer

* Make it possible to set the module compression as an inventory var

This may be necessary on systems where python has been compiled without
zlib compression.

* Refactoring of module_common code:

* module replacer only replaces values that make sense for that type of
  file (example: don't attempt to replace python imports if we're in
  a powershell module).
* Implement configurable shebang support for ziploader wrapper
* Implement client-side constants (for SELINUX_SPECIAL_FS and SYSLOG)
  via environment variable.
* Remove strip_comments param as we're never going to use it (ruins line
  numbering)

* Don't repeat ourselves about detecting REPLACER

* Add an easy way to debug

* Port test-module to the ziploader-aware modify_module()

* strip comments and blank lines from the wrapper so we send less over the wire.

* Comments cleanup

* Remember to output write the module line itself in powershell modules

* for line in lines strips the newlines so we have to add them back in
8 years ago
jpic 4985411816 Test other use-cases for PluginLoader's config 8 years ago
jpic da175d0a57 Bugfix: proper plugin configuration was reset
Before this patch, if config was ['/some/path'] then it would enter the
else block and config would be set to [].

The regression this patch fixes was introduced by 700db154.
8 years ago
James Cammarata 5fdac707fd New unit tests for #13630 fix 9 years ago
Toshio Kuratomi 52e9209491 Don't create world-readable module and tempfiles without explicit user permission 9 years ago
Toshio Kuratomi d3583108ec Fix log_invocation test on python2 with hash randomization 9 years ago
Matt Martz ad30bad14f Skip test_module_utils_basic__log_invocation until we can figure out the cause of the failure 9 years ago
Toshio Kuratomi ed9e164b80 Fix ansible_sudo_pass inventory variable so that it overrides setting of sudo password from the command line 9 years ago
Brian Coca db61e9be0c add ansible_executable inventory var
also handle the overrides appropriately
also new executable to set shell type
9 years ago
James Cammarata 8eadc1d8eb Adding more unit tests for AnsibleModule things in basic.py 9 years ago
James Cammarata 81788e627d Adding unit tests for TaskResult 9 years ago
Toshio Kuratomi 2b8a0cdddc Fix ssh connection unittests for python3.4 9 years ago
James Cammarata 9d61a6cba8 Fixing PlayIterator bugs
* Unit tests exposed a problem where nested blocks did not correctly
  hit rescue/always portions of parent blocks
* Cleaned up logic in PlayIterator
* Unfortunately fixing the above exposed a potential problem in the
  block integration tests, where a failure in an "always" section may
  always lead to a failed state and the termination of execution
  beyond that point, so certain parts of the block integration test
  were disabled.
9 years ago
James Cammarata f0d3284ead Adding more unit tests for ssh connection plugin 9 years ago
James Cammarata 2f472fd4e9 Adding start of ssh connection unit tests 9 years ago
James Cammarata 299d93f6e9 Updating unit tests for PlayIterator
This knowingly introduces a broken test, planning to fix that later.
9 years ago
James Cammarata b853e932d1 Adding unit tests for symbolic mode conversion stuff in basic.py 9 years ago
James Cammarata 18240d350c Adding a skip for the literal_eval test on py3 9 years ago
James Cammarata 0ea3a9d08d Removing tabs from test_basic.py 9 years ago
James Cammarata 1de9357c2f Attempt at cleaning up issues introduced by new basic.py unit tests 9 years ago
James Cammarata e011f52557 Expanding unit tests for module_utils/basic.py 9 years ago
James Cammarata c56e3aabfb Clean up jsonify unit test with format to remove json lib differences 9 years ago
James Cammarata 7c049c3200 Fixing up jsonify and adding unit tests 9 years ago
James Cammarata a9d25f455c More unit tests for ActionBase 9 years ago
James Cammarata e588437067 Adding some unicode params to the ActionBase module formatting test 9 years ago
Toshio Kuratomi 7cb29cdbec Workaround py2.6's StringIO 9 years ago
Toshio Kuratomi b70bf3b056 Use io.StringIO and io.BytesIO instead of StringIO.StringIO for compat with py3 9 years ago
Toshio Kuratomi c29f51804b Fix mixing of bytes and str in module replacer (caused traceback on python3) 9 years ago
James Cammarata 01d835700b Cleaning up some py version problems with ActionBase unit tests 9 years ago
James Cammarata 3518a05db6 Starting to expand unit tests for ActionBase plugin class 9 years ago
James Cammarata e02b98274b issue callbacks per item and retry fails
- now workers passes queue to task_executor so it can send back events per item and on retry attempt
- updated result class to pass along events to strategy
- base strategy updated to forward new events to callback
- callbacks now remove 'items' on final result but process them directly when invoked per item
- new callback method to deal with retry attempt messages (also now obeys nolog)
- updated tests to match new signature of task_executor

fixes #14558
fixes #14072
9 years ago
Brian Coca 6dc910c13a shell + become fixes
1 less level of shell + quoting
simplified become commands, less quote and shell
9 years ago
Toshio Kuratomi 0e410bbc8a Squashing was occuring even though pkgs didn't have a template that would be affected by squash
This broke other uses of looping (looping for delegate_to in the
reported bug)

Fixes #13980
9 years ago
Brian Coca fad6eb1844 fixed unit test to match new output of become/su 9 years ago
Toshio Kuratomi d97d28ecb0 Merge pull request #14025 from ansible/run_command-env-rework
rework run_command's env setting to not change os.environ for the res…
9 years ago
Toshio Kuratomi a68d90a71a rework run_command's env setting to not change os.environ for the rest of the module.
New param to run_command to modify the environment for just this invocation.
Documentation and comment adjustments.
9 years ago
Brian Coca c09c01a1f5 go back to defaulting wrapping commands in shell
this was taken out in an effort to default to the user's shell but creates issues as this is not known ahead of time
and its painful to set executable and shell_type for all servers, it should only be needed for those that restrict the user
to specific shells and when /bin/sh is not available. raw and command may still bypass this by explicitly passing None.
fixes #13882

still conditional
9 years ago
James Cammarata b1223746cd Relocate use of ERROR to display class, to avoid doubling up 9 years ago
Brian Coca 27f4730c29 correctly deals with non serializable type
combine_vars shoudl really be data types, but some just get in
in test, add dict to mock and avoid combine_vars using object
9 years ago
Toshio Kuratomi 1ed3a018eb Revert "Fix make tests-py3 on devel. Fix for https://github.com/ansible/ansible/issues/13638."
This reverts commit e70061334a.

Going to do this in the connection plugins
9 years ago
James Cammarata 2d11cfab92 Squashed commit of the following:
commit 24efa310b58c431b4d888a6315d1285da918f670
Author: James Cammarata <jimi@sngx.net>
Date:   Tue Dec 29 11:23:52 2015 -0500

    Adding an additional test for copy exclusion

    Adds a negative test for the situation when an exclusion doesn't
    exist in the target to be copied.

commit 643ba054877cf042177d65e6e2958178bdd2fe88
Merge: e6ee59f 66a8f7e
Author: James Cammarata <jimi@sngx.net>
Date:   Tue Dec 29 10:59:18 2015 -0500

    Merge branch 'speedup' of https://github.com/chrismeyersfsu/ansible into chrismeyersfsu-speedup

commit 66a8f7e873
Author: Chris Meyers <chris.meyers.fsu@gmail.com>
Date:   Mon Dec 28 09:47:00 2015 -0500

    better api and tests added

    * _copy_results = deepcopy for better performance
    * _copy_results_exclude to deepcopy but exclude certain fields. Pop
    fields that do not need to be deep copied. Re-assign popped fields
    after deep copy so we don't modify the original, to be copied, object.
    * _copy_results_exclude unit tests

commit 93490960ff
Author: Chris Meyers <chris.meyers.fsu@gmail.com>
Date:   Fri Dec 25 23:17:26 2015 -0600

    remove uneeded deepcopy fields
9 years ago
Brian Coca d89d7951e6 fixed tests to follow new invocation structure
also added maxdiff setting to see issues clearly when they happen
9 years ago
Yannig Perré b22d998d1d Fix make tests-py3 on devel. Fix for https://github.com/ansible/ansible/issues/13638. 9 years ago
Brian Coca 75e94e0cba allow for non standard hostnames
* Changed parse_addresses to throw exceptions instead of passing None
* Switched callers to trap and pass through the original values.
* Added very verbose notice
* Look at deprecating this and possibly validate at plugin instead
fixes #13608
9 years ago
Brian Coca e957335b0d Merge pull request #13607 from mattclay/test-cache-typo
Fixed import typo for memcache module in tests.
9 years ago
Toshio Kuratomi e2d9f4e2f2 Fix unittests for return of invocation from fail_json and exit_json 9 years ago
Matt Clay d2ad17e88f Fixed import typo for memcache module in tests.
The typo caused the test for the memcached cache plugin to be skipped
even when the necessary memcache python module was installed.
9 years ago
James Cammarata d7f2f606e1 Add has_hostkey to mock objects to fix broken unit tests 9 years ago
James Cammarata 6109f70397 Attempt at fixing strategy unit test failures on py2.6 and py3 9 years ago