Commit graph

14 commits

Author SHA1 Message Date
Dag Wieers
e970237a2f New module: access Cisco ACI (network/aci/aci_rest) (#26029)
* aci_rest: New module to access Cisco ACI

This PR includes:
- Relicense as GPLv3+
- Check-mode support
- Cosmetic changes to documentation
- Examples in YAML format
- Removal of incorrect requirements (for this module)
- Do not log passwords
- Implement native fetch_url instead of requests
- Use standard hostname, username and password parameters
- Add alias src for parameter config_file
- Add mutual exclusive content option for inline data (and show some inline examples)
- Add timeout parameter
- Add validate_certs parameter
- Handling ACI result output (identical for JSON as XML input)
- Parse/expose ACI error output to user

* Lower case method, add use_ssl, Use python dicts

This commit includes:
- Use lowercase method names
- Add `use_ssl` parameter (not the `protocol` parameter)
- Use a python dict for the request data (not a JSON string)
- Documentation improvements

* Ensure one of 'content' or 'src' is provided

* Fix issue with totalCount being a string in JSON

This fixes the problem with JSON output where totalCount is a string and
not an integer.

This fixes jedelman8/aci-ansible#7

* Improve code documentation

* Improve error handling and module response

* Small typo

* Improve documentation and examples

* Keep protocol parameter, but deprecate it

* Extrude aci functions from module_utils

* aci_rest: Add unit tests
2017-07-17 16:32:12 +01:00
Ganesh Nalawade
e14e37ee1e Fix junos unit test failures (#26676)
*  Use lxml api's in unit test to parse xml
*  Remove unwanted import in unit test
*  Add ncclient dependency in unit test requirement
2017-07-12 08:36:16 -07:00
Toshio Kuratomi
e238ae999b Cyptography pr 20566 rebase (#25560)
Make pyca/cryptography the preferred backend for cryptographic needs (mainly vault) falling back to pycrypto

pyca/cryptography is already implicitly a dependency in many cases
through paramiko (2.0+) as well as the new openssl_publickey module,
which requires pyOpenSSL 16.0+. Additionally, pyca/cryptography is
an optional dep for better performance with vault already.

This commit leverages cryptography's padding, constant time comparisons,
and CBC/CTR modes to reduce the amount of code ansible needs to
maintain.

* Handle wrong password given for VaultAES format

* Do not display deprecation warning for cryptography on python-2.6

* Namespace all of the pycrypto imports and always import them

  Makes unittests better and the code less likely to get stupid mistakes
  (like using HMAC from cryptogrpahy when the one from pycrypto is needed)

* Add back in atfork since we need pycrypto to reinitialize its RNG just in case we're being used with old paramiko

* contrib/inventory/gce: Remove spurious require on pycrypto

(cherry picked from commit 9e16b9db275263b3ea8d1b124966fdebfc9ab271)

* Add cryptography to ec2_win_password module requirements
  * Fix python3 bug which would pass text strings to a function which
    requires byte strings.

* Attempt to add pycrypto version to setup deps

* Change hacking README for dual pycrypto/cryptography

* update dependencies for various CI scripts

* additional CI dockerfile/script updates

* add paramiko to the windows and sanity requirement set

  This is needed because ansible lists it as a requirement. Previously
  the missing dep wasn't enforced, but cryptography imports pkg_resources
  so you can't ignore a requirement any more

* Add integration test cases for old vault and for wrong passwords

* helper script for manual testing of pycrypto/cryptography

* Skip the pycrypto tests so that users without it installed can still run the unittests

* Run unittests for vault with both cryptography and pycrypto backend
2017-06-27 06:00:15 -07:00
Ricardo Carrillo Cruz
b12beca3ed Refactos nxos_ip_interface module (#24885) 2017-05-22 19:48:59 +02:00
Tim Rupp
c1397626fc Adds the bigip_user module to Ansible (#24753)
The patch adds the bigip_user module to Ansible to support managing
users on an F5 BIG-IP.

Unit tests are provided. Integration tests can be found here

  * https://github.com/F5Networks/f5-ansible/blob/devel/test/integration/bigip_user.yaml
  * https://github.com/F5Networks/f5-ansible/tree/devel/test/integration/targets/bigip_user/tasks
2017-05-18 20:21:18 +01:00
Matt Clay
d662f6f0db Fix bugs in ansible-test units command. (#24044)
* Handle old versions of coverage.
* Handle old versions of setuptools.
* Detect python version for docker/remote units.
* Add sanity override for test constraints.
2017-04-27 11:21:11 +08:00
Toshio Kuratomi
4e8e366739 Ryanpineo fix ipaddr netmask with 32 cidr (#23506)
* Fix bug in ipaddr netmask filter when cidr is 32

* Add requirement on netaddr to the units.txt file
2017-04-11 14:10:43 -07:00
Ryan Brown
2196fa0e95 [cloud][tests] fixtures for placebo to test AWS modules using boto3 (#21253)
* [cloud][tests] Create fixtures for using placebo to test boto3-using modules

* Use pytest's importorskip instead of manually skipping on missing deps

* Fix imports in cloudformation module

* Delete unused code

* Add maybe_sleep fixtures to speed up recorded test runs

* Build basic placebo-CFN tests

* Commit placebo recordings of basic stack operations

* Add placebo to test-requires

* Allow unit tests to run regardless of environment by setting a default region

* Use explicit relative import for Python 3 compat

* Use __name__ attribute that works on Python 2 and 3
2017-03-31 15:31:12 -04:00
Matt Clay
a7bb04800d Add boto to units requirements for s3 test. 2017-02-27 20:55:32 -08:00
Matt Clay
fcac261eef Run unit tests in isolation w/ coverage support. 2017-02-27 17:16:45 -08:00
Matt Clay
4189592701 Revert "Enable process isolation for unit tests."
This reverts commit 91526cd9f2.

Removing this feature primarily because it interferes with
collecting proper code coverage results. I may restore the
feature later if that can be resolved.
2017-02-09 11:10:06 -08:00
Matt Clay
91526cd9f2 Enable process isolation for unit tests. 2017-02-08 14:36:42 -08:00
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.
2017-01-30 13:51:27 -08:00
Matt Clay
6bbd92e422 Initial ansible-test implementation. (#18556) 2016-11-29 21:21:53 -08:00