Commit Graph

368 Commits (71a707fba54617f0c9276f42292307711cf44f15)

Author SHA1 Message Date
Robin Roth 85477fa215 Don't use 'from ansible.module_utils import foo' style here as it breaks (#15756)
py.test"
9 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
9 years ago
Toshio Kuratomi 186337db28 Ship constants to the modules via internal module params rather than a secondary dict. 9 years ago
Matt Davis bc7405efc9 Merge pull request #15797 from robinro/patch-1
reduce async timeout in unittests
9 years ago
Matt Martz 196453b9b2 Merge pull request #13771 from sivel/binary-modules
First pass at allowing binary modules
9 years ago
Matt Martz 0faddfa168 Move binary module detection into executor/module_common.py 9 years ago
Matt Martz 3466e73c50 Resolve test failures 9 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
9 years ago
Toshio Kuratomi 8a184381af Strip junk after JSON return. (#15822)
Fixes #15601
9 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) 9 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...
9 years ago
Toshio Kuratomi 5c7ad654db Add some more tests for item squashing 9 years ago
nitzmahone 133395db30 add jimi-c's unit test for squashed skip results, tweaked is_skipped() logic to pass 9 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
9 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.
9 years ago
Toshio Kuratomi d652b2edc0 Fix for unittests on python2.6 or less 9 years ago
Toshio Kuratomi 7e1fbe2e03 Some algorithmic unittests for the apt and docker modules 9 years ago
Tegan Snyder bf0da4aa3c add centrify dzdo escalation (#15219)
add dzdo context, and test
9 years ago
Toshio Kuratomi 44e21f7062 Allow AnsibleModules to be instantiated more than once in a module
Fix SELINUX monkeypatch in test_basic
9 years ago
Toshio Kuratomi 03126f7097 Fix cut and paste error of test code 9 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
9 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
9 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.
9 years ago
Robin Roth 49cdc565c5 remove nose.tools use 9 years ago
Robin Roth 4088aa2b4c get rid of assert_in 9 years ago
Robin Roth 692bf51fde move gen_testcase to hacking/tests
* also use json instead of pprint
9 years ago
Robin Roth 37188ea336 cleanup tests
* use nose test generator
* more comments
* move facts import inside the skipped function, fix python3 warning
9 years ago
Robin Roth 2b104fe6ad fix tests for SLES and CoreOS
* include #15230
9 years ago
Robin Roth 3c883d8a6d add testcases from refactor PR 9 years ago
Toshio Kuratomi 208ad36ce4 Merge pull request #15344 from abadger/ziploader
Ziploader "recursive imports" and caching
9 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.
9 years ago
Toshio Kuratomi 75546678d9 Fix unittests 9 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
9 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`
9 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
9 years ago
jpic 4985411816 Test other use-cases for PluginLoader's config 9 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.
9 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