Commit Graph

2037 Commits (fda131504b571b4bb2fe3dafe9291e18d00a3ca6)

Author SHA1 Message Date
Matt Clay 1293ec85dd Convert unit test yield to pytest parametrize. 8 years ago
Matt Clay 46f9648aa1 Fix type() usage check in validate-modules.
This avoids false positives when 'if' or 'or' are in a string
preceding the use of type() on the same line.
8 years ago
Marius Gedminas 2efb692cc4 known_hosts: support --diff (#20349)
* known_hosts: support --diff

* known_hosts: support --diff also without --check

* Add unit tests and fix incorrect diff in one corner case

Tests are good!

* Refactor for readability

* Python 3 compat

* More Python 3 compat

* Add an integration test for known_hosts

* Handle ssh-keygen -HF returning non-zero exit code

AFAICT this is a bug in ssh-keygen in some newer OpenSSH versions
(>= 6.4 probably; see commit dd9d5cc670):
when you invoke ssh-keygen with -H and -F <host> options, it always
returns exit code 1.  This is because in ssh-keygen.c there's a function
do_known_hosts() which calls

  exit (find_host && !ctx.found_key);

at the end, and find_host is 1 (because we passed -F on the command line),
but ctx.found_key is always 0.  Why is found_key always 0?  Because the
callback passed to hostkeys_foreach(), which is known_hosts_hash(),
never bothers to set found_key to 1.

* This test does not need root

* Avoid ssh-ed25519 keys in sample known_hosts file

Older versions of OpenSSH do not like them and ssh-keygen -HF
aborts with an error when it sees such keys:

  line 5 invalid key: example.net...
  /root/ansible_testing/known_hosts is not a valid known_hosts file.

* Fix Python 3 errors

Specifically, the default mode of tempfile.NamedTemporaryFile is 'w+b',
which means Python 3 wants us to write bytes objects to it -- but the
keys we have are all unicode strings.
8 years ago
Gaurav Rastogi 798972c72a Avi Networks Ansible modules. (#20415)
* Avi Networks Ansible modules.
Avi Version: 16.3.4

* Fixed Review comments
1. Changed description to be full sentences
2. Fixed Pep8 warnings.
3. Fixed comments and descriptions.

* 1. Fixed descriptions and messages as per review comments.
2. Added descriptions for the missing parameters.

* Fixed the shippable break due to the incorrect description format

* Removed the extra modules so that there is a single module for the first commit

* Updated license to BSD based on review comments

* updated comments based on review feedback

* Refactored code to handle POST and PUT scenarios where playbook does not need to check whether object is present.
Moved ansible helper utilities to module_utils as now roles can be patched with module_utils as well.

* fixed pep8 warnings
8 years ago
Matt Clay f16ee2841b Add retries to Shippable CI scripts. (#21108)
* Add retry.py for auto-retry in CI scripts.
* Add retries to other and units CI scripts.
8 years ago
Matt Clay 189fee4853 Fix vyos unit tests. 8 years ago
Ricardo Carrillo Cruz 0adca6b7d4 Set block indentation to 1 on iosxr templates (#21105)
Network devices in the lab have by default an indentation of 1 for
sub-sections, and so does the netcfg.NetworkConfig constructor
indent param.
This will fix reported issue 21055, and make the integration tests
to pass.

Fixes #21055
8 years ago
Adrian Likins 174961b945 Fix action test (#21102)
* update _parse_returned_data for no _ansible_parsed

_parse_returned_data no longer adds _ansible_parsed

* pep8 cleanups
8 years ago
Adrian Likins 7278308ca2 Redhat subscription (#20729)
* Make unused redhat_subscriptions do something

rhsm_baseurl/server_insecure were module params that were
never used previously. Hook them up for register options.

* pep8/style cleanups
* Set a module scope SUBMAN_CMD before we ref it as a global
* move ansible imports to top, remove '*' imports
* remove redhat_subscriptions from pep8 legacy
8 years ago
Nathaniel Case 530701b398 Vyos system module (#21060)
* vyos_system tests

* Merge vyos_system fixture with vyos_config fixture
8 years ago
Adrian Likins 5766689dd5 More unit tests for plugins/action/ (#20887) 8 years ago
Matt Martz 5942de603d Legacy pep8 clean fixes for contrib and hacking (#21081) 8 years ago
Brian Coca c86a17b7a0 refactoring async
- centralized skipping
- also fixed module name broken by previous refactor
- let action modules handle async processing
- moved async into base action class's module exec
- action plugins can now run final action as async
- actually skip copy if base skips
- fixed normal for new paths
- ensure internal stat is never async
- default poll to 10 as per docs
- added hint for callback fix on poll
- restructured late tmp, now a pipeline query
- moving action handler to connection as networking does
- fixed network assumption invocation is always passed
- centralized key cleanup, normalized internal var
- _supress_tmpdir_delete now in _ansible_xxx and gets removed from results
- delay internal key removal till after we use em
- nicer tmp removing, using existing methods
- moved cleanup tmp flag to mking tmp func
8 years ago
Matt Clay bce5fc7d96 Use us-east-2 for Windows CI on Shippable. 8 years ago
Ricardo Carrillo Cruz 375846d764 Refactor iosxr_facts to use network_cli plugin (#20857) 8 years ago
Loïc Blot b55d039f67 New modules: vmware_guest_facts & vmware_guest_snapshot (#20971)
* Move gather_facts action outside of vmware_guest module
* Move facts gathering method to vmware.py library
* vmware_guest use some vmware.py library methods
* vmware.py lib: fix some PEP 8 issues
* Move snapshot actions to vmware_guest_snapshot
* Move common snapshot facts to vmware.py library
8 years ago
John R Barker 25e144db4a Update legacy-files.txt 8 years ago
John R Barker 0ea3911d47 module_utils/vmware.py is now clean 8 years ago
Matt Clay 272ff10fa1 Fix @contextmanager leak on exception. (#21031)
* Fix @contextmanager leak on exception.
* Fix test leaks of global module args cache.
8 years ago
Matt Clay ccb1b742f5 Fix win_stat test for changes from PR #20876
The changes to win_file in that PR resulted in changes to file
sizes and file hashes expected by the win_stat tests.
8 years ago
Brian Coca a2c38c47aa added docs for vault and made trigger shorter: !vault (#20985)
* added docs for vault and made trigger shorter: !vault

* added single var valuting

* Update playbooks_vault.rst

Edit pass for spelling and grammar. Ship it!

* Update playbooks_vault.rst

Typo fixes.
8 years ago
Toshio Kuratomi d1a6b07fe1 Move ssh and local connection plugins from using raw select to selectors
At the moment, this change will use EPoll on Linux, KQueue on *BSDs,
etc, so it should alleviate problems with too many open file
descriptors.

* Bundle a copy of selectors2 so that we have the selectors API everywhere.
* Add licensing information to selectors2 file so it's clear what the
  licensing terms and conditions are.
* Exclude the bundled copy of selectors2 from our boilerplate code-smell test
* Rewrite ssh_run tests to attempt to work around problem with mocking
  select on shippable

Fixes #14143
8 years ago
jhawkesworth 2c70450e23 Fix 'touch' mode so it creates zero size files. (#20876) 8 years ago
Peter Sprygada d226f31a0f fixes ios and eos command modules (#20989)
* returns support for prompt/response over cli
* now sends native dict instead of str command
* fixes issue with run_commands() in ios to jsonify request
* updates unit test cases
8 years ago
Toshio Kuratomi 1df7d95cec Module utils default path (#20913)
* Make the module_utils path configurable
* Add a config value to define the path site module_utils files
* Handle module_utils that do not have source as an error
* Make an integration test for module_utils envvar working
* Add documentation for the ANSIBLE_MODULE_UTILS config option/envvar
* Add it to the sample ansible.cfg
* Add it to intro_configuration.
* Also modify intro_configuration to place envvars on equal footing with
  the config options (will need to document the envvar names in the
  future)
* Also add the ANSIBLE_LIBRARY use case from
  https://github.com/ansible/ansible/issues/15432 so we can close out
  that bug.
8 years ago
Matt Clay 6580fb2cd1 Fix exception in module validator. 8 years ago
Matt Martz 829c0b8f62 Update validate-modules (#20932)
* Update validate-modules

* Validates ANSIBLE_METADATA
* Ensures imports happen after documentation vars
* Some pep8 cleanup

* Clean up some left over unneeded code

* Update modules for new module guidelines and validate-modules checks

* Update imports for ec2_vpc_route_table and ec2_vpc_nat_gateway
8 years ago
Nathaniel Case 1718719d77 vyos_facts 2.3 (#20939)
* Update vyos_facts documentation

* Replace runner for run_commands

* vyos_facts tests

* Update documentation

* vyos_facts is supported by core
8 years ago
Brian Coca 6ca5fb49c3 allow debug to be 'changed' (#20957)
* allow debug to be 'changed'

fixes #14430

* removed test that checked against this
8 years ago
Nathaniel Case d87fc9605f vyos_config 2.3 (#20577)
* Rename vyos2 over vyos

* Update vyos_config to LocalAnsibleModule

Change result key 'updates' -> 'commands'

vyos_config is supported by core

* vyos_config tests

* Enable bracket config use

* Sanitize config before use
8 years ago
Stephane Maarek c33812450e fixed type mapper and added tests (#20963) 8 years ago
Dag Wieers 3dbce15ccb win_shortcut: Add missing $check_mode definition + bugfix + tests (#20911)
* win_shortcut: Add missing $check_mode definition

For some reason this entry was missing, possible a merge-conflict gone
wrong :-(

* Added integration tests and bugfix

Add missing changes.
8 years ago
Matt Clay 309a37de86 Add `--debug` option to `ansible-test`. 8 years ago
Matt Clay 64f98f855d Update PEP 8 legacy files list. 8 years ago
Dag Wieers bbe2903d63 Fix broken Shippable 8 years ago
John R Barker 553b6151ad iosxr tests: Initial work for 2.3 (#20883)
Ensure a loopback device exists for testing
Remove provider:
Default is to run task on Network, device, use delegate_to: localhost for local tasks.
8 years ago
Vlad Glagolev 039d207d24 Add Source Mage GNU/Linux facts (#19671)
* Add Source Mage GNU/Linux facts

* Add unit test for OS-detection
8 years ago
Toshio Kuratomi 5c38f3cea2 Combine jimi-c and bcoca's ideas and work on hooking module-utils into PluginLoader.
This version just gets the relevant paths from PluginLoader and then
uses the existing imp.find_plugin() calls in the AnsiballZ code to load
the proper module_utils.

Modify PluginLoader to optionally omit subdirectories (module_utils
needs to operate on top level dirs, not on subdirs because it has
a hierarchical namespace whereas all other plugins use a flat
namespace).

Rename snippet* variables to module_utils*

Add a small number of unittests for recursive_finder

Add a larger number of integration tests to demonstrate that
module_utils is working.

Whitelist module-style shebang in test target library dirs

Prefix module_data variable with b_ to be clear that it holds bytes data
8 years ago
sebastianneubauer 3f14061584 s3 module: fix urlparse invocation and netloc mixup on Python 3 (#20836) 8 years ago
Matt Clay 503e85ed0e PEP 8 E111 cleanup. 8 years ago
Matt Clay f80224f828 PEP 8 E111 cleanup. 8 years ago
Matt Clay 85300883ef PEP 8 E111 cleanup. 8 years ago
Matt Clay 23f2efbc8d PEP 8 E111 cleanup. (#20841) 8 years ago
Matt Clay 462ab6b1db PEP 8 E111 cleanup for nxos modules. 8 years ago
Matt Clay cb76200c7d PEP 8 E111 & E114 cleanup. (#20838) 8 years ago
Toshio Kuratomi 1609afbd12 Unittests for some of module_common.py (#20812)
* Unittests for some of module_common.py
* Port test_run_command to use pytest-mock

The use of addCleanup(patch.stopall) from the unittest idiom was
conflicting with the pytest-mock idiom of closing all patches
automatically.  Switching to pytest-mock ensures that the patches are
closed and removing the stopall stops the conflict.
8 years ago
Wayne Witzel III 0e72f3bd71 Ansible Tower organization module (#20355)
* add Ansible Tower organization module

* skip Python 2.4 check for ansible_tower module

* make spec and doc match, extract tower auth helper method

* added auth params at module level

* support check mode

* extract check mode check to ansible_tower utils, add utils to 2.4 skip

* update interpreter shebang

* remove colon from docs

* no log for password, verify_ssl default to true
8 years ago
Ricardo Carrillo Cruz e70bc06ea1 Refactor iosxr_command to make use of network_connection plugin (#20772) 8 years ago
Peter Sprygada a4a5db56f6 updates python2.4-skip
* adds module_utils/netconf.py
* adds module_utils/junos.py
8 years ago
Matt Clay 10d9318de7 PEP 8 indent cleanup. (#20800)
* PEP 8 E121 cleanup.

* PEP 8 E126 cleanup.

* PEP 8 E122 cleanup.
8 years ago