Commit Graph

502 Commits (b7780ca530617d7f5fbb3db398332375cce98983)

Author SHA1 Message Date
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
Michael Scherer a7ac98262d Make module_utils.known_hosts.get_fqdn work on ipv6 9 years ago
Toshio Kuratomi 457f86f61a Minor: Correct type pyhton => python 9 years ago
James Cammarata 35015aaa4a Merge pull request #13529 from mscherer/add_tests_known_hosts
Add tests for ansible.module_utils.known_hosts
9 years ago
James Cammarata 279c5a3596 Cleanup strategy tests broken by new forking strategy 9 years ago
Michael Scherer 3c4d2fc6f2 Add tests for ansible.module_utils.known_hosts 9 years ago
James Cammarata 750adbaa27 Changing up how host (in)equality is checked
Fixes #13397
9 years ago
Toshio Kuratomi cfeef81303 For now, skip tests of module_utils/basic functions that are failing on
py3 (these are only run on the target hosts, not on the controller).
9 years ago
Toshio Kuratomi e00012994e Also some unicode tests for return_values() 9 years ago
Toshio Kuratomi 5fdfe6a0f2 Add some test data that has unicode values 9 years ago
James Cammarata dc0fae1af7 Also make sure remote_user is defaulted correctly for delegated hosts
Fixes #13323
9 years ago
James Cammarata 91500f8f5f Fix include param precedence in variable manager 9 years ago
Brano Zarnovican 90f99f29ae unittest cover for 'run_command'
All os.*, subprocess.* is mocked to avoid side-effects.
Tests are skipped in Py3, since 'run_command' is not Py3-ready, yet.
9 years ago
Toshio Kuratomi 318bfbb207 Migrate cli and dependencies to use global display 9 years ago
Toshio Kuratomi aa034f4fcf Add unit tests for issue #12976 9 years ago
Toshio Kuratomi 37052a983a Fix unittest dailure with the new squash items code 9 years ago
Brian Coca 174de1161b fixed removing -n in password sudo tests 9 years ago
Brian Coca b2fc5142eb moved sudo -S and -n into configurable flags as they might be absent in much older systems
if password is supplied exsiting -n would get remove from flags
9 years ago
Toshio Kuratomi 4203850d1a Break apart a looped dependency to show a warning when parsing playbooks
Display a warning when a dict key is overwritten by pyyaml
Fixes #12888
9 years ago
Brian Coca f78c82b9ee don't set user to current user
also remove condition to bypass setting user if user matches current user
this enables forcing user when set to the same user as current user and ignoring .ssh/config
while keeping .ssh/config with current user if nothing is specified.
9 years ago
Toshio Kuratomi ce2b18174e Merge pull request #12878 from ansible/invocation-fix
Invocation fix
9 years ago
Toshio Kuratomi 2e87c1f74e Two fixes to action plugins
* Fix the task_vars parameter to not default to a mutable type (dict)
* Implement invocation in the base class's run() method have each action
  module call the run() method's implemention in the base class.
* Return values from the action plugins' run() method takes the return
  value from the base class run() method into account so that invocation
  makes its way to the output.

Fixes #12869
9 years ago
James Cammarata 86de1429e5 Cleaning up FIXMEs 9 years ago
Toshio Kuratomi 5a0e63af1e Workaround seeming bug in python-2.6's sys.exit() 9 years ago
Toshio Kuratomi 6e5055e786 Update the use of no_log values to cover everything that heuristic_log_sanitize does.
Fixes #12792
9 years ago
Toshio Kuratomi c2d188baff Hide values in json returns which were given in parameters marked no_log. 9 years ago
Brian Coca 6d87bd405d Merge pull request #12765 from bcoca/lookup_inventory_hostname
implemented inventory_hostname lookup in v2
9 years ago
Marius Gedminas ec3ada1cda Fix test on Python 3: vault code expects bytes
(All tests now succeed on Python 3.5)
9 years ago
Marius Gedminas 5c70f932bd Fix test on Python 3: vault code expects bytes
(Third failing test out of four.)
9 years ago
Marius Gedminas a1d95536f9 Fix test on Python 3: vault code expects bytes
(Different test than the last commit.)
9 years ago
Marius Gedminas f58f0c62e1 Fix test on Python 3: vault code expects bytes 9 years ago
Brian Coca 9b088a1e40 implemented inventory_hostname lookup in v2 9 years ago
Marius Gedminas 225fe85530 Skip test_module_utils_basic_ansible_module_creation on Python 3
This reverts commit 073f10a52a and instead
disables the failing test.

We're focusing on Python 3 support on the controller first; modules will
come later.
9 years ago
James Cammarata e6d3c6745f Revert to using local file/dir tests in inventory instead of loader's
Fixes #12719
9 years ago
Toshio Kuratomi 15d7f53846 AnsibleModules.log() fix for python3
Also add unittests for AnsibleModules.log()

Fixes #12586
9 years ago
James Cammarata 0e1a5919c8 Adding unit tests for PlaybookExecutor _get_serialized_batches 9 years ago
Brian Coca abf2e13955 Revert "Track local_action internally to prevent it from being overridden"
This reverts commit 49ca0eb797.
9 years ago
James Cammarata de792ba3c2 Improve handling of unicode errors
Fixes #12669
9 years ago
Marius Gedminas 0371b14567 Fix test: selinux gets passed byte strings
(I don't have a system with selinux to test if the module still wants
byte strings even on Python 3.)
9 years ago
Marius Gedminas 500e7a1263 Fix test: _to_filesystem_str produces byte strings 9 years ago
Marius Gedminas f7571cb37f Python 3: there's no __builtin__ module
This caused an ImportError in a test module and showed up as one test
failure.  Now the test module can get imported and many more tests fail
(on Python 3).  Such is life.  ;-)
9 years ago
Brian Coca ddafed4403 Merge pull request #12528 from bcoca/task_logging
task logging revamp
9 years ago
James Cammarata 6339bf8a82 Merge branch 'tests' of https://github.com/amenonsen/ansible into amenonsen-tests 9 years ago
James Cammarata dfa33d0f23 Tweak variable manager use in role includes to avoid test failures 9 years ago
Abhijit Menon-Sen d100db837b Add basic tests for expand_hostname_range 9 years ago
Abhijit Menon-Sen 838e71edb7 Add more exhaustive tests for various IPv6 address notations 9 years ago
Brian Coca 37a918438b task logging revamp
* allow global no_log setting, no need to set at play or task level, but can be overriden by them
 * allow turning off syslog only on task execution from target host (manage_syslog), overlaps with no_log functionality
 * created log function for task modules to use, now we can remove all syslog references, will use systemd journal if present
 * added debug flag to modules, so they can make it call new log function conditionally
 * added debug logging in module's run_command
9 years ago
James Cammarata ccddda1ebc Merge pull request #12502 from mgedmin/py3k
Python 3: make test_variable_manager_precedence pass
9 years ago
James Cammarata 31d5f88a1d Use the task loop to calculate multiple delegated hosts
Due to the way we're now calculating delegate_to, if that value is based
on a loop variable ('item') we need to calculate all of the possible
delegated_to variables for that loop.

Fixes #12499
9 years ago
Toshio Kuratomi a1428d6bed Remove tmp as a parameter to the connection plugins
There doesn't appear to be anything that actually uses tmp_path in the
connection plugins so we don't need to pass that in to exec_command.
That change also means that we don't need to pass tmp_path around in
many places in the action plugins any more.  there may be more cleanup
that can be done there as well (the action plugin's public run() method
takes tmp as a keyword arg but that may not be necessary).

As a sideeffect of this patch, some potential problems with chmod and
the patch, assemble, copy, and template modules has been fixed (those
modules called _remote_chmod() with the wrong order for their
parameters.  Removing the tmp parameter fixed them.)
9 years ago
Toshio Kuratomi 03127dcfae remove the stdin return value from connection plugin exec_command() methods
The value was useless -- unused by the callers and always hardcoded to
the empty string.
9 years ago
Marius Gedminas 0624797375 Bugfix: if you define a custom __eq__, you must define a __hash__ too
Also, on Python 3 the stock object.__hash__ raises an error ("unhashable
type"), and we have code that uses Host instances as dict keys.
9 years ago
Marius Gedminas a2bc6b4b26 Bugfix: if you define __eq__, you should define __ne__ too 9 years ago
Marius Gedminas 5d29a2eabd Python 3: shlex.split() wants unicode
On Python 2, shlex.split() raises if you pass it a unicode object with
non-ASCII characters in it.  The Ansible codebase copes by explicitly
converting the string using to_bytes() before passing it to
shlex.split().

On Python 3, shlex.split() raises ('bytes' object has no attribute 'read')
if you pass a bytes object.  Oops.

This commit introduces a new wrapper function, shlex_split, that
transparently performs the to_bytes/to_unicode conversions only on
Python 2.

Currently I've only converted one call site (the one that was causing a
unit test to fail on Python 3).  If this approach is deemed suitable,
I'll convert them all.
9 years ago
Abhijit Menon-Sen 2fcdb37e7b Support «hosts: groupname[1:]» notation (~= 'the rest of the group') 9 years ago
Abhijit Menon-Sen 21142f5723 Add some tests for split/apply_subscript 9 years ago
Abhijit Menon-Sen 2d420a9bb7 Allow hexadecimal ranges in IPv6 addresses, not only 0-9 9 years ago
James Cammarata 951128d7a6 Merge branch 'hostpatterns' of https://github.com/amenonsen/ansible into amenonsen-hostpatterns 9 years ago
Victor Salgado 01ae60d524 Add more tests for _split_pattern for when the input is a list 9 years ago
Abhijit Menon-Sen abd006657b Add test/units/inventory with a few _split_pattern tests
There were no inventory-specific unit tests earlier, so we add a new
directory for them with some initial low-level tests of _split_pattern
with various valid and deprecated pattern strings.
9 years ago
Florian Apolloner d9f873495e Ported over #7158 to support SELinux context switches. 9 years ago
Florian Apolloner 8548690ca3 Added a test to ensure that sudo is only used if remote and become user difer. 9 years ago
Brian Coca b6d6c2e4db corrected all missing paths changes 9 years ago
James Cammarata 36b5858f51 Fix unit tests for change related to local_action 9 years ago
James Cammarata 49ca0eb797 Track local_action internally to prevent it from being overridden
Fixes #12053
9 years ago
Abhijit Menon-Sen 7479ab47e0 Be stricter about parsing hostname labels
Labels must start with an alphanumeric character, may contain
alphanumeric characters or hyphens, but must not end with a hyphen.
We enforce those rules, but allow underscores wherever hyphens are
accepted, and allow alphanumeric ranges anywhere.

We relax the definition of "alphanumeric" to include Unicode characters
even though such inventory hostnames cannot be used in practice unless
an ansible_ssh_host is set for each of them.

We still don't enforce length restrictions—the fact that we have to
accept ranges makes it more complex, and it doesn't seem especially
worthwhile.
9 years ago
Abhijit Menon-Sen 065bb52109 Be systematic about parsing and validating hostnames and addresses
This adds a parse_address(pattern) utility function that returns
(host,port), and uses it wherever where we accept IPv4 and IPv6
addresses and hostnames (or host patterns): the inventory parser
the the add_host action plugin.

It also introduces a more extensive set of unit tests that supersedes
the old add_host unit tests (which didn't actually test add_host, but
only the parsing function).
9 years ago
Marius Gedminas f91b28ef23 Fix safe_eval() of set literals
There was code to support set literals (on Python 2.7 and newer), but it
was buggy: SAFE_NODES.union() doesn't modify SAFE_NODES in place,
instead it returns a new set object that is then silently discarded.

I added a unit test and fixed the code.  I also changed the version
check to use sys.version_tuple instead of a string comparison, for
consistency with the subsequent Python 3.4 version check that I added in
the previous commit.
9 years ago
James Cammarata 444987cde6 Fix unit test for plugins after basedir/push_basedir removal 9 years ago
Toshio Kuratomi e2c49b4ef4 Fix problem with "=" in the initial file path. 9 years ago
Toshio Kuratomi 3a50393cf7 Merge pull request #12269 from mgedmin/py3k
Python 3: fix TypeError: unorderable types in test
9 years ago
Toshio Kuratomi c1039de70c Compatibility with six-1.3.0 9 years ago
James Cammarata ac6f61ec7f Properly handle group/host_var files with dots in them
Fixes #12245
9 years ago
Marius Gedminas c22f4ee697 Add a comment explaining why async = 1 in the test 9 years ago
Marius Gedminas 1a1c9203e2 Python 3: fix TypeError: unorderable types in test
The full error was

======================================================================
ERROR: test_task_executor_execute (units.executor.test_task_executor.TestTaskExecutor)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mg/src/ansible/test/units/executor/test_task_executor.py", line 252, in test_task_executor_execute
    mock_action.run.return_value = dict(ansible_facts=dict())
  File "/home/mg/src/ansible/lib/ansible/executor/task_executor.py", line 317, in _execute
    if self._task.async > 0:
TypeError: unorderable types: MagicMock() > int()

----------------------------------------------------------------------

Experiments show that Python 2 MagicMock() > 0 is true, so I'm setting
the async property on mock_task to 1.  (If I set it to 0, the test fails
anyway.)
9 years ago
James Cammarata ff9f5d7dc8 Starting to add additional unit tests for VariableManager
Required some rewiring in inventory code to make sure we're using
the DataLoader class for some data file operations, which makes mocking
them much easier.

Also identified two corner cases not currently handled by the code, related
to inventory variable sources and which one "wins". Also noticed we weren't
properly merging variables from multiple group/host_var file locations
(inventory directory vs. playbook directory locations) so fixed as well.
9 years ago
Brian Coca c17fbf2f12 simplify become testing and handling, we had drifted and were doulbe checking prompt, become and become_pass
fixed tests to conform to new signature and now tests both with and w/o password
now we are more explicit about self.prompt
9 years ago
Toshio Kuratomi e218bf8da9 Do not escape backslashes when processing a template file.
Fixes #12198
Fixes #12241
9 years ago
James Cammarata b2cb3153f1 Fix unit tests for PlayIterator changes regarding fact gathering 9 years ago
Marius Gedminas a32bf1ec18 Simplify FactCache.copy()
Also fix the bug (missing from six import iteritems) I introduced in
823677b490.
9 years ago
Marius Gedminas 823677b490 Replace .iteritems() with six.iteritems()
Replace .iteritems() with six.iteritems() everywhere except in
module_utils (because there's no 'six' on the remote host).  And except
in lib/ansible/galaxy/data/metadata_template.j2, because I'm not sure
six is available there.
9 years ago
Toshio Kuratomi 1b64702b9a Fix templar unittests for change in preserve_trailing_newline parameter's default value 9 years ago
James Cammarata 45aac6a739 Adding unit tests for safe_eval 9 years ago
James Cammarata 843138e7d9 Merge pull request #12202 from mgedmin/py3k
Use rich comparisons for Attribute and FieldAttribute
9 years ago
Toshio Kuratomi 9ecfc30f9a * Mark all strings as unicode -- shouldn't matter for this dataset but
ansible is passing unicode arond internally so we should test the same
  data.
* Add a zero length test for _count_newlines and fix the zero newlines
  test to have no newlines.
9 years ago
Toshio Kuratomi 417bf1c805 Unittest the _count_trailing_newlines function 9 years ago
Brian Coca a7231c2203 actually implemented flags correctly for all priv escalation methods 9 years ago
Brian Coca 14f061d5ea fixed become tests 9 years ago
Marius Gedminas 33a374edde Use rich comparisons for Attribute and FieldAttribute
Because __cmp__ is not supported on Python 3.
9 years ago
Toshio Kuratomi aeff960d02 Cleanup combine_vars
* Dedupe combine_vars() code (removed from VariableManager)
* Fix merge_hash algorithm to preserve the type
* unittest combine_vars and merge_hash
9 years ago
Toshio Kuratomi 7f5080f64a Fix backslash escaping inside of jinja2 expressions
Fixes #11891
9 years ago
James Cammarata ccaf47bd97 Fix unit tests broken by 057712c1 9 years ago
Marius Gedminas 709dbbc7db Use 0oNNN octal syntax in test/ 9 years ago
Abhijit Menon-Sen 4f3a98eff6 Update Vault tests to make sure AES decryption works
Note that this test was broken in devel because it was really just
duplicating the AES256 test because setting v.cipher_name to 'AES'
no longer selected AES after it was de-write-whitelisted.

Now that we've removed the VaultAES encryption code, we embed static
output from an earlier version and test that we can decrypt it.
9 years ago
Abhijit Menon-Sen b84053019a Make the filename the first argument to rekey_file 9 years ago
Abhijit Menon-Sen c4b2540ecc Update tests for VaultEditor API changes 9 years ago
Toshio Kuratomi 56ae3a032f Merge pull request #12075 from ansible/fix-vault-unicode
Unicode and other fixes for vault
9 years ago
Toshio Kuratomi a3fd4817ef Unicode and other fixes for vault 9 years ago
Brian Coca 846f0b0510 changed no_log expected type to new value 9 years ago
Ryan Petrello 1886307845 Fix a parsing bug that prevents IPv6 addresses from being used with `add_host`
Closes #8682
9 years ago
Brian Coca 69f380da3a changed mod_args test to match connection 9 years ago
Brian Coca ab355218a0 fixed test to new parser options 9 years ago
Brian Coca ee21ebaffc Merge pull request #11975 from mutemule/become_doas
Add become support for OpenBSD doas
9 years ago
Damian Gerow 1c5611100e Add become support for OpenBSD doas 9 years ago
Brian Coca 43bf9c86d8 fixed typo 9 years ago
Brian Coca d38bb4152d fixed test to match new exception class used 9 years ago
Brian Coca 2eb5333b50 fixed test to match new become output 9 years ago
Toshio Kuratomi e8452c864e Restore the relative path handling portion of #11865 9 years ago
Brian Coca b9433650d1 Revert "Path of group_vars and host_vars were getting the basedir added twice."
in view of simpler solution incomming from james
This reverts commit bae7a02be5.
9 years ago
Toshio Kuratomi bae7a02be5 Path of group_vars and host_vars were getting the basedir added twice.
Fix inventory so this won't happen and fix DataLoader so that it will
test relative paths relative to self._basedir

Fixes #11789
9 years ago
James Cammarata 9891bcbcae Fix unit tests broken by previous commit 9 years ago
James Cammarata 6b244ed61e update unit tests for role templating changes 9 years ago
James Cammarata 42cfacf83b Switch up the task/host overrides for PlayContext to use the compiled vars dict
Fixes #11436
9 years ago
James Cammarata 8146a193eb Fix strategy base unit tests after 88e1ef8 9 years ago
James Cammarata 993ce592b1 Update unit tests for flush_handlers fix 9 years ago
James Cammarata 66a8864ae9 Fix environment setting and inheritence
Fixes #11401
9 years ago
James Cammarata e64989beb4 Moving ConnectionInformation -> PlayContext
Also making PlayContext a child class of the Playbook Base class,
which gives it access to all of the FieldAttribute code to ensure
field values are correctly typed after post_validation

Fixes #11381
9 years ago
James Cammarata fadd8f23f1 Fix broken strategy unit test from earlier change 9 years ago
Pierre-Louis Bonicoli 8c392a94b7 Play.get_name: remove prefix, return name only 9 years ago
James Cammarata 3d77723e3d Cleaning up some stuff related to the connection info/become/executable change 9 years ago
Brian Coca 323362e23a added stdout to test result 9 years ago
James Cammarata 3b913943b2 Updating base strategy unit test regarding bad file loads based on earlier change 9 years ago
James Cammarata 1163e38d39 Fix unit tests for new magic variable addition 'ansible_version' 9 years ago
James Cammarata bbe8f48a46 Update role unit tests for changes made to require a play during loading 9 years ago
marconius 79394f5c8f Added tests for `taggable` module 9 years ago
James Cammarata bfbb88b4a9 Fix strategy plugin unit tests related to earlier changes 9 years ago
Toshio Kuratomi f44f9569e1 Test unquote works as expected and fix two bugs:
* escaped end quote
* a single quote character
9 years ago
Brian Coca aa6486778f fixed become test to match new expected output 9 years ago
James Cammarata 53cd96befe Updating unit tests to account for new magic variable 'vars' 9 years ago
Matt Martz 2cd3a1be00 assertRaises should be given an exception type. Fixes 11441 9 years ago
James Cammarata 4fbd4ae18b Update VariableManager test for additional magic variable playbook_dir 9 years ago
Brian Coca 5bac17de51 fixed pfexec test 9 years ago
Brian Coca 091caf6279 added missing error class import 9 years ago
Brian Coca e9cf67004b updated fail_on_undefined test to new function signatures 9 years ago
Matt Martz 230be812ba Don't test for play.become_pass any longer 9 years ago
Matt Martz 49d19e82ab Get tests passing
The largest failure in the tests was due to selinux not being installed.
The tests don't require it to be installed, so mock the import.
9 years ago
James Cammarata 9ac624d2c9 Fix mock DictDataLoader _get_file_contents to match real code 9 years ago
James Cammarata fe41f109a9 Merge branch 'v2_final' into devel_switch_v2 9 years ago
James Cammarata 4bc7703db3 Fixing some small bugs related to integration tests (v2) 9 years ago
James Cammarata 0828028c71 Fixing unit test for included file changes 9 years ago
James Cammarata 2bad888f28 Merge branch 'v2_final' into devel_switch_v2
Conflicts:
	lib/ansible/inventory/__init__.py
	lib/ansible/modules/core
	lib/ansible/utils/__init__.py
	lib/ansible/utils/module_docs.py
9 years ago
James Cammarata e59d4f3b51 More module_utils/basic.py unit tests for v2 9 years ago
James Cammarata 339a02c384 Started reworking module_utils/basic unit tests (v2) 9 years ago
James Cammarata d4a31e8d26 Adding unit tests for TaskExecutor (v2) 9 years ago
Serge van Ginderachter b92d70c5b6 tests files extensions in group/host_vars dir
only files with extensions as per
C.YAML_FILENAME_EXTENSIONS should be parsed
9 years ago
James Cammarata 838ff32001 Fix unit test for conn_info (v2)
The default user expected in the connection information is the current
user, not root
9 years ago
James Cammarata ecd5eb902d Adding unit tests for ConnectionInformation (v2) 9 years ago
James Cammarata 9921a1d2be Unit tests for base strategy class (v2) 9 years ago
James Cammarata 21fa385ce7 Reorganizing plugin unit tests and adding start of strategy tests (v2) 9 years ago
James Cammarata a960fcd569 Adding module_utils tests from v1 to v2 9 years ago
James Cammarata 398b1d3e60 Cleaning up template test syntax a bit 9 years ago
James Cammarata 9aa8676bdd More template unit tests for v2 9 years ago
James Cammarata 23cd3294d0 Starting to add v2 tests for template 9 years ago
James Cammarata 48d62fd934 Cleaning up VariableManager tests (v2) 9 years ago
James Cammarata a0509cda1e Fix test_role unit tests to use unique role names to avoid role caching errors 9 years ago
James Cammarata 1ca8cb8553 Fixing up v2 unit tests 9 years ago
Toshio Kuratomi f9f8af06fc Change asserts to assertIsInstance for better error messages 9 years ago
Matt Martz a0fc8bb0bd Testing additions and fixes
* Fix import pathing for units.mock
* Add some additional requirements
* Use compileall to test compatiblity with different python versions
9 years ago
James Cammarata ce3ef7f4c1 Making the switch to v2 9 years ago
Jesse Rusak 652cd6cd5e Fix --force-handlers, and allow it in plays and ansible.cfg
The --force-handlers command line argument was not correctly running
handlers on hosts which had tasks that later failed. This corrects that,
and also allows you to specify force_handlers in ansible.cfg or in a
play.
9 years ago
James Laska 60acdee0dc Enable assert_raises_regexp on py26 9 years ago
Toshio Kuratomi f05cda6ffc Comma is also dependent on position within the hash 9 years ago
Brian Coca 74bf59082d fixed and reintroduced syncronize test, fakerunner object needed become_method to be it's default 'sudo' 9 years ago
Toshio Kuratomi 644e50fe34 Hash randomization makes one of the heuristic_log_sanitize checks not work.
Nothing we can do, when it sanitizes ssh_urls it's simply overzealous.
9 years ago
Brian Coca 587ab17f10 fixes password error detection for ssh connection plugin
removes sycnronize test that does not work with current sudo setup
Fixes #10434
9 years ago
Brian Coca 5f6db0e164 preliminary privlege escalation unification + pbrun
- become constants inherit existing sudo/su ones
- become command line options, marked sudo/su as deprecated and moved sudo/su passwords to runas group
- changed method signatures as privlege escalation is collapsed to become
- added tests for su and become, diabled su for lack of support in local.py
- updated playbook,play and task objects to become
- added become to runner
- added whoami test for become/sudo/su
- added home override dir for plugins
- removed useless method from ask pass
- forced become pass to always be string also uses to_bytes
- fixed fakerunner for tests
- corrected reference in synchronize action plugin
- added pfexec (needs testing)
- removed unused sudo/su in runner init
- removed deprecated info
- updated pe tests to allow to run under sudo and not need root
- normalized become options into a funciton to avoid duplication and inconsistencies
- pushed suppored list to connection classs property
- updated all connection plugins to latest 'become' pe

- includes fixes from feedback (including typos)
- added draft docs
- stub of become_exe, leaving for future v2 fixes
9 years ago
Toshio Kuratomi ffb281d96c Merge pull request #9600 from msabramo/make_AnsibleError_a_plain_ol_exception
Make AnsibleError a plain ol' exception
9 years ago
Alejandro Guirao b8cf131375 Bug fix: Search only for files as candidates 9 years ago
Brian Coca 8872bba21f rearranged math filters 10 years ago
Brian Coca 2642738646 changed jsonify test to ignore whitespace 10 years ago
Brian Coca bc5d0a8cd4 fixed jsonify test 10 years ago
Brian Coca 5f2d5abeea ensure proper strings/unicodestrings for passwords
updated to correct to_bytes function
removed old to_bytes/to_unicode and repointed clients to new location
fixed unicode test
10 years ago
Toshio Kuratomi 4902c06304 Obfuscate passwords in more places where it is displayed 10 years ago
Marc Abramowitz 372a29744b Make AnsibleError a plain ol' exception
Python's Exception constructor already takes a `message` as a parameter,
which you can then get at by doing str(e) (e.message was deprecated).

The reason I bothered to make this change was because I was debugging
with pdb and I noticed that AnsibleErrors don't give useful information
in pdb (probably because they don't have a __repr__ method that prints
the `msg` attribute).

    (Pdb) c
    > /Users/marca/dev/git-repos/ansible/lib/ansible/runner/__init__.py(599)_executor()
    -> msg = str(ae)
    (Pdb) ae
    AnsibleError()
10 years ago
Björn Andersson 65e4f2b2bc Add filter to turn a string into a UUID
This filter was made because I needed to create idempotent UUIDs when
installing the agent for Go (http://go.cd), which uses UUIds to
distinguish the agents from each other.

It uses a newly created Ansible namespace to distinguish UUIDs created
by Ansible from any other source. The new namespace is a random one
created by uuidgen on OSX.
10 years ago
Michael DeHaan d4da58e102 Merge pull request #9720 from vlajos/typofixes-vlajos-20141204
typofixes - https://github.com/vlajos/misspell_fixer
10 years ago
Veres Lajos bf5d8ee678 typofixes - https://github.com/vlajos/misspell_fixer 10 years ago
Brian Coca 97408fe5b2 Revert "Make listify respect the global setting for undefined variables."
This 'mostly' reverts commit 2769098fe7.

Conflicts:
	lib/ansible/utils/__init__.py
	test/units/TestUtils.py
10 years ago
Brian Coca 7d2937b1cc minor fixes to template function
- make sure it calls itself correctly, now passes same params as it recieves
- vars is reserved, changed for templatevars to avoid confustion
- forcing mustaches again since the removal broke 'listification' as per #9622
- fixes incorrectly successful tests using undefined var, now it is defined
- now returns empty list if items is None to avoid errors
10 years ago
Toshio Kuratomi d36c38c35e Exception message changes 10 years ago
Toshio Kuratomi 067112b5ee Code for modules to perform more robust quoting of database identifiers 10 years ago
Toshio Kuratomi 4ae2d58d72 Fix detection of fips mode in test_do_encrypt_md5 10 years ago
James Cammarata 9a0f8f0158 Split out various vars-related things to avoid merging too early
Fixes #9498
10 years ago
Toshio Kuratomi d14dcdc222 Docker test does not require the mock module 10 years ago
Toshio Kuratomi b95475c1f9 Unittest the get_split_image_tag function in the docker module 10 years ago
Toshio Kuratomi 6030be3835 Add unittest for discrete functions in the apt module 10 years ago
Toshio Kuratomi 44eb19d553 Make VaultEditor Tests compatible with FIPS mode
Migrate one test to vault-1.1.  Skip the two other vault 1.0 tests if
running on a FIPS enabled system
10 years ago
Toshio Kuratomi e05b22e0d1 Skip some md5 related unit tests when running in fips mode 10 years ago
Toshio Kuratomi f1267c0b05 Move from md5 to sha1 to work on fips-140 enabled systems 10 years ago
Toshio Kuratomi 48a308a87c Allow both old-style and new-style role dependencies to be valid.
Fixes #9173
10 years ago
Rob Howard 2769098fe7 Make listify respect the global setting for undefined variables.
(Fixes #9008.)

With credit to jimi-c for the initial pass in this commit:
b18bd6b98e
10 years ago
Michael DeHaan 4cb7f654b6 Add stub tests for module args parsing. 10 years ago
Michael DeHaan 6db1b4dfd2 WIP on refactoring changes 10 years ago
Toshio Kuratomi e6fcd90342 Merge pull request #9224 from drawks/iss9223
Resolve #9223 Fix test for python 2.6
10 years ago
Toshio Kuratomi e00d657362 Make unittest compatible with python <= 2.6 10 years ago
Dave Rawks 5f54b57b6d Corrected indentation 10 years ago
Toshio Kuratomi 0af750e3e5 Merge pull request #9182 from bbasleeper/feature_sudo_exe_from_inventory
Add a new inventory parameter (ansible_sudo_exe) to specify sudo command...
10 years ago
Dave Rawks c070ab69f7 Resolve #9223 Fix test for python 2.6
* trivial test refactor to allow for python 2.6 compat
10 years ago
Bruno BAILLUET a25da4af05 Add a new inventory parameter (ansible_sudo_exe) to specify sudo command path. 10 years ago
Michael DeHaan f35ed8a6c0 Update module test code to avoid pycs (that are not used) 10 years ago
Michael DeHaan d6e6d2a6ca Remove regex related to baby-JSON parsing only. 10 years ago
Michael DeHaan 26cdddaebf Tracebacks are now catchable with ignore_errors and have streamlined output. Also removes 'baby-JSON' for bash modules. 10 years ago
James Cammarata 317ab06bc6 Fixing multiline parsing to preserve newlines
Fixes #8813
10 years ago
James Cammarata 8cc3543918 Re-allow templating of complex_args, but count params to prevent injection
Fixes #8810
10 years ago
Toshio Kuratomi 8233522a7a Reduce commenting as basic.py is copied to the remote host with every module transfer.
Move some comments to the unittest as we might look at that if we decide
to refactor the code.
10 years ago
Toshio Kuratomi d293a46994 Unittests to detect speed regressions in password obfuscation and that
the passwords are correctly hidden in the output.
10 years ago
Michael DeHaan 8a0045baad Update tests for ansible-galaxy CLI additions. 10 years ago
Michael DeHaan d87830e1cc Merge branch 'galaxy_github_archive' of git://github.com/willthames/ansible into devel
Conflicts:
	lib/ansible/utils/__init__.py
10 years ago
James Cammarata d01188033f Checking for localized versions of the su password prompt
Fixes #8681
10 years ago
Will Thames 850963790d Allow roles to be installed from archives on github
Ensure that the automated scm determination for github.com
repos still copes with .tar.gz archive files.

Handling .zip archives is left as an exercise for the interested reader
10 years ago
Michael DeHaan bcb44276fe Assume github.com URLs are git protocol if not specified. 10 years ago
Will Thames 6e9abefc11 Corrected bug where role_path was wrong for roles in subdirectories
Fixed role name for
    - { role: 'lives/in/a/subdirectory' }
Should be 'lives/in/a/subdirectory', not just 'subdirectory'
10 years ago
Will Thames 46b59b02ed Friendly Role Names and roles from URLs
* Roles can now be given a friendly name as third field in role spec csv
* Roles can be installed from URL (not just from archived SCMs)
* Integration tests to demonstrate this
* Unit tests to ensure that role spec parsing works as expected
10 years ago
Will Thames 4803e923ff Improved handling of role_version in repo_url_to_role_name 10 years ago
Will Thames c2fe33f9f4 Tidied up a little, added tests
Moved repo_url_to_role_name to common method in ansible.utils
Added unit test for repo_url_to_role_name
Added integration tests for galaxy
10 years ago
James Cammarata 8a1fbed5d6 Correct variable blending from vars_files with hostvars in them
Fixes #8638
10 years ago
Michael DeHaan 99c39b1ff3 By popular request, make the no_log attribute also censor tasks from callbacks. 10 years ago
James Cammarata 5a128ca286 Adding extra member to mock inventory for unittests 10 years ago
Michael DeHaan 2629cd3fce Fix some copyrights, fix a misc test. 10 years ago
James Cammarata 25e9d1197e Merge branch 'optimise_utils_clean_data' of https://github.com/leth/ansible into leth-optimise_utils_clean_data 10 years ago
Marcus Cobden e3dbca9378 Test escaping strings with two variables 10 years ago
Michael DeHaan 3bead39c75 Merge branch 'spelling' of git://github.com/cgar/ansible into devel
Conflicts:
	docsite/rst/guide_rax.rst
	plugins/callbacks/mail.py
10 years ago
James Cammarata 63bf2f6d9a Preserve all line breaks in literal blocks
Fixes #8512
10 years ago
Michael DeHaan 8c4161d4a1 Merge branch 'retf_py' of git://github.com/berendt/ansible into devel
Conflicts:
	lib/ansible/inventory/vars_plugins/group_vars.py
	plugins/callbacks/mail.py
10 years ago
Michael Peters 3ba516ac25 adding min() and max() filters for use in Jinja templates 10 years ago
James Cammarata af0d8cda7b Fix literal block multiline parsing
Fixes #8394
10 years ago
James Cammarata 6d94ae64ec Remove unnecessary unicode conversions from parse_kv
Fixes #8425
10 years ago
James Cammarata e6fa50a306 Move splitter to module_utils so modules can use it and fix command arg splitting
Fixes #8338
10 years ago
James Cammarata aee940aaca Reworking _clean_data() to be smarter about replaces
Fixes #8228
10 years ago
James Cammarata a8c2d6acd5 Adding unittest for space preservation within quotes when splitting args 10 years ago
James Cammarata 8f694c7588 Fixing unittests based on previous patch for splitting 10 years ago
Michael DeHaan 8d42f5cbfa Smush ds removal 10 years ago
Michael DeHaan eeb51b6bf3 Moar split_args tests 10 years ago
Michael DeHaan 630f080cf0 Start of unit tests for split_args function, moved split_args to utils since not needed by modules (so far). 10 years ago