Commit Graph

8069 Commits (710ede41ee55200a3a8b013af746b1aa799c2acd)

Author SHA1 Message Date
Matt Clay 07a76bece1 Update submodule refs. 8 years ago
Toshio Kuratomi ce4c0fd644 Use text strings when using display() to avoid UnicodeError tracebacks 8 years ago
Senthil Kumar Ganesan bb9ed50441 Renamed the Modules from dnos* -> dellos*, updated copyright, removed… (#17617)
* Renamed the Modules from dnos* -> dellos*, updated copyright, removed dnos6_template

* Addressed @gundalow comments
8 years ago
ftigeot 9df8a2565f Fix distribution fact on DragonFly (#17619)
* By default, ansible_distribution is not set on DragonFly systems,
  preventing some distribution-specific tests from being written

* This commit fixes the issue by returning the quite logical value
  of "DragonFly" when appropriate
8 years ago
nvigot 10f840e80d include_vars now properly deals with hash_behaviour (#15895) 8 years ago
Adrian Likins 3e754086b6 Fix error using jsonfile with incomplete config (#17567)
If 'fact_caching=jsonfile' was configured, but
'fact_caching_connection' was not configured, jsonfile
would fail and ansible-playbook would exit with a traceback.

Fixes #17566
8 years ago
jctanner 29fda4be1e copy action plugin: recurse into sub folders of the source (#17614)
* copy action plugin: recurse into sub folders of the source

Fixes #13013

* Fix python3 bytes/strings

* Fix py3 again

* test
8 years ago
Brian Coca 4e60f23198 remove bare variable support from loops (#17519)
* remove bare variable support from loops

* Added new 'removed deprecated' section to changelg

also added removed items from this PR and others
8 years ago
Toshio Kuratomi d9c0773609 Update submodule refs 8 years ago
Nathaniel Case b753e8dc48 Add simple checks for libraries to junos 8 years ago
Andrea Tartaglia e0a77bb8d5 Pass the absolute path to dirname when assigning basedir (#17457)
* Pass the absolute path to dirname when assigning basedir

If no path is specified when calling the playbook, os.path.dirname(playbook_path) returns ''
This will cause failure when creating the retry file.

Fixes #17456

* Updated to use os.pathdirname(os.path.abspath())
8 years ago
Peter Sprygada 697888965e Merge pull request #17603 from skg-net/dnos10_facts
Added support for facts module for Dell Networking OS10 device.
8 years ago
Toshio Kuratomi 8af8eec789 Merge pull request #17590 from abadger/vault-fixes
Vault fixes
8 years ago
Senthil Kumar Ganesan 769fa1c2d7 Support for dnos10_facts module 8 years ago
Toshio Kuratomi e70066a6f7 Many Cleanups to vault
* Make is_encrypted_file handle both files opened in text and binary mode
  On python3, by default files are opened in text mode.  Since we know
  the encoding of vault files (and especially the header which is the
  first set of bytes) we can decide whether the file is an encrypted
  vault file in either case.
* Fix is_encrypted_file not resetting the file position
* Update is_encrypted_file to check that all the data in the file is ascii
* For is_encrypted_file(), add start_pos and count parameters
  This allows callers to specify reading vaulttext from the middle of
  a file if necessary.
* Combine VaultLib.encrypt() and VaultLib.encrypt_bytestring()
* Change vault's is_encrypted() to take either text or byte strings and to return False if any part of the data is non-ascii.
* Remove unnecessary use of six.b
* Vault Cipher: mark a few methods as private.
* VaultAES256._is_equal throws a TypeError if given non byte strings
* Make VaultAES256 methods that don't need self staticmethods and classmethods
* Mark VaultAES and is_encrypted as deprecated
* Get rid of VaultFile (unused and feature implemented in a different way)
* Normalize variable and parameter names on plaintext, ciphertext, vaulttext
* Normalize variable and parameter names on "b_" prefix when dealing with bytes
* Test changes:
  * Remove redundant tests( both checking the same byte string)
  * Fix use of format string without format operator
  * Enable vault editor tests on python3
  * Initialize the vault_cipher for VaultAES256 testing in setUp()
  * Make assertTrue and assertFalse take the actual method calls for
    better error messages.
  * Test that non-ascii byte strings compare correctly.
  * Test that unicode strings and ints raise TypeError

* Test-specific:
  * Removed test_methods_exist().  We only have one VaultLib so the
    implementation is the assurance that the methods exist. (Can use an abc for
    this if it changes).
  * Add tests for both byte string and text string input where the API takes either.
  * Convert "assert" to unittest assert functions or add a custom message where
    that will make failures easier to debug.
  * Move instantiating the VaultLib into setUp().
8 years ago
James Cammarata dfb1c0647e Revert "Move queuing tasks to a background thread"
This reverts commit b71957d6e6.
8 years ago
jctanner b93de25204 During initial argument evaluation, cast args to string. (#17595)
Later in the stack, further code will check and inform the user that var names must start with a letter
or underscore, so this fix only allows us to get to that previously existing policy.

Fixes #16008
8 years ago
Adrian Likins 2c54a8471f Improve inventory script error messages. (#17589)
When an inventory file looks executable (with a #!) but
isn't, the error message could be confusing. Especially
if the inventory file was named something like 'inventory'
or 'hosts'. Add some context and quote the filename.

This is based on https://github.com/ansible/ansible/pull/15758
8 years ago
Matt Davis f497d771c8 win_shell/win_command changes + tests (#17557) 8 years ago
Senthil Kumar Ganesan 81072fcba1 Added support OS9 facts (#17591) 8 years ago
Toshio Kuratomi ebc4d577de Update submodule refs 8 years ago
Brian Coca cb071e043c updated subrefs 8 years ago
Monty Taylor cd6e01349e Ensure parent tempdir's existence (#17585)
While doing evil things with action plugins, I hit a code path in which
the mkdir here was failing due to lack of parent dir. Changing this to
makedirs made everything happy. Now, I'd obviously like to understand
why the parent dir exists in some places and not others - but I could
not find anywhere that C.DEFAULT_LOCAL_TMP is ensured to be created.
8 years ago
Toshio Kuratomi 70e63ddf6c Fix cow mode to work with unicode task and play names (#17576)
Fixes #17560
8 years ago
Matt Clay 6787fc70a6 Update submodule refs. 8 years ago
Senthil Kumar Ganesan 68f1705d18 Add action plugin for dnos6_config module (#17553) 8 years ago
Senthil Kumar Ganesan 7d9b07382b Add action pluging for dnos9_template module (#17549) 8 years ago
Senthil Kumar Ganesan 564e02c3c3 Add action plugin for dnos6_template module (#17554) 8 years ago
Senthil Kumar Ganesan daba7fa057 Moved the dnos10_template.py action plugin to the correct directory (#17550) 8 years ago
Toshio Kuratomi f4cd1c6321 Fix galaxy's parsing of the command line. (#17569)
Also make the parsing of the action in both galaxy and vault more
robust.

Fixes #17534
May Fix #17563
8 years ago
Adrian Likins 8438da2a34 Make jsonfile cache plugin errors less vague. (#17568) 8 years ago
Adrian Likins c633022fca [wip] Let jsonfile and memcached cache plugins understand fact_caching_timeout=0 (#17565)
* Add support for no-expiration to jsonfile cache

* Let memcached cache use fact_caching_timeout=0

If fact_cache=memcached and fact_caching_timeout=0
memcached would hit a NameError on _expire_keys
8 years ago
Ryan S. Brown 0bda419f66 Allow AWSRetry class to be created without boto3/botocore installed 8 years ago
Brian Coca 4656b6a846 added msg info to unreachable for oneline callback
fixes #17367
8 years ago
Adam Reznechek 23930d799f Fix cpu facts for hosts missing fields in cpuinfo (16533) (#16535)
Change linux fact gathering to correctly gather ansible_processor_count
and ansible_processor_vcpus on systems without vendor_id/model_name in
/proc/cpuinfo (for ex, ppc64/POWER)
8 years ago
Allen Sanabria b510abce17 CloudRetry/AWSRetry backoff decorator with unit tests (#17039)
* Added aws_retry decorator function with unit tests

* Restructured the code to be used with a base class.

This base class CloudRetry can be reused by any other cloud provider.
This decorator should be used in situations, where you need to implement
a backoff algorithm and want to retry based on the status code from the
exception.

* updated documentation

* fixed tabs

* added botocore and boto3 to requirements.txt

* removed cloud.py from py24 tests, as it depends on boto3

* fix relative imports

* updated test to be 2.6 compat

* updated method name from retry to backoff

* readded lxd

* Updated default backoff from 2 seconds to 1.1s.

This will be about a total of 48 seconds in 10 tries. This is
configurable.
8 years ago
Brian Coca 60706cc12e doas update (#16997)
hopefully fixes #15597
8 years ago
Peter Sprygada 760fff8564 Merge pull request #17546 from skg-net/dnos9_config
Added support for dnos9_config module
8 years ago
Brian Coca db8c952ee3 added new ksu method to man page
removed runas refrences, because it was never implemented
8 years ago
Nathaniel Case 5331dd482c Cleanup eos (#17548) 8 years ago
Senthil Kumar Ganesan c6acf44a7c Added support for dnos9_config module 8 years ago
Nathaniel Case 8b3ae1e806 Cleanup netcfg.py (#17531)
Closes #17412
8 years ago
Peter Sprygada c9d74e9a6e removes filter attribute from asa
This removes the filter attribute from the asa shared module and moves
the function to the asa_acl module where it was used.
8 years ago
Brian Coca 7450629733 better display for free strategy (#17355) 8 years ago
John R Barker e326da28ff eos: cmd should be item (#17540)
Was changed during
7fe64ef9b8
however not all look variables were updated.
8 years ago
Abhijit Menon-Sen 07756a4265 Remove extraneous . from VALID_FILE_EXTENSIONS
Otherwise if you «include_vars: vars.json», you get this error:

    "message": "/path/to/vars.json does not have a valid extension: yaml, yml, .json"
8 years ago
Toshio Kuratomi b0d81a43d7 Update submodule refs 8 years ago
Brian Coca 8ebd8ca259 updated solaris virtualization detection (#17464)
avoid prtdiag since it seems to hang and require service restarts
hopefully fixes #4583
8 years ago
Nathaniel Case 036650cb09 Cleanup junos (#17530)
Closes #17411
8 years ago
Peter Sprygada 076a821821 Merge pull request #17468 from skg-net/dnos9_command
dnos9_command (new module)
8 years ago
Nathaniel Case bfe341177b Cleanup netcli (#17529)
This honestly mostly amounts to Python 3 fixes.
8 years ago
Toshio Kuratomi bf29961947 Fixes to the controller text model (#17527)
* Fixes to the controller text model

* Change command line args to text type
* Make display replace undecodable bytes with replacement chars.  This
  is only a problem on pyhton3 where surrogates can enter into the msg
  but sys.stdout doesn't know how to handle them.
* Remove a deprecated playbook syntax in unicode.yml

* Fix up run_cmd to change its parameters to byte string at appropriate times.
8 years ago
Toshio Kuratomi 9868117d1f Update submodule ref for core to fix broken service module 8 years ago
Toshio Kuratomi 499b13d649 Update submodule refs 8 years ago
Senthil Kumar Ganesan 1c7c3cc878 Addressed review comments from @gundalow 8 years ago
Senthil Kumar Ganesan 3e18676af4 Addded support for dnos9_command module 8 years ago
Nathaniel Case 060ed665f6 Cleanup nxos
closes #17414
8 years ago
Peter Sprygada 5aa83041bf Merge pull request #17474 from skg-net/dnos6_command
Add module_utils/dnos6.py
8 years ago
Peter Sprygada cc45506006 Merge pull request #17521 from privateip/fix-4797
raise exception when src file is not found in net_config
8 years ago
Nathaniel Case fcd4be28ee Cleanup openswitch
Also bump get_config in vyos, to pick up the addition of **kwargs

Closes #17415
8 years ago
Senthil Kumar Ganesan 05e016e4aa Addressed @gundalow review comments 8 years ago
Senthil Kumar Ganesan 94df740ca3 Added support for dnos6_command module 8 years ago
Toshio Kuratomi 6117e1946e Check controlpersist (#17443)
* Add a new config option to cache the check for controlpersist on the
control machine.

Fixes #15844

* Remove the option and make the behavior the default

* Make the check for controlpersist cache its status per-ssh executable
8 years ago
Nathaniel Case 2077e32ddd Vyos cleanup
Addresses #17416
8 years ago
Peter Sprygada 16d6274276 raise exception when src file is not found in net_config
This will now raise an exception if the file path specified in src is not
found and the module will gracefully error.

ref #4797
8 years ago
Peter Sprygada 4e325274d6 Merge pull request #17512 from privateip/nxos
roll up of updates to nxos shared module
8 years ago
Peter Sprygada 7777c38b95 Merge pull request #17508 from privateip/sros
updates sros shared module
8 years ago
Peter Sprygada e83567a8ec Merge pull request #17509 from privateip/vyos
roll up of updates to vyos shared module
8 years ago
Peter Sprygada 560984d282 Merge pull request #17511 from privateip/junos
updates junos shared module methods
8 years ago
Peter Sprygada 7c4dad4275 Merge pull request #17513 from privateip/eos
cleans up load_config() in eos shared module
8 years ago
Peter Sprygada ebe2400af8 Merge pull request #17510 from privateip/iosxr
clean up iosxr shared module
8 years ago
John R Barker 8a3b520f70 Add missing space in loop variable reuse message (#17516) 8 years ago
Peter Sprygada f4af154bef Merge pull request #17506 from privateip/openswitch
minor clean of openswitch shared module
8 years ago
Peter Sprygada db744e1233 Merge pull request #17507 from privateip/netcfg
removes unneeded message in netcfg
8 years ago
nitzmahone 8d1f96dd82 bump core submodule ref for win_user fixes 8 years ago
Peter Sprygada d2e4ddf0b0 roll up of updates to nxos shared module
* combine same functions into NxapiConfigMixin class
* update Cli and Nxapi to use mixin
8 years ago
Peter Sprygada e9f804614d removes unneeded message in netcfg
removes old warning message in netcfg that is no longer used
8 years ago
Peter Sprygada 815a683e9c minor clean of openswitch shared module
* updates regexp entries
* removes legacy 2.1 code for get_module()
8 years ago
Peter Sprygada 75f1573ed5 roll up of updates to vyos shared module
* cleans up method signature
* removes save_config method in favor of super class
8 years ago
Peter Sprygada a6cf394ebc updates sros shared module
* adds rollback to load_config() method
* updates error regexp list
8 years ago
Peter Sprygada e5d931de6b updates junos shared module methods
* cleans up load_config() arguments to simply
* removes unused methods in Cli transport
* updates error regexp
8 years ago
Peter Sprygada a8daff1590 clean up iosxr shared module
fixes up method signatures in iosxr shared module removing unneeded **kwargs
8 years ago
Peter Sprygada 456fbf011e cleans up load_config() in eos shared module
cleans up the load_config() method
8 years ago
James Cammarata f5cff2ced5 Revert "Flush the queued items in linear periodically"
This reverts commit d3418fd658.
8 years ago
Robin Schneider d76dd56ca3
Use addresses and names reserved for documentation
Trying to preserve the meaning of the examples. Not all occurrences in
`docsite/rst/playbooks_lookups.rst` have been changed for instance to
allow the unchanged examples to be used for testing.

Related to: #17479
8 years ago
James Cammarata d3418fd658 Flush the queued items in linear periodically 8 years ago
James Cammarata 6b206f5d00 Re-adding processing of results inline with queuing tasks for linear 8 years ago
Chris Houseknecht 39aa740531
Use LooseVersion comparison. Default docker_api_version to 'auto'. 8 years ago
Peter Oliver c87d84f5b8 Filesystem blocks are of size `f_frsize` (#17493)
The statvfs(3) manpage on Linux states that `f_blocks` is the "size of fs in `f_frsize` units".  The manpages on Solaris and AIX state something similar.

With ext4 on Linux, I suspect that `f_bsize` and `f_frsize` are always identical, masking this error.  On Solaris, the sizes differ for each of ufs, vxfs and zfs causing the `size_available` and `size_total` facts to be set incorrectly on this OS.
8 years ago
Brian Coca a3028783d4 removed previously deprecated ';' host separator 8 years ago
Brian Coca 0aaee0272a using delegated host's facts when delegating (#17489)
fixes #17313
8 years ago
jctanner af2ce7725b Iterate through role paths when installing roles (#17487)
* Iterate through role paths when attempting to install roles
8 years ago
Alvaro Aleman e8897a9b91 Fix from_yaml for non-string_types. This resolves #17397 (#17398) 8 years ago
Peter Sprygada 19e00cf160 Merge pull request #17481 from privateip/junos
minor update to catch expection if trying close a non existent session
8 years ago
Brian Coca cd2f60e11a take delegated vars before removing them
fixes #17455
8 years ago
Dag Wieers 2daf527e63 Fix fileglob filter to work just like fileglob lookup plugin (#17480)
The fileglob lookup plugin only returns files, not directories.
This is to be expected, as a mixed list would not be very useful in with_fileglob.
However the fileglob filter does return anything glob.glob() returns.

This change fixes this, so that fileglob returns files (as the name indicates).

PS We could also offer a glob filter for thos that would need it ?

This relates to comments in issue #17136 and fixes confusion in #17269.
8 years ago
Peter Sprygada 1dac6edbe4 minor update to catch expection if trying close a non existent session
This will prevent the junos shared module from throwing an exception if
the session is trying to be closed when it doesn't exist
8 years ago
Dag Wieers d52a9cee46 Support late evaluation, suppress warnings on SyntaxError (#17462)
See #14304 comments (https://github.com/ansible/ansible/pull/14304#issuecomment-245453209) for more information.
8 years ago
Matt Martz eefe359d6b Don't use the shell to catch output, catch output in python. Fixes #17137 (#17449) 8 years ago
Dag Wieers 1df924e1d5 Clean up unarchive action plugin (#17429) 8 years ago
Maciej Delmanowski f5a4677680 Allow for no prefix in the comment filter (#17421)
In the 'comment' filter, if the 'prefix' parameter is set as empty,
don't add an empty line before the comment. To get the previous
behaviour (empty line before comment), set the prefix to '\n'.
8 years ago
Matt Clay d317560914 Update submodule refs. 8 years ago
Peter Sprygada 686d79a515 Merge pull request #17467 from privateip/netcfg
fixes issue with netcfg not working with match=line and path
8 years ago
Peter Sprygada 457a6ca03e fixes issue with netcfg not working with match=line and path
The difference() method now checks this condition and doesn't filter
the path when match=line
8 years ago
Tobias Wolf 9838d6420a Re-fix the per-item diff output, (#17458)
which got lost in recent big 'performance improvements' merge by @jimi-c.

I had made a previous PR to fix this, then @bcoca had committed an
improved fix. Now it's lost again.

cf: d2b3b2c03e (lost here)
cf:  25e9b5788b (previous fix)

Earlier PR #14849
Earlier issue #14843

Please note that jimi-c broke this last time as well ... seeing a
pattern here.
8 years ago
Edward Marshall 1ec9ac4b70 Defined children for get_vm (#15904) 8 years ago
Abhijit Menon-Sen 032bd1dacf Fix typo 8 years ago
Peter Sprygada 982db58aff Merge pull request #17452 from privateip/netcfg
adds context to diff functions based on config path
8 years ago
Peter Sprygada d64eaae232 Merge pull request #16553 from ericchou1/devel
Added axapi_authenticate_v3 and axapi_call_v3 for AXAPIv3
8 years ago
Peter Sprygada 08eeb1518a adds context to diff functions based on config path
* difference() now accepts a path keyword to specify comparision domain
8 years ago
Andrea Tartaglia ba28f1a2da Make ssh_executable available as ansible_ssh_* variable (#17450) 8 years ago
James Cammarata d1a7e07ccc Fixing another logic issue related to include_role changes 8 years ago
Peter Sprygada 715b800ef1 Merge pull request #17447 from privateip/eos
minor fix in eos shared module returning diff
8 years ago
Peter Sprygada 675e87f68d minor fix in eos shared module returning diff
The diff returned from eos when the transport was set to eapi was as
a dict but is expected to be a str.  This change extracts the diff string
from the dict object and returns it.  The behavior is now consistent
between cli and eapi transports.
8 years ago
Brian Coca 65c373c55a fixed bad condition hiding results 8 years ago
@skg_net e5b8a177d7 Support files for dnos10_template module (#17399) 8 years ago
Brian Coca a4abf8da79 Flush cache (#17445)
* transfer module based on pipelining, not tmp

fixes #17381

* added missing flush cache option back
8 years ago
Andrea Tartaglia dd71469bb7 Added option to change ssh executable path (#17377) 8 years ago
Adrian Likins 07e713e7c6 Fix NameError on 'ansible-vault view' (#17440) 8 years ago
Toshio Kuratomi 8c43750a3e Update submodule refs 8 years ago
Peter Sprygada d67af04c45 Merge pull request #17431 from privateip/eos
minor roll up of fixes to eos shared module
8 years ago
Toshio Kuratomi 4ed88512e4 Move uses of to_bytes, to_text, to_native to use the module_utils version (#17423)
We couldn't copy to_unicode, to_bytes, to_str into module_utils because
of licensing.  So once created it we had two sets of functions that did
the same things but had different implementations.  To remedy that, this
change removes the ansible.utils.unicode versions of those functions.
8 years ago
Peter Sprygada ca95b2ae4f minor roll up of fixes to eos shared module
* added back import of Command object
* fixed eapi requests to handle output format correctly
* get_config() now honors include_defaults kwargs
8 years ago
Matt Davis f239e1e61f windows async changes and tests (#17400) 8 years ago
nitzmahone 056a7cb957 bump core submodule ref for async_wrapper.ps1 bugfix 8 years ago
Matt Clay 94a0d2afb4 Add partially backwards compatible version of _fixup_perms. (#17427)
Also added a deprecation notice for _fixup_perms.

Resolves issue #17352 (assumes custom actions use recursive=False).
8 years ago
Toshio Kuratomi 1d412059a0 Fix UnicodeError loading plugins with non-ascii in them on python3 8 years ago
Peter Sprygada 113dfc5562 Merge pull request #17426 from privateip/nxos
fixes issue when piping commands through json with output not specifed
8 years ago
Peter Sprygada 52d1187f5c Merge pull request #17425 from privateip/netcli
removes command caching on retrieve from netcli
8 years ago
Peter Sprygada 666b19869b Merge pull request #17424 from privateip/fix-17408
removes unneeded code from netcli
8 years ago
Peter Sprygada 5730c97f9e Merge pull request #17422 from privateip/fix-17407
bug fix for AttributeError: 'str' object has no attribute 'get'
8 years ago
Peter Sprygada c228dfe692 fixes issue when piping commands through json with output not specifed
There is an issue when piping cli commands through json but the output
is specified as either text or the output is none and the transport is
cli.  The results would not be loaded properly for conditional
evaluation.  This is similar to #17422
8 years ago
Peter Sprygada da931b04ad removes command caching on retrieve from netcli
The caching of commands in CommandRunner is providing no useful feature
and causing problems.  This removes the code and simply returns the
requested command results.
8 years ago
Peter Sprygada fbda7d127f removes unneeded code from netcli
Some old remnants of code from the refactor of netcli was left over as
reported in #17408.  This commit removes the old code as it isn't need
and in fact wasnt doing anything
8 years ago
nitzmahone abbb93e117 bump core submodule ref for windows async 8 years ago
Matt Davis b860b2d258 windows environment support (#17402) 8 years ago
Peter Sprygada 7fe64ef9b8 bug fix for AttributeError: 'str' object has no attribute 'get'
Exception thrown when using cli transport in eos but piping the command
through json

* eos now checks for `| json` and automatically changes the output type
* adds back import of Command object

tested on EOS 4.15.4F
8 years ago
Toshio Kuratomi b6d24be09e Update submodule refs 8 years ago
James Cammarata 37f721f315 Remove debug lock 8 years ago
Nathaniel Case 972dc3fc97 Network module cleanup (#17334)
* Clean up EOS, IOS, IOS-XR, Junos, NX-OS, and OpenSwitch

* Cleanup net* files

* Re-add NetworkModule import to network module_utils files

This will trick modules into importing code from module_utils code, thus
including it in the final Ansiballz zipfile.

* Give asa a look over, too
8 years ago
James Cammarata 7a0b25d5fa Fixing incorrect 'task' variable bug in strategy/__init__.py 8 years ago
Marc-André Gatien d56b0aa813 typo fix for variable ANSIBLE_ETCD_VERSION (#17373) 8 years ago
Michael Scherer 02d9f14b8b Do not crash if current dir do not exist, fix #17369 (#17379)
Do not crash if current dir do not exist
8 years ago
Brian Coca ff34f5548d Dynamic role include (#17401)
* dynamic role_include

* more fixes for dynamic include roles

* set play yfrom iterator when dynamic

* changes from jimi-c

* avoid modules that break ad hoc

TODO: should really be a config
8 years ago
Peter Sprygada 439aa353f1 fixes bug when template is missing src argument
adds AttributeError to exception handling to change missing src argument

fixes #17391
8 years ago
Peter Sprygada 9c5bcda4fe Merge pull request #17388 from privateip/asa
fix up asa shared module
8 years ago
Peter Sprygada 06c76034dc Merge pull request #17385 from privateip/shell
minor optimizations and clean up in shell.py
8 years ago
Peter Sprygada 1b1c1fe992 Merge pull request #17386 from privateip/netcli
clean up method signatures in netcli
8 years ago
Peter Sprygada d976c80a22 roll up of updates to junos shared module
* adds implementation for Network methods
* adds action plugin junos_config
* removes _log() and raises exceptions instead to be handled by the module
8 years ago
Peter Sprygada a839acfa33 clean up method signatures in netcli
removes unneeded **kwargs from methods in netcli
8 years ago
Peter Sprygada a40515524f minor optimizations and clean up in shell.py
* cleans up method signatures
* drops checking for Command properties that no longer exist
8 years ago
Peter Sprygada 7aa1220b96 fix up asa shared module
* add authorize() method to handle authorization
* move terminal commands to after authorization completed
* add save_config() method to handling writing config to disk
* fix minor issues with get_config
* adds action plugin asa_config
8 years ago
Rene Moser a6c0f07fbb Update extra module submodule ref, fixes build 8 years ago
Toshio Kuratomi 9ad77a5398 Update submodule refs 8 years ago
Toshio Kuratomi f7b22a5eaa Fix paramiko's exec_command() to return bytes on python3 (#17372)
* Fix paramiko's exec_command() to return bytes on python3

* Run test_connection for python3 now too

* Fix atomic_move for problem in shippable's testing

* Python-2.4 needs to use b()
8 years ago
Matt Clay 3b2830818e Update submodule refs. 8 years ago
Matt Clay cfacc1fd53 Pass '_' to async_wrapper for no argsfile. (#17374)
This provides compatibility with changes made to the async_wrapper module.
8 years ago
Matt Clay bc143a9adb Update submodule refs. 8 years ago
Matt Clay 2392865d69 Update submodule refs. 8 years ago
Toshio Kuratomi 7728d70bea Replace long with int (#17368)
I can't figure out any reason that we'd need to use long explicitly here
as python implicitly moves from a C long int to python Long
automatically under the covers.  My best guess is that it was originally
used so that the facts module would work on python-2.2 where the user
had to convert a number from int to long manually but python-2.4 is our
current baseline.

long isn't present on Python3 so now is a good time to remove this
cruft.  (We had a workaround for Python3; this commit also removes the
workaround.)
8 years ago
Toshio Kuratomi 67177105e3 We now have an exception return value. Make use of it instead of putting the traceback into msg (#17365) 8 years ago
Toshio Kuratomi 6d0755f71e Update submodule refs 8 years ago
Brian Coca 4457985062 added ability to use pure boolean in conditionals 8 years ago
Will Thames d54f5277d5 Add ksu privilege escalation (#17340)
Allow ksu privilege escalation to be used
as a standard become_method

https://web.mit.edu/kerberos/krb5-1.12/doc/user/user_commands/ksu.html
8 years ago
Peter Sprygada c8431e334b Merge pull request #17296 from skg-net/devel
Add support for Dell Networking OS10 Command and Config Modules
8 years ago
John R Barker 02308ce27b docs_fragments: Correct spelling mistakes, fix formatting (#16930)
docs_fragments: Correct spelling mistakes, fix formatting
8 years ago
Toshio Kuratomi 88d17642c5 Update submodule refs to sync to_text, to_bytes, to_native changes with usage 8 years ago
Tobias Wolf c23b11d212 [Inventory] Cache the result of enumerating groups and host names
for `VariableManager._get_magic_variables()`.

This saves a lot of time re-iterating the nearly always constant global
list of groups and their members.

Generate once and cache, and invalidate cache in case `add_host:` or
`group_by:` are used.
8 years ago
Toshio Kuratomi 28227546fa Various python3 updates for module_utils: (#17345)
* Port set_*_if_different functions to python3
* Add surrogate_or_strict and surrogate_or_replace error handlers for
  to_text, to_bytes, to_native
* Set default error handler to surrogate_or_replace
* Make use of the new error handlers in the already ported code
* Move the unittests for module_utils._text as they aren't in basic.py
* Cleanup around SEQUENCETYPE.  On python2.6+ SEQUENCETYPE includes
  strings so make sure code omits those explicitly if necessary
* Allow arg_spec aliases to be other sequence types
8 years ago
Peter Sprygada d8f0ceee61 Merge pull request #17331 from privateip/openswitch
add Ssh transport class to openswitch shared module
8 years ago
Roman Belyakovsky d80d986a38 Added to_datetime filter (#17145)
* Added to_datetime filter

* Added to_datetime filter documentation
8 years ago
Senthil Kumar Ganesan 008e79fe74 Removed the unused module imports 8 years ago
Toshio Kuratomi 28429a636d Update submodule refs for fix that new unittest needs 8 years ago
Matt Clay 6744332600 Update submodule refs. 8 years ago
Brian Coca f39799fbcd implemented loop pausing (#17289)
* implemented loop pausing

- added loop pause to changelog
- only pause between iterations, avoid 1st/last
- added example to docs

* fixed note placement

* else

* added docs for loop_control: label
8 years ago
Matt Clay e6e541fcb3 Update submodule refs. 8 years ago
James Cammarata 307f98167a Updating submodule reference for core after meta change 8 years ago
Peter Sprygada 4ed8306099 add Ssh transport class to openswitch shared module
This adds a Ssh transport class for working directly with DC config
on OpenSwitch enabled nodes.
8 years ago
James Cammarata 78b8f81cab New feature: add new meta action `end_play`
This feature also cleans up and extends the meta subsystem:
* Allows for some meta actions (noop, clear_facts, clear_host_errors,
  and end_play) to operate on a per-host basis, meaning they can work
  with the free strategy as expected.
* Allows for conditionals on meta tasks.
* Fixes a bug where (for the linear strategy) metas were not treated
  as a run_once task, meaning every host in inventory would run the
  meta task.

Fixes #1476
8 years ago
Nathaniel Case 01911e4958 Update Junos to NetworkModule (#17197)
* Junos NetworkModule adaption.

* Take CLI_PROMPTS_RE & CLI_ERRORS_RE from ios.py
8 years ago
James Cammarata b71957d6e6 Move queuing tasks to a background thread 8 years ago
James Cammarata 9ecec6c28e Don't do parent stuff during serialize if squashed or finalized 8 years ago
James Cammarata cddf1cf98e Some further cleanup in the meta branch
* adds squashing to objects, which allows them to be squashed down
  to a final "view" before post_validate to avoid expensive evaluations
  of parent attributes
8 years ago
James Cammarata 96e2be9bf8 Selectively assign the getter for better performance
Introduces the `inherit` param for FieldAttributes, which is now used
in BaseMeta when constructing the getter property to enhance performance
by reducing the amount of work the getter generally has to do.
8 years ago
James Cammarata 3a51587220 Meta meta meta 8 years ago
Toshio Kuratomi 71ef25d5e8 For module parameter checking, allow conversion of int to float (#17325)
Fixes https://github.com/ansible/ansible-modules-core/issues/4084
8 years ago
Toshio Kuratomi 811fc385ee Update submodule refs 8 years ago
Michael Scherer acd69bcc77 Fix url lookup for python 3 (#17295)
* Use six instead of urllib2, for python 3 compat

* Open the certificate file using binary mode

On python3, os.write requires 'bytes'. Also avoid
using a too broad exception, since the issue was hard
to spot due to it.

* Do not add the header User-agent if not set

Python3 module do raise a exception if a header is
not a string-like object, and the default value is None.
8 years ago
Andrew Gaffney f65a3ce547 Support for specifying item label in a loop (#17294) 8 years ago
Peter Sprygada 61e7c3af1a Merge pull request #17315 from privateip/openswitch
minor bug fixes in openswitch shared module
8 years ago
Peter Sprygada 539d13a2cc Merge pull request #17321 from privateip/ios
fixes authorize method in ios shared module
8 years ago
Peter Sprygada 390be19e29 Merge pull request #17320 from privateip/fix-netcli-iterable
fixes issue with converting commands to an iterable was not being done
8 years ago
Peter Sprygada 7fc46e8233 fixes authorize method in ios shared module
The authorize method was calling run_commands() instead of execute().  This
fixes that problem so that authorize() calls are made direclty on the shell
object now
8 years ago
Peter Sprygada 1f9253c032 fixes issue with converting commands to an iterable was not being done
This fix will now force the commands arg in __call__ to be a list of
objects which otherwise would cause netcli not process the stack
8 years ago
Senthil Kumar Ganesan f12a8a2267 Incorporated Ansible community feedback 8 years ago
Peter Sprygada ec3dcefd39 minor bug fixes in openswitch shared module
* fix setting cookie after successful login
* raise NotImplementedError if run_commands is called in Rest
* return header msg key if status is not 2xx
* add action plugin ops_config
8 years ago
Allen Sanabria 03132041fb Include vars updated to work with directories (#17207)
* New features for include_vars

include_vars.py now allows you to include an entire directory and its nested directories of variable files.

Added Features..

* Ignore by default *.md, *.py, and *.pyc
* Ignore any list of files.
* Only include files nested by depth (default=unlimited)
* Match only files matching (valid regex)
* Sort files alphabetically and load in that order.
* Sort directories alphabetically and load in that order.

```
    - include_vars: 'vars/all.yml'

    - name: include all.yml
      include_vars:
        file: 'vars/all.yml'

    - name: include all yml files in vars/all and all nested directories
      include_vars:
        dir: 'vars/all'

    - name: include all yml files in vars/all and all nested directories and save the output in test.
      include_vars:
        dir: 'vars/all'
        name: test

    - name: include all yml files in vars/services
      include_vars:
        dir: 'vars/services'
        depth: 1

    - name: include only bastion.yml files
      include_vars:
        dir: 'vars'
        files_matching: 'bastion.yml'

    - name: include only all yml files exception bastion.yml
      include_vars:
        dir: 'vars'
        ignore_files: 'bastion.yml'
```

* Added whitelist for file extensisions (yaml, yml, json)

* Removed unit tests in favor of integration tests
8 years ago
René Moser 26118a51f8 exo_dns: new module utils and integration tests for exoscale DNS (#17230) 8 years ago
Michael Scherer e3f54cb798 Add support for become_flags on the task level (#17310)
Working on the test suite, I tried to replace a call to sudo to a
call to su, and found out that I can't change user to 'nobody'
without changing the option become_flags in ansible.cfg

As this would be dependent on the user and the task, it make more sense
to push the setting there.
8 years ago
Michael Scherer 65f1eb8e5c Reduce no longer exist in python3, so we have to use six (#17304) 8 years ago
Michael Scherer adcb87f781 file() function in python3 no longer exist, so use open() (#17303) 8 years ago
Michael Scherer 9245c786db Fix the lines lookup to work on python3 (#17291)
Since stdout is (on python3) of type 'bytes', callbacks
plugins fail in the test suite, because calls backs expect
a string.
8 years ago
Michael Scherer 8f364b549b Fix indexed_items.py to run on python3 (#17292)
On python3, zip is a iterator so we need
to explictily create the list from that.
8 years ago
Senthil Kumar Ganesan f6aa730c3c Utilities to support DELL Networking OS10 command and config modules 8 years ago
Toshio Kuratomi 54d3a977f2 Update submodule refs 8 years ago
Toshio Kuratomi fa804125b5 Python3 fixes and porting (#17271)
* Fix to_native call in selinux_context and selinux_default_context to
  use the error handler correctly.
* Port set_mode_if_different to work on python3
* Port atomic_move to work on python3
* Fix check_password_prompt variable which wasn't renamed properly
8 years ago
Peter Sprygada c16f34bf8e Merge pull request #17279 from privateip/shell
catches timeout error when connecting to remote host in shell
8 years ago
Peter Sprygada 2179677294 Merge pull request #17278 from privateip/nxos
changes nxos method for passing kwargs to get_config()
8 years ago
Peter Sprygada f5df946e6e Merge pull request #17277 from privateip/eos
fixes two bugs in the eos shared module
8 years ago
Peter Sprygada 820260b22d catches timeout error when connecting to remote host in shell
This will now catch a timeout error when shell attempts to open the
connection to the remove device and gracefully raise it as a ShellError
8 years ago
Peter Sprygada 2cb2ba1fe6 changes nxos method for passing kwargs to get_config()
This change makes both the Cli and Nxapi objects handle the get_config()
method consistently the same
8 years ago
Peter Sprygada 5ce032bf6d fixes two bugs in the eos shared module
* fixes issue with correctly returning the running-config over eapi when a
  call was made to get_config()
* fixes issue the MRO in Cli transport
8 years ago
Abhijit Menon-Sen a9d5bf717c Merge pull request #17272 from PeterMartini/typo-fix
Simple documentation typo fix, 'iIf' to 'If'
8 years ago
Tobias Rüetschi 457cf49868 univention: add common code for univention corporate server modules (#16172)
* univention: add common code for univention corporate server modules

* univention: try import only univention specific libraries

* Code Review with @2-B, slight API changes and refactoring.

* Added module documentation overview, describing the provided functions
* Moved module-global objects into getter functions, so that we don't
  need to import possibly-unavailable univention modules at the module level.
* Renamed some exports for improved consistency:

  - module_name()    -> module_by_name()
  - orig_ldap        -> ldap_module()
  - ldap             -> uldap()

Note that this introduces slight API changes from the outside. Instead of
directly accessing module properties, you now have module functions with the
same name. Examples:

   - ansible.module_utils.univention.position_base_dn()
   - ansible.module_utils.univention.config_registry()
   - ansible.module_utils.univention.base_dn()
   - ansible.module_utils.univention.config()

* module_utils univention: fix library

* move module_utils from univention to univention_umc, because python import univention fails if library is called univention

* univention_umc: fix intention

* univention: change common code to BSD-2-clause
8 years ago
Peter Martini 15f10ab4bc Simple documentation typo fix, 'iIf' to 'If' 8 years ago
Brian Coca 4e6a7a9e01 allow include_role to specify vars/defaults files 8 years ago
Peter Sprygada 4b679ffd84 Merge pull request #17265 from privateip/iosxr
fixes iosxr configure method to commit the changes
8 years ago
Brian Coca f25ec5adb3 fix action parsing to avoid conflicts agin 8 years ago
Peter Sprygada bb630f52ff fixes iosxr configure method to commit the changes
The iosxr configure method did not send the commit command to active the
changes after pushed to the remote device.  This change address that problem
8 years ago
Peter Sprygada be55bd6cdf disable prompt timestamps upon successful connection to iosxr 8 years ago
Peter Sprygada 66825f094d Merge pull request #17262 from privateip/iosxr
add commit keyword arg to load_config method
8 years ago
Brian Coca c755ae6a1d updated sub refs 8 years ago
Brian Coca bd9094c925 include_role (role revamp implementation) (#17232)
* attempt #11 to role_include

* fixes from jimi-c

* do not override load_data, move all to load

* removed debugging

* implemented tasks_from parameter, must break cache

* fixed issue with cache and tasks_from

* make resolution of from_tasks prioritize literal

* avoid role dependency dedupe when include_role

* fixed role deps and handlers are now loaded

* simplified code, enabled k=v parsing

used example from jimi-c

* load role defaults for task when include_role

* fixed issue with from_Tasks overriding all subdirs

* corrected priority order of main candidates

* made tasks_from a more generic interface to roles

* fix block inheritance and handler order

* allow vars: clause into included role

* pull vars already processed vs from raw data

* fix from jimi-c blocks i broke

* added back append for dynamic includes

* only allow for basename in from parameter

* fix for docs when no default

* fixed notes

* added include_role to changelog
8 years ago
Peter Sprygada eac7caefd8 add commit keyword arg to load_config method
this adds a new keyword arg to the load_config method that will control
whether or not a loaded configuration is committed on the device
8 years ago
Michael Scherer a30f545a62 Do not convert Nonetype to "None" (#17261)
If someone use a task with a empty name like this:

  - name:
    command: true

This will result in displaying 'None' as a task name instead of
'command'.
8 years ago
Brian Coca 1139d61d59 simplified logic paths 8 years ago
Patrik Lundin b4f338bca7 Add OpenBSD virtualization facts. (#17227)
* Add OpenBSD virtualization facts.

Patch written by @jasperla.

Tested by various people on:
- virtualbox
- vmware esx(i) + fusion
- kvm (smartos + plain linux + a random cloud provider)

This patch is already present in the OpenBSD port of ansible.

* Rework diff to get rid of extra returns.

Requested by @bcoca.

While here, use four-space indentations of all code blocks.

* Set facts even if no match is found.

Discussed with @bcoca.

* Find sysctl via get_bin_path().

Requested by @bcoca.

* Fail if we do not find a sysctl binary.

* Do not fail if a sysctl binary is not found.

Just set empty fact values instead.
Requested by @bcoca.
8 years ago
Abhijit Menon-Sen b4a035718e Make _display_plugin_load much less noisy
There was general consensus that displaying every plugin load on -vvv
was *way* too noisy. This commit reformats the log message to be less
verbose, and drops it down to debugging-only level.
8 years ago
Alexander Stock 238cccf166 Fix "Text file busy" exception in atomic_move (#9526) (#17204)
tempfile.NamedTemporaryFile keeps a file handle causing os.rename() to fail with windows based vboxfs: [Errno 26] Text file busy.
Changed NamedTemporaryFile to mkstemp() and added a finally block to unlink the temp file in each and every case.
8 years ago
Michael Scherer a942758a07 Fix wrong error class (#17259)
AnsibleError is not imported in that file, and since that's
a parsing time issue, better raise AnsibleParserError like the
rest of the file.

Issue signaled on irc by gordon`
8 years ago
Toshio Kuratomi 4a3a9c0f2d Fix for run_command on py3 and enable lineinfile test on py3 (#17257)
* run_command needed a bit of tweaking to its string handling of
  arguments.
* The run_command change fixes the last bit of lineinfile so we can
  enable its tests
8 years ago
Toshio Kuratomi 9ac20e231d Update core submodule to pull in lineinfile py3 fix 8 years ago
Toshio Kuratomi f57f33a8e7 Fix fetch idempotence (#17255)
Fetch always follows symlinks when downloading so it needs to always
follow symlinks when getting the checksum of the file as well.
8 years ago
Peter Sprygada fb9b98a543 Merge pull request #17254 from privateip/netcli
adds new property command_string to Command object
8 years ago
Peter Sprygada 9f1ac47f70 adds new property command_string to Command object
This adds a new property to the Command object that is used to hold
modified command strings that could be different from the command used
to create the object.  This allows for seamless switch between text and
json enabled commands.
8 years ago
Peter Sprygada 5036bba2e0 implements command_string property when preparing commands
* commands that need | json added now use command_string property
* adds additonal keyword args in exception handling for json commands
8 years ago
James Cammarata e375bfd6a5 Use post_validated play for serial calculations in TQM
Fixes #17185
8 years ago
Toshio Kuratomi 0a39700b36 Fix octal output in a few more places (#17250)
Fix filetree lookup plugin for python3 (octal output and selinux API
takes native strings)
8 years ago
Toshio Kuratomi 2dd5e13098 Update submodule refs 8 years ago
Toshio Kuratomi bd68c324ce Get the ssh plugin working with python3 (#17234) 8 years ago
Chris Faulkner dbab23e68f Fix context_demo callback plugin. (#17235) 8 years ago
Yann Autissier 8fd3935029 Fix get_distribution for Alpine Linux (#17224)
To override a generic class that is subclassed based on platform, the
subclass must define platform and distribution.

The load_platform_subclass() calls the get_platform() and
get_distribution() methods to detect the platform and the distribution.

On Alpine Linux, get_distribution() method returns None and it is not
possible to have different implementations based on detected platform.
8 years ago
Abhijit Menon-Sen 3ab9dddb3a Make the extract filter return Undefined on KeyError
groups['x']|map('extract', hostvars, 'somevar') would break if any host
didn't have 'somevar' set. With this change, it will return Undefined
instead. This change permits |map('extract', …)|map('default', 42) to
set a default value in such cases.
8 years ago
Peter Sprygada 24e8e3b03f initial add of shared modules for supporting Nokia SROS devices
This adds a cli transport, netcfg, and netcli implementations for working
with devices running Nokia SROS.  There is also an update to netcfg
to support the sros config file format.
8 years ago
Matt Clay 178292d2cd Fix file and copy modules on py3 and enable tests. (#17239)
- Fix octal formatting of file mode in module response on py3.
- Convert file path to unicode in copy action.
- Enable file and copy module tests for py3 now that they pass.
8 years ago
Toshio Kuratomi 44d979c8f5 Enable most unittests on python3 (just some vault unittests and a logging one left) (#17240)
Make some python3 fixes to make the unittests pass:

* galaxy imports
* dictionary iteration in role requirements
* swap_stdout helper for unittests
* Normalize to text string in a facts.py function
8 years ago
Abhijit Menon-Sen 1a62fe3874 Merge pull request #13739 from chrrrles/ipaddr_empty_string
ipaddr filter properly handle addresses on /31 networks
8 years ago
Peter Sprygada c7924ab04e Merge pull request #17231 from privateip/ios
update ios doc fragments
8 years ago
Peter Sprygada 09eda7e206 update ios doc fragments
removes invalid shared arguments from fragment
8 years ago
Toshio Kuratomi 7b4f808a21 One more izip_longest => zip_longest fix (#17229) 8 years ago
Toshio Kuratomi 51ec35378d xrange and izip_longest aren't available in vanilla python3 (#17226)
Fixes for these are either rewriting to get rid of the need for the
functions or using six.moves to get equivalent functions for both
python2 and python3
8 years ago
Yannig 27b0f3241b new filter human_bytes: convert a string (ex: 1Mo, 1K) into bytes (#12074)
* Rework human_readable and human_to_bytes.
New filter human_to_bytes.

* Fix for python 3.
8 years ago
Ansible Test Runner 733f977ad2 Update submodule refs for more python3 fixes 8 years ago
Nathaniel Case b70e49e749 Relicense module_utils/asa.py (#17223) 8 years ago
Toshio Kuratomi 89f91b1cd7 The former match for a section header included hosts that began with a range. (#17225)
Checking that the line ends with "]" narrows that window somewhat,

Fixes #15331
8 years ago
Toshio Kuratomi 5d865ec1ef Cleanup debug.py (#17222)
* Use isinstance instead of comparing to type.
* Change check against unicode type to check against six.string_types
  for python3 compatibility.
8 years ago
Nathaniel Case 8ac5896889 Provide options for SSH key checking (#15736)
* Provide options for SSH key checking
8 years ago
Peter Sprygada 8f79ea9b1d Merge pull request #17188 from Qalthos/asa_module
Update module_utils/asa.py with NetworkModule
8 years ago
Toshio Kuratomi 300d6482d1 Hashing needs byte strings in python3 (#17221)
First try at porting this passed in string-types as that worked on
python2.  Python3 is more strict so be explicit about converting from
text to bytes
8 years ago
Toshio Kuratomi e098c5ef82 Update submodule refs 8 years ago
Peter Sprygada ce6de1f64d Merge pull request #17220 from privateip/iosxr
updates iosxr shared module
8 years ago
Peter Sprygada fa0d39a1b4 updates iosxr shared module
This completes the refactor of the iosxr 2.2 shared module.  It also
includes the iosxr_config action plugin to be implemented by the
iosxr_config module for 2.2
8 years ago
Chris Houseknecht f717786949 Merge pull request #17202 from chouseknecht/devel
Local variable *choices* referenced before assignment
8 years ago
Toshio Kuratomi 040a38171a Clean up task_executor for python3 (#17219)
ran task_executor through python-modernize and then made changes to the
code pointed out by it:

* Most places where we looped through dict.keys() changed to
      for key in dict:
  Using keys() in python2 creates a list() of keys.  For iterating, we
  can iterate over the dict itself and we'll be handed back each key.
  In python3, doing it this way does not create a new list and thus is
  more memory efficient.
* In one place, use:
      for key in list(dict.keys()):
  because we're deleting elements from the dictionary inside of the
  loop.  So we really do need to iterate over a separate list of the
  keys to avoid modifying the dictionary that we're iterating over.
  (Fixes Python3 bug)
* In one place, change the order of an if-elif-else tree so that the
  most frequent cases are evaluated first. (Optimization)
8 years ago
Peter Sprygada 90ef5bf4a6 updates vyos shared module and moves functions into vyos_config
This update moves many of the functions into the vyos_config
module to conform with the network 2.2 refactor.  This also
fixes the load_config method
8 years ago
Toshio Kuratomi 72cda8ffd7 Update submodule refs 8 years ago
Toshio Kuratomi 58b9f637a1 Workaround for Ubuntu Python3 looking for modules in wrong places (#17211)
* Workaround for Ubuntu Python3 looking for modules in wrong places

* More exact ubuntu version numbers
8 years ago
nitzmahone a9322e8b8b py3-friendly multi-exception fix for missing fileno under debugger 8 years ago
Adrian Likins e396d5d508 Implement vault encrypted yaml variables. (#16274)
Make !vault-encrypted create a AnsibleVaultUnicode
yaml object that can be used as a regular string object.

This allows a playbook to include a encrypted vault
blob for the value of a yaml variable. A 'secret_password'
variable can have it's value encrypted instead of having
to vault encrypt an entire vars file.

Add __ENCRYPTED__ to the vault yaml types so
template.Template can treat it similar
to __UNSAFE__ flags.

vault.VaultLib api changes:
    - Split VaultLib.encrypt to encrypt and encrypt_bytestring

    - VaultLib.encrypt() previously accepted the plaintext data
      as either a byte string or a unicode string.
      Doing the right thing based on the input type would fail
      on py3 if given a arg of type 'bytes'. To simplify the
      API, vaultlib.encrypt() now assumes input plaintext is a
      py2 unicode or py3 str. It will encode to utf-8 then call
      the new encrypt_bytestring(). The new methods are less
      ambiguous.

    - moved VaultLib.is_encrypted logic to vault module scope
      and split to is_encrypted() and is_encrypted_file().

Add a test/unit/mock/yaml_helper.py
It has some helpers for testing parsing/yaml

Integration tests added as roles test_vault and test_vault_embedded
8 years ago
nitzmahone dbf7df4439 fix pycharm debugger issue on missing fileno
Under pycharm debugger, stdin has no fileno, but throws AttributeError instead of ValueError. Account for both.
8 years ago
Peter Sprygada 2a61fa0e79 Merge pull request #17200 from privateip/netcfg
removes invoke method from Config class
8 years ago
chouseknecht fdb5ecd7d1
Fixes 'choices referenced before assignment' error on line #287. 8 years ago
Toshio Kuratomi a22909c226 Migrate basestring to a python3 compatible type (#17199) 8 years ago
Peter Sprygada af05a13854 removes invoke method from Config class
this removes the invoke method which was lingering from before
we separated netcfg into its own module
8 years ago
Yannig 92c6283e93 Add speed link in gathered facts for Linux. (#15347) 8 years ago
Adrian Likins 8bbbe16d31 try/except xmltodict import, misc cleanups (#16287)
The 'import xmltodict' was causing import
errors when generating documentation. Since
xmltodict is a required but not stdlib module,
throw AnsibleError if unable to import.

Remove unused combine_vars.

Replace a use of 'stdin_iterator == None' with
idiomatic 'stdin_iterat is None'

Misc pep8 cleanups.
8 years ago
Adrian Likins 71118b2720 Show where plugins were loaded in vvv/vvvv (#15757)
Make the plugin loading info displayed by callback plugins
match.

In debug mode (ANSIBLE_DEBUG=1 env), log all requests for
plugins including already cached plugins and class_only
requests.
8 years ago
Nathaniel Case f5ff3e3add Remove abort_config and commit_config
Also move unimplemented command methods to CliBase, where they can be overridden
as needed
8 years ago
Toshio Kuratomi 76f9935634 Add some missing imports from last night's py3 fixes (#17196) 8 years ago
Adrian Likins 0b070a04d0 Fix docstring for GenericBsdIfconfogNetwork. (#17008)
default_ipv4/default_ipv6 and type/mtu/network
were listed as not defined, but they are usually
defined now.
8 years ago
Toshio Kuratomi f4f84639bb Update submodule refs 8 years ago
Michael Scherer b2476e7d99 Fix errors when using -vvvv with python 3 (#17186)
Traceback (most recent call last):
      File "/tmp/ansible_tpehdgt7/ansible_module_setup.py", line 134, in <module>
        main()
      File "/tmp/ansible_tpehdgt7/ansible_module_setup.py", line 124, in main
        supports_check_mode = True,
      File "/tmp/ansible_tpehdgt7/ansible_modlib.zip/ansible/module_utils/basic.py", line 696, in __init__
      File "/tmp/ansible_tpehdgt7/ansible_modlib.zip/ansible/module_utils/basic.py", line 1670, in _log_invocation
      File "/tmp/ansible_tpehdgt7/ansible_modlib.zip/ansible/module_utils/basic.py", line 469, in heuristic_log_sanitize
    TypeError: 'str' does not support the buffer interface
8 years ago
Marius Gedminas 73caff58e8 Add missing to_unicode import 8 years ago
Marius Gedminas 483c83b088 There's no ansible.module_utils_unicode 8 years ago
Toshio Kuratomi 313d4b2c9e Move a path being passed around as a byte string to being passed around as a text string. (#17190)
This is enough to get minimal copy module working on python3

We have t omodify dataloader's path_dwim_relative_stack and everything
that calls it to use text paths instead of byte string paths
8 years ago
Peter Sprygada 20bde8f549 Merge pull request #17189 from privateip/eos
updates eos shared module
8 years ago
Peter Sprygada b5bbac29e5 updates eos shared module
* adds support for netcli methods
* adds support for netcfg methods
* Cli class now derives from CliBase
* adds eos_config action plugin
8 years ago
Toshio Kuratomi 57701d7115 Give native strings to selinux library functions. (#17184)
* Give native strings to selinux library functions.

SELinux takes pathnames as native strings.  That means we need to
convert to bytes on python2 and convert to text on python3.

Fixes #17155

* Read kitchen documentation, make module_utils params more like kitchen API

* Remove none nonstring strategy and add strict
* Raise TypeError on invalid nonstring strategy

* Document to_native()

* Make unittests for testing module_utils.text
8 years ago
Nathaniel Case a35296a42d Common CliBase run_commands implementation 8 years ago
Nathaniel Case f4a6fa1747 Rewrite asa.py for NetworkModule 8 years ago
Toshio Kuratomi 384a01fcff Fix tmpfile misspelled as tmplfile (#17183) 8 years ago
Adrian Likins a4785c2691 Fix docker connection plugin version tests and py2.6 compat (#16841)
* Rm py2.7+ code in docker connection plugin

The docker connection plugin was using subprocess.check_output
which only exists in python 2.7 and later. Connection plugins
need to support python2.6 so this replaces it with Popen/communicate()

* Handle docker ver errors in docker connection

Add unit tests for DockerConnection

Fixes #16971
8 years ago
Peter Sprygada 7ce4165671 Merge pull request #17173 from privateip/ios
minor update to the ios shared module
8 years ago
Peter Sprygada 301495ddcc Merge pull request #17172 from privateip/nxos
updates nxos shared module refactor
8 years ago
Brian Coca 54c530a3ee more ways to detect lxc
thanks to @wAmpire for new method and pointing out limitations of existing
8 years ago
Peter Sprygada 1015f11428 minor update to the ios shared module
This completes the refactor for the ios shared module to change
the derived class from NetCli to CliBase.
8 years ago
Peter Sprygada 4ab4b6698d updates nxos shared module refactor
This commit updates the nxos transport shared plugins for
2.2.  This includes updates to both Cli and Nxapi.  This commit
also includes the nxos_config action plugin
8 years ago
Peter Sprygada 321d2e8cee Merge pull request #17168 from privateip/clibase
replaces NetCli in network with CliBase in shell
8 years ago
Peter Sprygada 044a0533db replaces NetCli in network with CliBase in shell
This doesn't change any of the behavior but moves NetCli to CliBase and
relcates the object to the shell module
8 years ago
Toshio Kuratomi 171a094805 Cleanup basic.py code now that six is available (#17158)
* Cleanup basic.py code now that six is available

We had some hacks in basic.py to allow us python2 and python3
compatibility.  Those can now be offloaded to the six library that we're
bundling.

* Cleanup basic.py code now that six is available

We had some hacks in basic.py to allow us python2 and python3
compatibility.  Those can now be offloaded to the six library that we're
bundling.
8 years ago
Peter Sprygada 959a5e5fd1 Merge pull request #17166 from privateip/ios
fix import statement in ios shared module
8 years ago
Peter Sprygada 388f98437e Merge pull request #17165 from privateip/network
fix broken import statement from netcli rename
8 years ago
Peter Sprygada 53abcb23fa rename netcmd module to netcli
This is part of the 2.2 refactor to extract the Cli class into a
separate module.  This renames netcmd to netcli which is consistent
with the network shared modules implementations
8 years ago
Peter Sprygada 7cb2c31b1a fix import statement in ios shared module
This fixes the import statement when netcmd was renamed to netcli
8 years ago
Peter Sprygada ac8b8f0b8b fix broken import statement from netcli rename
The network module needed to be updated with the correct module name
when netcmd was renamed to netcli
8 years ago
Peter Sprygada f53dbec55a removes Cli and Config objects from network into separate modules
This completes the refactor of Cli and Config moving them into separate
modules netcmd and netcfg respectively.
8 years ago
Peter Sprygada 24c6443557 removes functions from ios module
This removes top level functions from the ios module and moves them
into the specific modules.  This update also includes some clean up
of the Cli transport
8 years ago
Peter Sprygada 90747e6d2f Merge pull request #17161 from privateip/netcmd
moves Cli and Command class from network to netcmd module
8 years ago
Peter Sprygada 7c928e878b moves Cli and Command class from network to netcmd module
This restructure moves the Cli object to netcmd and includes a roll up
of inor bugfix updates to CommandRunner

* CommandRunner now only allows one instance of a command in the stack and
  raise an exception if a duplidate command is detected
* CommandRunner now caches returns based on command and output
* CommandRunner is not responsible for creating Command instances
8 years ago
Adrian Likins 7d41f623dd Move py34 mock_open compat to compat/test/mock (#17157)
test/units/plugins/action/test_action.py had code
for handling a bug in python 3.4's mock_open that
causes errors when reading binary data.

Moved to compat/tests/mock.py so other tests can
use it by default.
8 years ago
Peter Sprygada fa395bee7b Merge pull request #17149 from privateip/plugin-net-config
action plugin net_config will now remove any private result key
8 years ago
Peter Sprygada d50ef4446f action plugin net_config will now remove any private result key
This update will now remove any keys from results that are created using
the private names.  Private names are identified as double underscore (__)
on either side of the key name
8 years ago
Peter Sprygada 112f14866a pull Config object out of network and into netcfg
This moves the Config class from network and into netcfg module with
no added features.  This is simply a reorganization of code.
8 years ago
Dusty Mabe b817f1f3ea actions/unarchive: fix unarchive from remote url (#17126)
* actions/unarchive: fix unarchive from remote url

Currently unarchive from remote url does not work because the core
unarchive module was updated to support 'remote_src' [1], but the
unarchive action plugin was not updated for this. This causes failures
because the action plugin assumes it needs to copy a file to the
remote server, but in the case of downloading a file from a remote
url a local file does not exist, so an error occurs when the file is
not found.

[1] https://github.com/ansible/ansible-modules-core/commit/467516e

* test_unarchive: fix test with wrong remote_src use

The non-ascii filenames test had improperly set remote_src=yes even
though it was actually copying the file from the local machine (i.e.
the file did not already exist remotely). This test was passing
until the remote_src behavior of unarchive was fixed in 276550f.
8 years ago
James Cammarata 890e096b2b Clean up PlaybookExecutor logic for batches and errors
The calculation for max_fail_percentage was moved into the linear
strategy a while back, and works better there in the stategy layer
rather than at the PBE layer. This patch removes it from the PBE layer
and tweaks the logic controlling whether or not the next batch is run.

Fixes #15954
8 years ago
Toshio Kuratomi cb3653295f Update submodule refs 8 years ago
Brian Coca 4fb09d5693 moved from extras repo where it incorrectly exists (#17124)
* moved from extras repo where it incorrectly exists

* added to sanity exclusion for 2.4

* changed license with author's consent
8 years ago
Toshio Kuratomi bd31cc096a Fix facts.py for python3 (#17131)
* Fix facts.py for python3

* Update facts unittest to account for filepaths being byte strings
8 years ago
Adrian Likins 7bd57acda4 Linux mount/fs (lsblk) facts fixes and tests. (#17036)
Fixes #10779

Refactor some of the block device, mount point, and
mtab/fstab facts collection for linux for better
performance on systems with lots of block devices.

Instead of invoking 'lsblk' for every entry in mtab,
invoke it once, then map the results to mtab entries.

Change the args used for invoking 'findmnt' since the
previous combination of args conflicts, so this would
always fail on some systems depending on version.

Add test cases for facts Hardware()/Network()/Virtual() classes
__new__ method and verify they create the proper subclass based
on the platform.system() results.

Split out all the 'invoke some command and grab it's output'
bits related to linux mount paths into their own methods so
it is easier to mock them in unit tests.

Fix the DragonFly* classes that did not defined a 'platform'
class attribute. This caused FreeBSD systems to potentially
get the DragonFly* subclasses incorrectly. In practice it
didnt matter much since the DragonFly* subclasses duplicated
the FreeBSD ones. Actual DragonFly systems would end up with
the generic Hardware() etc instead of the DragonFly* classes.

Fix Hardware.__new__() on PY3, passing args to __new__
would cause "object() takes no parameters" errors. So
check for PY3 and just call __new__ without the args

See
https://hg.python.org/cpython/file/44ed0cd3dc6d/Objects/typeobject.c#l2818
for some explaination.
8 years ago
nitzmahone 9fedcdfc47 bump extras submodule ref 8 years ago
nitzmahone 88c36bbc34 bump submodule refs 8 years ago
James Cammarata b617d62203 Don't use an unset playbook basedir when searching for hostgroup vars
The flag new_pb_basedir is not being utilized in Inventory._get_hostgroup_vars,
leading to the situation where an inventory with no playbook basedir set will
read host/group vars from the $CWD, regardless of the inventory and/or playbook
relative location. This patch corrects that by not using the playbook basedir
if it is unset (None).

This patch also corrects a bug in which the VariableManager would accumulate
host/group vars files, which could lead to incorrect vars files being used when
playbooks are run from different directories containing their own group/host vars
directories.

Fixes #16953
8 years ago
James Cammarata 732d722a7f Catch a missing include_vars filename
Related to ansible/ansible-modules-core#4445
8 years ago
Matt Davis e0bdb502e3 raw now returns changed: true (#17112)
for consistency w/ shell/command/script "non-idempotent" modules.

Updated tests, changelog.
8 years ago
James Cammarata f4237b2151 Rework the way params are assigned to TaskIncludes when they're dynamic
Copying the TaskInclude task (which is the parent) before loading the blocks
makes the code much more simple and clean, and fixes a bug introduced during
the performance improvement changes (and specifically the change which moved
things to a single-parent model).

Fixes #17064
8 years ago
Nathaniel Case cada4fb8d1 Relicense netcfg.py to BSD (#17110)
As with #17025. The caveat regarding machilde's (now obsoleted) commit has been addressed, so netcfg.py is able to be easily relicensed.
8 years ago
Brian Coca 297e2d8266 added bits and bytes arg types (#17102)
* added bits and bytes arg types

* changed function alias method as per feedback

* use enumerate vs managing i myself
8 years ago
Brian Coca 5fe9d3c3d5 make parsed param private and explicit (#17104)
* make parsed param private and explicit

* fixed missed parsed
8 years ago
Ryan S. Brown 30268f6bd0 Pass keyword arguments from modules to _boto3_conn 8 years ago
James Tanner f62df4e78d Update submodule refs 8 years ago
James Cammarata f722d41eab Allow notifies to be sent to the top level includes when they were static
Since we introduced static includes in 2.1, this broke the functionality
where a notify could be sent to a named include statement, triggering all
handlers contained within the include. This patch fixes that by adding a
search through the parents of a handler for any TaskIncludes which match.

Fixes #15915
8 years ago
Ryan Brown c5cc6edb93 Merge pull request #16606 from ryansb/rds-cluster-inventory-aioue
Support RDS clusters in AWS dynamic inventory script
8 years ago
David Shrewsbury bf8c871801 Fix async logic when parsing fails (#17091)
We want to NOT consider the async task as failed if the result is
not parsed, which was the intent of:

  https://github.com/ansible/ansible/pull/16458

However, the logic doesn't actually do that because we default
the 'parsed' value to True. It should default to False so that
we continue waiting, as intended.
8 years ago
James Tanner 1f5552f586 Update submodule refs 8 years ago
James Cammarata daf6eb97d3 Make sure includes for handlers in roles look in the correct subdir 8 years ago
Brian Coca 64a8d24b72 slightly better presentation docs
- description items are now separated
- choices/defaults start at their own line
8 years ago
Brian Coca 4c034fd002 updated container detection to new lxc (#17063)
fixes #17030
8 years ago
Peter Sprygada 8620fda947 Merge pull request #17077 from agaffney/junos_doc_fix
Update junos docs fragment to note the default port for transport=netconf
8 years ago
James Cammarata 3c65c03a67 Changing license on module_utils/splitter.py to BSD 8 years ago
Andrew Gaffney fdabfb6821 Update junos docs fragment to note the default port for transport=netconf 8 years ago
James Cammarata c669a381d1 Don't immediately return failed for any_errors_fatal tasks
Instead of immediately returning a failed code (indicating a break in
the play execution), we internally 'or' that failure code with the result
(now an integer flag instead of a boolean) so that we can properly handle
the rescue/always portions of blocks and still remember that the break
condition was hit.

Fixes #16937
8 years ago
Dag Wieers cb5675a29f Remove a useless section, only act on 'shell' (#16205) 8 years ago
Matt Clay 4cee67452b Update submodule refs. 8 years ago
jctanner da23700b15 Update submodule refs (#17062) 8 years ago
Dag Wieers 56148291e9 Emit warnings when safe_eval() raises a SyntaxError or other Exception (#14304)
This change is related to reported issue #14291 and pull request #14293.

Without the fix from #14293, this change will emit a warning as shown below, on the following playbook:

``yaml
---
- hosts: localhost
  gather_facts: no
  vars:
    works:
      key1: 'string'
      key2: 1234
    fails:
      key1: 'string'
      key2: 1234
      key3: false
  tasks:
  - debug: msg={{ works | to_json }}
  - debug: msg={{ fails | to_json }}
```

On error, this results in a proper warning:

```
[dag@moria ansible.dag]$ ansible-playbook test49.yml

PLAY ***************************************************************************

TASK [debug] *******************************************************************
ok: [localhost] => {
    "msg": {
        "key1": "string",
        "key2": 1234
    }
}

TASK [debug] *******************************************************************
 [WARNING]: Error in expression "{"key3": false, "key2": 1234, "key1": "string"}". (name 'false' is not defined)

ok: [localhost] => {
    "msg": "{\"key3\": false, \"key2\": 1234, \"key1\": \"string\"}"
}

PLAY RECAP *********************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0
```
8 years ago
Dag Wieers 1268f4778d Introduce new 'filetree' lookup plugin (#14332)
* Introduce new 'filetree' lookup plugin

The new "filetree" lookup plugin makes it possible to recurse over a tree of files within the task loop. This makes it possible to e.g. template a complete tree of files to a target system with little effort while retaining permissions and ownership.

The module supports directories, files and symlinks.

The item dictionary consists of:
 - src
 - root
 - path
 - mode
 - state
 - owner
 - group
 - seuser
 - serole
 - setype
 - selevel
 - uid
 - gid
 - size
 - mtime
 - ctime

EXAMPLES:
Here is an example of how we use with_filetree within a role:

```yaml
 - name: Create directories
   file:
     path: /web/{{ item.path }}
     state: directory
     mode: '{{ item.mode }}'
     owner: '{{ item.owner }}'
     group: '{{ item.group }}'
     force: yes
   with_filetree: web/
   when: item.state == 'directory'

 - name: Template complete tree
   file:
     src: '{{ item.src }}'
     dest: /web/{{ item.path }}
     state: 'link'
     mode: '{{ item.mode }}'
     owner: '{{ item.owner }}'
     group: '{{ item.group }}'
   with_filetree: web/
   when: item.state == 'link'

 - name: Template complete tree
   template:
     src: '{{ item.src }}'
     dest: /web/{{ item.path }}
     mode: '{{ item.mode }}'
     owner: '{{ item.owner }}'
     group: '{{ item.group }}'
     force: yes
   with_filetree: web/
   when: item.state == 'file'
```

SPECIAL USE:
The following properties also have its special use:

 - root: Makes it possible to filter by original location
 - path: Is the relative path to root
 - uid, gid: Makes it possible to force-create by exact id, rather than by name
 - size, mtime, ctime: Makes it possible to filter out files by size, mtime or ctime

TODO:
 - Add snippets to documentation

* Small fixes for Python 3

* Return the portion of the file’s mode that can be set by os.chmod()

And remove the exists=True, which is redundant.

* Use lstat() instead of stat() since we support symlinks

* Avoid a few possible stat() calls

* Bring in line with v1.9 and hybrid plugin

* Remove glob module since we no longer use it

* Included suggestions from @RussellLuo

- Two blank lines will be better. See PEP 8
- I think if props is not None is more conventional 😄

* Support failed pwd/grp lookups

* Implement first-found functionality in the path-order
8 years ago
jctanner 39d764c7ad Restore previous behavior of ignoring missing files via with_fileglob (#17053)
Fixes #16801
8 years ago
James Cammarata 925b0ff9e9 cleaning up some debug statements in _queue_task() 8 years ago
James Cammarata 1c7e0c73c9 Several fixes for includes
* when including statically, make sure that all parents were also included
  statically (issue #16990)
* properly resolve nested static include paths
* print a message when a file is statically included

Fixes #16990
8 years ago
Toshio Kuratomi 854d47826c Fix classes that select a subclass based on platform (#17034)
When unittesting this we found that the platform selecting class
hierarchies weren't working in all cases.  If the subclass was directly
created (ie: LinuxHardware()), then it would use its inherited __new__()
to try to create itself.  The inherited __new__ would look for
subclasses and end up calling its own __new__() again.  This would
recurse endlessly.  The new code detects when we want to find a subclass
to create (when the base class is used, ie: Hardware()) vs when to
create the class itself (when the subclass is used, ie:
LinuxHardware()).
8 years ago
John R Barker b82d150c42 Add missing version_added (#17050)
A number of new arguments were added in
637bbdadfa (diff-60710cdc60751ecd19968b01b98283a0)
but not documented
8 years ago
James Cammarata 68d44e48ba Remove sleeps and rely on regular queue options to process results 8 years ago
Peter Sprygada 7579df33ce Merge pull request #17032 from Qalthos/net_mod_nxos
Update NXOS to NetworkModule
8 years ago
Nathaniel Case 1ced3bfc25 NXOS changes
This refactors the nxos module to implement the classes from the
network common module.
8 years ago
James Cammarata 47acf55fa9 Cache tasks by uuid in PlayIterator for O(1) lookups
Rather than repeatedly searching for tasks by uuid via iterating over
all known blocks, cache the tasks when they are added to the PlayIterator
so the lookup becomes a simple key check in a dict.
8 years ago
Nathaniel Case 125c53e691 Relicense low-hanging fruit to BSD (#17025) 8 years ago
Victor Volle c9d2a67ec7 16888: comment module_utils/urls.py (#16987)
* 16888: comment module_utils/urls.py

* improved documentation of module (mentioning ‘requests’)

* remove mentioning of implementation details (urllib)

* improved parameter and return value documentation
8 years ago
James Cammarata 57fca2dde2 Validate new blocks during copy
It is possible that a block is copied prior to validation, in which case
some fields (like when) which should be something other than a string might
not be. Using validate() in copy() is relatively harmless and ensures the
blocks are in the proper structure.

This also cleans up some of the finalized logic from an earlier commit and
adds similar logic for validated.

Fixes #17018
8 years ago
Rene Moser 543f266801 update submodule refs, fixes build in ansible-modules-extras 8 years ago
Brian Coca 47e3366744 fixed indent 8 years ago
Brian Coca ea033ae2cc removed extraneous test code 8 years ago
Brian Coca eb0c90ab80 added unsafe_writes as common file feature (#17016) 8 years ago
James Cammarata 7503875ed7 Mark playbook objects as finalized after post_validate
After post_validate() is called on an object, there should be no
need to continue looking up at parent attributes. This patch adds a
new flag (_finalized) which is set to True at the end of post_validate,
and getattr will not look beyond its own attributes from that point on.
8 years ago
Peter Sprygada 375f7c515a Merge pull request #16978 from caphrim007/feature.add-module-doc-fragments-for-f5-modules
Adds module doc fragment for F5 modules
8 years ago
Peter Sprygada 29c76be768 Merge pull request #16999 from Qalthos/net_mod_ops
OpenSwitch to NetworkModule
8 years ago
Peter Sprygada 7720caadde Merge pull request #17006 from Qalthos/net_mod_ios
Clean up module_utils.ios
8 years ago
Dag Wieers 718f431466 Allow to make the jsonfile cache files pretty (indented and sorted) (#17000)
* Allow to make the jsonfile cache files pretty (indented and sorted)

Since the json cache files are condensed, it is not very practical to look for something in them. Having indented/sorted cache files makes debugging and playbook/inventory development a lot easier to do.

I made it configurable in case people would object to the performance hit this would have, but to be honest, then they probably should be looking at other cache plugins instead IMO.

* Removed the config option and documentation changes
8 years ago
James Cammarata e244895174 Avoid copying task parents in TaskExecutor
As Block.copy() is potentially expensive, avoid copying the parent
structure of tasks in TaskExecutor.
8 years ago
James Cammarata 06d4f4ad0e Move tasks/blocks to a single parent model 8 years ago
James Cammarata d2b3b2c03e Performance improvements 8 years ago
Brian Coca ce282e9373 correctly detect action
named matched only cause i set it to the same in my tests
fixes #14857
8 years ago
Toshio Kuratomi 152a2b9b8f Update submodule refs 8 years ago
Nathaniel Case 85706a704c Update IOS with new NetworkModule 8 years ago
Toshio Kuratomi 38ccd11cce Fix from @jimi-c to use task_vars when polling async tasks. (#17003)
This is needed so that async_status can use ansible_python_interpreter
for the host being contacted.

Fixes #14101
8 years ago
Erik Berg ab678738d6 Add partition uuid to facts for Linux. (#16986)
Works by looking for partition name in /dev/disk/by-uuid
8 years ago
Filipe Niero Felisbino e54a9d3a51 Add generic data structures querying (#13684)
* Query lookup plugin

* Add license and docstrings

* Add python3-ish imports

* Change query plugin type from lookup to filter

* Switch from dq to jsonpath_rw

* Add integration test for query filter

* Rename query filter to json_query

* Add jsonpath-rw

* Rename query filter to json_query

* Switch query implementation from jsonpath-rw to jmespath
8 years ago
Nathaniel Case 9b4455e33a OpenSwitch Cli & most of Rest 8 years ago
Adrian Likins f21df311bc Fix hipchat callback "has no attribute display'" (#16998)
Use self._display for access to display object for
the hipchat callback plugin.

Fixes #16946
8 years ago
Matt Clay 72cca01cd4 Use file list, not recursion, in _fixup_perms. (#16924)
Run setfacl/chown/chmod on each temp dir and file.

This fixes temp file permissions handling on platforms such as FreeBSD
which always return success when using find -exec. This is done by
eliminating the use of find when setting up temp files and directories.

Additionally, tests that now pass on FreeBSD have been enabled for CI.
8 years ago
Matt Clay e07fbba0a5 Add missing boilerplate code. (#16980) 8 years ago
Tim Rupp 5f34206b0a Adds module doc fragment for F5 modules
To reduce documentation duplication, this module fragment is
being created for use in all F5 modules.
8 years ago
Matt Clay 2dc8d80dc5 Update submodule refs. 8 years ago
James Pic d2438b6b6b Debug output callback (#16839)
* Added debug output callback

* Better import

* Comment on line
8 years ago
Toshio Kuratomi 408664b532 Update submodule refs 8 years ago
James Cammarata 1714279b5e Tweak the way the debug strategy imports the linear strategy parent
Due to the way we load plugins, internally to Python there can be issues when
the debug strategy is loaded after the linear strategy. To work around this,
we're changing the import line for the linear strategy to avoid the problem.

Related to #16825
8 years ago
Toshio Kuratomi 6db6edfc4f YAML treats some unquoted strings as booleans. For instance, (#16961)
uri:
    follow_redirects: no

Will lead yaml to set follow_redirects=False.  This is problematic when
the module parameter is not a boolean value but a string.  For instance:

  follow_redirects = dict(required=False, default='safe', choices=['all', 'safe', 'none', 'yes', 'no']),

Our parameter validation code ends up getting follow_redirects="False"
instead of "no".  The 100% fix is for the user to quote their strings in
playbooks like:
  uri:
    follow_redirects: "no"

But we can fix quite a few common cases by trying to switch "False" back
into the string that it was specified as.  We only do this if there is
only one correct choices value that could have been specified.  In the
follow_redirects example, a value of "True" only maps back to "yes" and
a value of "False" only maps back to "no" so we can do this.  If choices
also contained "on" and "off" then we couldn't map back safely and would
need to force the module author to change the module to handle this
case.

Fixes parts of the following PRs:

* https://github.com/ansible/ansible-modules-core/pull/4220
* https://github.com/ansible/ansible-modules-extras/pull/2593
8 years ago
Toshio Kuratomi 1ecf51d87e * Fix race in creating temp directories pre-fork (#16965)
* These can still race when multiple ansible processes are created at
    the same time.
* Reverse order of expanduser and expandvars in unfrakpath(). So that
  tildes in environment variables will be handled.
8 years ago
Matt Davis 746ea64d30 fix for unspecified retries on until + test (#16963)
fixes #16907
8 years ago
Brian Coca bced8715cd add transparent vault use to other plugins (#16957)
assemble, script and unarchive (copy already had it).
8 years ago
Will Thames eb2a3a91a8 task_result _check_key should handle empty results (#16766)
When a task result has an empty results list, the
list should be ignored when determining the results
of `_check_key`. Here the empty list is treated the
same as a non-existent list.

This fixes a bug that manifests itself with squashed
items - namely the task result contains the correct
value for the key, but an empty results list. The
empty results list was treated as zero failures
when deciding which handler to call - so the task
show as a success in the output, but is deemed to
have failed when deciding whether to continue.

This also demonstrates a mismatch between task
result processing and play iteration.

A test is also added for this case, but it would not
have caught the bug - because the bug is really in
the display, and not the success/failure of the
task (visually the test is more accurate).

Fixes ansible/ansible-modules-core#4214
8 years ago
Ryan Brown 4f7996fbc1 Merge pull request #16879 from alikins/gce_module_utils
Fix import of gce/gcdns without a libcloud module
8 years ago
James Cammarata 159aa26b36 FEATURE: adding variable serial batches
This feature changes the scalar value of `serial:` to a list, which
allows users to specify a list of values, so batches can be ramped
up (commonly called "canary" setups):

- hosts: all
  serial: [1, 5, 10, "100%"]
  tasks:
  ...
8 years ago
ovcharenko f326e49d75 Fix for issue @synchronize doesn't substitute variables properly #16347 (#16349)
* Fix for issue @synchronize doesn't substitute variables properly #16347
8 years ago
Hidetoshi Hirokawa 595946b80e Fix the security rules name duplication of azure_rm_common. (#16897) 8 years ago
victoru 14901b65d9 raise AnsibleError in hashi_vault lookup plugin when hvac module is not installed (#16859) 8 years ago
Brian Coca 7ea56e1c79 optimize booleanifycation 8 years ago
Brian Coca b0786a1845 actually skip bad/broken module files found 8 years ago
Brian Coca 98c149859a added y/n to list of module booleans 8 years ago
Brian Coca 27691991c3 refactored ethtool data to allow for other callers 8 years ago
Brian Coca f7570f1dc4 Implicit localhost ondemand (#16900)
* Revert "There can be only one localhost"

This reverts commit 5f1bbb4fcd.
this broke several usages of localhost, see #16882, #16898 and #16886

* ensure there is only 1 localhost

fixes #16886, #16882 and #16898

- make sure localhost exists before returning it
- optimzed host caching
- ensure we always return a host object
8 years ago