Commit graph

2228 commits

Author SHA1 Message Date
rajaspachipulusu17
753f998262 Pluribus Networks ipv6 security reguard vlan module with UT (#58319) 2019-07-10 14:39:53 +05:30
Chris Archibald
8731fc7a86 returning invalid security (#58595) 2019-07-10 00:40:31 -04:00
Matt Clay
9e67953b2e
Fix collection loader and add unit tests. (#58701)
* Use `compile` before `eval` in collection loader.

This fixes two issues:

1. File names are available when tracing execution, such as with code coverage.
2. Future statements are not inherited from the collection loader.

* Add unit tests for collection loading.

These tests verify several things:

1. That unit tests can import code from collections when the collection loader is installed.
2. That tracing reports the correct file and line numbers (to support code coverage).
3. That collection code does not inherit __future__ statements from the collection loader.

* Update unit test handling of the collection loader.

Since the collection loader is installed simply by importing ansible.plugins.loader,
we may already have a collection loader installed when the test runs. This occurs if
any other tests are collected which use that import during collection. Until that code
is moved into an initialization function to avoid loading during import, the unit tests
will need to replace any existing collection loaders so that they reflect the desired
configuration.

* Insert into sys.modules before calling exec.

This is a requirement of PEP 302.

It will prevent recursion errors when importing the current module or using a relative import.

* Use the correct value for __package__ in modules.

This allows using relative imports in collections.

* Add warning about modifying code for trace test.

* Add test for relative import in collection.

* Add __init__.py to collection to satisfy pylint.

The relative-beyond-top-level rule in pylint may not be appropriate for collections.
However, until that rule is disabled for collections this will keep tests passing.
2019-07-09 17:31:33 -07:00
Jordan Borean
b6791e6ae3
ansible-galaxy: add collection sub command (#57106)
* ansible-galaxy: add collection init sub command

* Fix changelog and other sanity issues

* Slim down skeleton structure, fix encoding issue on template

* Fix doc generation code to include sub commands

* Added build step

* Tidy up the build action

* Fixed up doc changes and slight testing tweaks

* Re-organise tests to use pytest

* Added publish step and fixed up issues after working with Galaxy

* Unit test improvments

* Fix unit test on 3.5

* Add remaining build tests

* Test fixes, make the integration tests clearer to debug on failures

* Removed unicode name tests until I've got further clarification

* Added publish unit tests

* Change expected length value

* Added collection install steps, tests forthcoming

* Added unit tests for collection install entrypoint

* Added some more tests for collection install

* follow proper encoding rules and added more tests

* Add remaining tests

* tidied up tests and code based on review

* exclude pre-release versions from galaxy API
2019-07-10 05:47:25 +10:00
Miguel Angel Muñoz González
d50531c6bd New Fortinet's module for fortios_user_device (using new httpapi plugin) (#58291)
* New Fortinet's module for fortios_user_device (using new httpapi plugin

* Fix documentation errors

* Update lib/ansible/modules/network/fortios/fortios_user_device.py

Co-Authored-By: Sandra McCann <samccann@redhat.com>

* Update lib/ansible/modules/network/fortios/fortios_user_device.py

Co-Authored-By: Sandra McCann <samccann@redhat.com>

* Update lib/ansible/modules/network/fortios/fortios_user_device.py

Co-Authored-By: Sandra McCann <samccann@redhat.com>

* Update lib/ansible/modules/network/fortios/fortios_user_device.py

Co-Authored-By: Sandra McCann <samccann@redhat.com>

* Update lib/ansible/modules/network/fortios/fortios_user_device.py

Co-Authored-By: Sandra McCann <samccann@redhat.com>

* Update lib/ansible/modules/network/fortios/fortios_user_device.py

Co-Authored-By: Sandra McCann <samccann@redhat.com>
2019-07-09 15:53:36 +05:30
Andrey Klychkov
88ec5e14cb Add unit tests for lenient_lowercase function (#58586) 2019-07-08 18:33:15 -04:00
Abhijeet Kasurde
79fdc2190a role: Fix role's hash_params (#55263)
* role: Fix role's hash_params

Fix based upon work done by alikins.

Fixes: #20596

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>

* review comments

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2019-07-08 09:25:59 -04:00
Diane Wang
9c140d26d5 VMware: add new module vmware_guest_network (#52075) 2019-07-08 07:54:54 +05:30
Toshio Kuratomi
0c992d5ae4 Fix for skipping of gitlab_runner test.
Correct variable name for skipping of the gitlab test when gitlab python
client is not installed.
2019-07-05 11:47:19 -07:00
Mariusz Mazur
2fb06650a7 kubevirt: even more unit tests (#58593) 2019-07-05 20:35:32 +10:00
Abhijeet Kasurde
96eccda23b
VMware: Add module vmware_vm_storage_policy_info (#56263)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2019-07-03 16:01:08 +05:30
Ganesh Nalawade
1e3034b96d
junos_facts refactor to work with resources modules (#58566)
* junos_facts refactor to work with resources modules

*  Refactor junos_facts module to work with
   network resource module.

* Fix unit test failures

* Fix review comments
2019-07-03 10:08:45 +05:30
Brian Coca
ee4cba1b85 ensure bytes in run_command (#58411)
* ensure we pass bytes to run_command

* changed tests for new behaviour

* dont b the pytest

* fixes by sivel
2019-07-02 17:07:48 -05:00
Andrey Klychkov
10af2636d1 Add unit tests for human_to_bytes (#58584) 2019-07-01 13:50:54 -04:00
Felix Fontein
f0801879c7 Rename xenserver_guest_facts -> xenserver_guest_info (#57032)
* Rename xenserver_guest_facts -> xenserver_guest_info.

* Add changelog.

* Forgot one test.
2019-06-30 10:04:30 -04:00
Sam Doran
ab6a9ef130
Get minor version number for CentOS and Debian (#57814)
* Get the most detailed version number from distro.version() for CentOS and Debian
* Update tests and fixtures
* Update fixture generation script to gather distro info and work with Python 3
* Update LinuxMint fixtures
* Cleanup fixture formatting
* Improvements based on feedback from abadger:
    - use unicode since that is what distro returns
    - use frozenset with a tuple
    - include link Debian to bug
2019-06-28 19:21:35 -04:00
Sam Doran
6cf6f5a34b
Use atexit to cleanup tmp dirs (#56532)
* Wrap everything in try/except to avoid leaving files behind
* Add unit tests, integration tests, and changelog
* Do text the correct way
2019-06-28 16:19:27 -04:00
Toshio Kuratomi
8acf71f78f
Skip tests with unsatisfied deps (#55853)
* Skip gitlab tests if dependencies aren't met

* Skip certain unittests if passlib is not installed

* Fix tests with deps on paramiko to skip if paramiko is not installed

* Use pytest to skip for cloudstack

If either on Python-2.6 or the cs library is not installed we cannot run
this test so skip it
2019-06-28 13:09:36 -07:00
Sloane Hertel
826f224f02
Handle vaulted non-ascii characters for Python2 (#58503)
* Handle vaulted non-ascii characters for Python2

* Add a test to ensure str() no longer raises UnicodeEncodeError
2019-06-28 13:23:15 -04:00
Olivier Scherler
7ed7d374e4 Fix onepassword lookup plugin and onepassword_facts module when a field has no name. (#58308)
* Fix onepassword lookup plugin crashing on fields with no 'name' or 't' property.

* Fix onepassword_facts module crashing on fields with no 'name' or 't' property.

* Add unit test for onepassword lookup plugin failing on entries without a name.

* Add changelog fragment for onepassword lookup plugin and onepassword_facts module fixes on fields without a name.
2019-06-28 12:37:14 -04:00
Chris Van Heuveln
0868fec8bd nxos_vpc: pkl_vrf fixes for #57069 (#57370)
* nxos_vpc: pkl_vrf fixes for #57069

Fixes #57069

- Symptom: When playbooks specify `pkl_vrf: default`, the result is that the cli does not set the `vrf` state.

- Analysis:
 - First issue: 'default' is a reserved word when used with the `peer-keepalive` `vrf` keyword. It refers to the default rib.
   - This is confusing in several ways because `peer-keepalive`'s *default* vrf is the `management` vrf.

 - Second issue: When changing only one optional value (`pkl_vrf`) while other optional values are idempotent (`pkl_src`), the result is that the idempotent values are ignored; unfortunately the device cli *replaces* the entire command, in which case the idempotent values are removed.
   - e.g. playbook specifies this:
     ```
     { pkl_dest: 10.1.1.1, pkl_src: 10.2.2.2, pkl_vrf: my_vrf }
     ```

     ```
     peer-keepalive dest 10.1.1.1 src 10.2.2.2             # original

     peer-keepalive dest 10.1.1.1 src 10.2.2.2 vrf my_vrf  # intended result

     peer-keepalive dest 10.1.1.1 vrf my_vrf               # actual result
     ```

 - Third issue: the `pkl` getter was relying on positional data. This broke when the `udp` keyword nvgen'd where `vrf` used to appear (shifting all keywords to the right).

- Tested on regression platforms: `N3K,N6k,N7K,N9K,N3K-F,N9K-F`

* PEP fixes

* PEP fix 2

* pkl should merge by default, not override

* rmv debugs

* add mike's tests

* fix comments
2019-06-28 16:18:46 +05:30
Daniel Mellado Area
db689f7221 Fix ovsdb module not being idempotent (#57735)
openvswitch_db was not parsing properly some arguments, which caused
some commands to be executed when they shouldn't. This commit fixesit
and adds unit testing for the usecase.

Closes-Bug: #55432
Closes-bug: #43858
2019-06-26 10:48:46 -04:00
Matt Martz
e32d60bbcd
Add back _contains_vars method as maybe_template (#58290)
* Add back _contains_vars method as maybe_template. Fixes #58282

* Remove template guard in a few places

* maybe_template sounds like it might template something, rename to is_possibly_template

* Add tests for is_possibly_template
2019-06-25 10:54:37 -05:00
Wojciech Wypior
ac101f7f33 adds initial_hotfix parameter to vcmp guest (#58180) 2019-06-25 15:26:09 +02:00
Mariusz Mazur
06292566ec kubevirt: more unit tests (#57739)
* Add tests for KubeAPIVersion

* Legibility improvements for KubevirtVM tests

* Create units.utils.kubevirt with common stuff

* Add some VMIRS unit tests
2019-06-25 20:06:13 +10:00
rajaspachipulusu17
fc1798cc14 Pluribus Networks ipv6security raguard module with UT (#57031)
* Pluribus Networks ipv6security raguard module with UT
* Doc fixes
2019-06-24 16:29:41 +05:30
Felix Fontein
4a12be31fb docker_* modules: improve error message when docker-py is missing (#57914)
* Improve error for docker modules when docker-py can't be imported.

* Add changelog.

* Mention platform and Python interpreter in more cases.

* Clarify wording.

* Adjust tests.
2019-06-23 06:27:33 -04:00
Wojciech Wypior
30ada17d4f Adds message routing transport module (#58201) 2019-06-21 12:58:02 -07:00
Wojciech Wypior
b8fd2f4df3 adds generic routing peer module (#58189) 2019-06-21 12:56:25 -07:00
Wojciech Wypior
429bf5340e adds module for message routing protocol (#58188) 2019-06-21 12:56:03 -07:00
Wojciech Wypior
0a3a94a493 adds new module to manage firewall schedules (#58187) 2019-06-21 12:55:50 -07:00
Wojciech Wypior
92a1e6845c Adds two modules to manage AFM log profiles (#58186) 2019-06-21 12:55:37 -07:00
Toshio Kuratomi
eb7e4591ae Fix ios test for python2 non-ascii paths 2019-06-21 11:32:28 -07:00
Wojciech Wypior
fbca93b8ad removes args from the code and corrects few missed tests (#58175) 2019-06-21 09:09:39 -07:00
Wojciech Wypior
56b3b1ac56 adds message routing router module (#58191) 2019-06-21 09:09:14 -07:00
Wojciech Wypior
c1f2df4753 adds message routing route module (#58190) 2019-06-21 09:08:56 -07:00
Wojciech Wypior
95e59e7ee7 adds description to bigip snatpool (#58179) 2019-06-21 07:52:46 -07:00
Wojciech Wypior
3531bf3148 fixes issue with ssl protocols ordering (#58177) 2019-06-21 06:46:53 -07:00
Wojciech Wypior
becca36c5e Added new module for remote user management (#58171) 2019-06-21 06:45:29 -07:00
Sumit Jaiswal
58d446e61a
PR to fix where ansible_net_model was not being populated (#58159)
* fix bug 57285

Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>

* minor fix

Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>

* adding TC fix related

Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>

* fix shippable error

Signed-off-by: Sumit Jaiswal <sjaiswal@redhat.com>
2019-06-21 16:18:59 +05:30
markafarrell
43872d6b88 Fix netconf guess_network_os to use ssh_config if supplied. (#55199)
* feature: use network_os=auto to trigger network os guessing

* doc: add debug messages

* fix linting

* fix test_netconf_init default network_os is auto

* add documentation

* fix rst errors

* use init lexer

* Update docs/docsite/rst/network/user_guide/platform_netconf_enabled.rst

Co-Authored-By: Sandra McCann <samccann@redhat.com>

* Update docs/docsite/rst/network/user_guide/platform_netconf_enabled.rst

Co-Authored-By: Sandra McCann <samccann@redhat.com>

* Update docs/docsite/rst/network/user_guide/platform_netconf_enabled.rst

Co-Authored-By: Sandra McCann <samccann@redhat.com>

* Update docs/docsite/rst/network/user_guide/platform_netconf_enabled.rst

Co-Authored-By: Sandra McCann <samccann@redhat.com>

* Update docs/docsite/rst/network/user_guide/platform_netconf_enabled.rst

Co-Authored-By: Sandra McCann <samccann@redhat.com>

* Update docs/docsite/rst/network/user_guide/platform_netconf_enabled.rst

Co-Authored-By: Sandra McCann <samccann@redhat.com>

* Update docs/docsite/rst/network/user_guide/platform_netconf_enabled.rst

Co-Authored-By: Sandra McCann <samccann@redhat.com>

* Update lib/ansible/plugins/connection/netconf.py

Co-Authored-By: Sandra McCann <samccann@redhat.com>

* Update lib/ansible/plugins/connection/netconf.py

Co-Authored-By: Sandra McCann <samccann@redhat.com>

* Update lib/ansible/plugins/connection/netconf.py

Co-Authored-By: Sandra McCann <samccann@redhat.com>

* Update docs/docsite/rst/network/user_guide/platform_netconf_enabled.rst

Co-Authored-By: Sandra McCann <samccann@redhat.com>

* Update docs/docsite/rst/network/user_guide/platform_netconf_enabled.rst

Co-Authored-By: Sandra McCann <samccann@redhat.com>

* Update docs/docsite/rst/network/user_guide/platform_netconf_enabled.rst

Co-Authored-By: Sandra McCann <samccann@redhat.com>
2019-06-21 09:04:13 +05:30
Chris Van Heuveln
52c811c841 nxos_bgp_neighbor: Add bfd support (#56932)
* nxos_bgp_neighbor: Add bfd support

- Add support for bfd state in nxos_bgp_neighbor

- Feature Pull Request

- nxos_bgp_neighbor

- Tested on platforms: `N3K,N6K,N7K,N9K`

* bfd T/F now bfd enable/disable

* pep fix ws
2019-06-19 21:23:00 +05:30
Chris Van Heuveln
727a6b405a nxos_ospf_vrf: Add 'bfd' support (#57425)
* nxos_ospf_vrf: Add 'bfd' support

* Add default to bfd doc hdr

* bfd T/F now bfd enable/disable
2019-06-19 21:22:32 +05:30
Chris Van Heuveln
30830a4482 nxos_pim: Add bfd support (#56908)
* nxos_pim: Add bfd support

* Add integration sanity

* minor cleanup

* bfd T/F now bfd enable/disable
2019-06-19 21:22:03 +05:30
Andrey Klychkov
64d0559e9f Postgres module_utils: add get_connect_params + unit tests (#58067)
* add get_conn_params

* add get_conn_params: add to the modules
2019-06-19 06:49:19 -07:00
Rob
feae35ab7e add IAM role assumption to aws_ec2 inventory (#41637)
* add IAM role assumption to aws_ec2 inventory
* Ensure inventory._options has necessary option keys populated since the plugin docs parser isn't accessible to unit tests yet
2019-06-18 15:34:41 -07:00
Guillaume Martinez
ec7b18952b gitlab_runner: Fix idempotency when creating runner (#57833) 2019-06-18 13:12:12 +02:00
Abhijeet Kasurde
cf623fa62f
Terraform: Fix unbound local error (#57044)
* Added Unit tests
* Fixed regression

Fixes: #56934

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2019-06-17 08:23:59 +05:30
bobdoah
33d0d36eaa AWS: Fix KeyError in aws_secret lookup (#54792) 2019-06-13 17:11:44 -07:00
Mariusz Mazur
51add5aa79 kubevirt: enable/update tests + fix merge_dicts() (#57685)
* Actually run the unit tests and separate them into two files

* Re-add recursion to merge_dicts()

* Update tests to work with current code
2019-06-13 11:07:16 +02:00
Chris Van Heuveln
205f6b1699 nxos_pim_interface: Add 'bfd' support (#57133)
* nxos_pim_interface: Add 'bfd' support

* PEP fixes

* fix copyright date

* bfd states changed from T/F to enable/disable/default
2019-06-12 09:47:41 +05:30
Enno Gröper
1ed7a654ba Improve testing of FactCache (#55739)
* Improve testing of FactCache
2019-06-10 16:26:24 -04:00
Sloane Hertel
598a058afe
[FactCache] define first_order_merge method (#55781)
* Add first_order_merge method

Add test for updating a key that already exists

* changelog
2019-06-10 14:34:06 -04:00
Anton Nikulin
4fa93d5b9b FTD configuration module: fix a bug with response parsing (#57480)
* Update dependence's name to firepower-kickstart

* Check response type before getting attributes

* Add unit test for construct_ansible_facts method

* Update error message
2019-06-10 18:30:35 +05:30
Sajna Shetty
e25269e1b3 Adding dell ome device_info module (#53438)
* Adding device_facts module for contribution

* changes added for pylint error

* Updated code to solve ansible-test compile error

* Changes to avoide comile error added

* Review Comments changes update

* Avoided blank line

* pylint error changes

* Removed ansible_facts return in error case

* Updated description

* modules renamed

* changing from ansible_facts to device_info

* avoide pep8 error

* Updated sample output

* version changed to 2.9

* Changed Copyright license to BSD

* Changed 3-clause BSD license to 2-clause BSD

* Added unit test support for ome_device_info

* version change

* removed pylint error in unit test modules

* Avoid Sanity error for unit test modules

* updated version
2019-06-10 06:41:48 -04:00
Chris Archibald
a58570f1bc na_ontap_snapshot_policy: Add ability to multiple schedules (#57366) 2019-06-10 09:24:25 +02:00
Chris Van Heuveln
bd844bc11c nxos_interface_ospf: Add bfd support (#56807)
* nxos_interface_ospf: Add bfd support

Add support for `bfd` state in `nxos_interface_ospf`

- Feature Pull Request

`nxos_interface_ospf`

* Fix pep issues

* sanity loop: syntax

* bfd states changed from T/F to enable/disable/default

* doc hdr fixes
2019-06-07 09:58:29 +05:30
Matt Martz
728fce0c44 Perf improvement for Templar.is_template (#57489)
* Faster is_template
2019-06-06 15:49:26 -04:00
Chris Van Heuveln
7aa0d26fda nxos_bfd_global / NxosCmdRef initial commit (#56317)
* nxos_bfd_global: initial commit

This is an initial POC with just a few commands included.  The code has been written somewhat generically so that it can act as a best practices template for re-use in future modules. The implementation follows the yaml cmd_ref style to define each command's getter/setter/type/default. It supports platform-specific defaults.

The basic logic is to collect all relevant data in a `cmd_ref` dict and pass that around to various methods.

In the BFD case the devices don't provide JSON output so we have to screen-scrape with show runs.

BFD does not support present/absent states so there is no state param.

BFD has three different property types to handle. We can add add'l types as needed:

- int
- int_list (list of ints)
- str (needs support for 'no' keyword)

* Use get_capabilities to find platform type

* PR comment fixes, round 1

* Minor cleanups

* nxos_bfd_global: create NxosCmdRef in module_utils

This commit just takes the latest bfd global code and moves the bulk
of the code into new `class NxosCmdRef` in `module_utils/nxos/nxos.py`.

The only remaining code in `nxos_bfd_global.py` are the calls from `main()`.

* Add remaining command properties and documentation

* update argument_spec

* Add check for _exclude; add sanity test

* Add targets files for bfd

* Context and state absent updates

* Add dict support to cmd_ref

* Changed remaining list commands to dict usage

* Add idempotence check for dict

* Fix existing overwrite bug

* Move pattern matching logic into its own method

* add support for 'command: absent'

* Add `get_platform_shortname`; update BFD platform-specific settings

* /absent/deleted/

* /sh/show/ in prepare_nxos_tests

* add dict check to get_platform_shortname

* Add normalize_defaults()

* UTs for bfd_global

* support yaml for both py2/py3

* update cmd_ref doc header

* Fix python2.6 incompatibility with dict comprehensions

* Fix bfd_global doc header (yaml syntax fail)

* more shippable fixes

* yet more shippable fixes

* shippable: remove r' ' wrappers

* docfix - remove ':'

* escape regex ctl chars in yaml table

* remove extra blank lines

* Fix str(None) issue

* Command context updates

* import PY2,PY3 instead of import sys

* fix ordereddict import & parent_context

* try/except for yaml import

* fix import issue for ordereddict

* remove epdb

* nxosCmdRef_import_check() workaround for shippable

* fix PEP ws errors
2019-06-06 15:52:55 +05:30
Daniel Mellado Area
091bebcbf7 Add support for vlan update on ovs bridges (#57168)
This commit adds support for vlan update on openvswitch_bridge module.
2019-06-05 10:32:14 -04:00
Chris Archibald
57b3160f13 new feature (#57320) 2019-06-04 13:57:54 -04:00
Abhijeet Kasurde
ee8a607cca ipaddr: Handle network address in ipmath (#57149)
* Updated testcase, documentation

Fixes: #54457

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
2019-06-04 14:01:18 +05:30
Chris Van Heuveln
6bb13bbb84 nxos_vlan: fix broken purge behavior (issue #57101) (#57229)
* nxos_vlan: fix broken purge behavior (issue #57101)

Symptoms/Analysis:
- `nxos_vlan` `purge: true` would fail when `purge` was trying to delete all unspecified vlans, including vlan 1.
- `nxos` devices do not allow removing vlan 1 and raise a cli exception error
- Previous fix #55144 caused a side effect when `purge` was used: vlan changes specified by `aggregate` were ignored; e.g.
 - vlan 4 is not present; playbook specifies `aggregate: { vlan: 4 }, purge: true`
 - results in proper purging but vlan 4 is not created

Solutions:
- ignore vlan 1 when purging
- remove the `not purge` check from state present logic

Added additional unit tests and integration tests.
Tested against all regression platforms.

* PEP fixes

* Add agg_show_vlan_brief.txt fixture

* Add warning for removing vlan 1

* change method name check
2019-06-04 09:14:09 +05:30
Andrey Klychkov
3e06013eb6 unittests for module_utils.common.removed.removed_module function (#57214) 2019-06-03 11:12:12 -04:00
rajaspachipulusu17
6b2688245e Pluribus Networks ipv6security raguard port module with UT (#57033)
* Pluribus Networks ipv6security raguard port module with UT

* Dox fix
2019-06-03 11:44:28 +05:30
rajaspachipulusu17
b8a317c527 Pluribus Networks vrouter packet relay module with UT (#57155)
* Pluribus Networks vrouter packet relay module with UT

* Doc fix
2019-06-03 11:43:29 +05:30
Matt Martz
8bd4e2a144 cert validation fixes - Attempt 2 (#55953)
* Attempt 2 of cert validation fixes

* Remove unused code

* Cleanup the tmp cert using atexit

* Fix linting issues

* Only add SSLValidationHandler when not HAS_SSLCONTEXT

* Catch value errors on non PEM certs

* Only catch NotImplementedError to avoid masking issues

* set self._context even with PyOpenSSLContext for conformity

* Fix error building

* normalize how we interact with the context we create

* Remove unused code

* Address test for py3.7 message difference

* open_url should pass the ca_path through

* Account for new error in url lookup test

* Guard some code behind whether or not we are validating certs

* Make _make_context public

* Move atexit.register up to where the tmp file is created
2019-05-31 16:35:25 -04:00
Sviatoslav Sydorenko
4c7fff315e
Fix module_utils.common.test_collections testsuite
PR #57181
2019-05-31 13:40:18 +02:00
Andrey Klychkov
bf25889bfd test_postgres: fix typos 2019-05-30 07:18:30 -07:00
Andrey Klychkov
01ed7a489a Add unit tests for lib/ansible/module_utils/common/text/converters.py (#56915)
Co-Authored-By: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
2019-05-30 09:22:53 -04:00
Felix Fontein
61b48778a7
Rename _facts -> _info (#57028) 2019-05-28 13:43:04 +02:00
rajaspachipulusu17
19a78bdc7b Pluribus Networks vrouter bgp module with unit test cases (#56434)
* Pluribus Networks vrouter bgp module with unit test cases
* Sanity fixes
2019-05-27 11:53:57 +05:30
Andrey Klychkov
86354ff1fb postgresql: remove depricated lib (#56641) 2019-05-24 15:08:16 -04:00
Wojciech Wypior
fca2a4c68b adds ltm policy to bigip facts (#56926)
facts no longer return changed but queried status in results
2019-05-24 10:12:43 -07:00
Yury V. Zaytsev
d88d71e4b1 route53_zone: return existing zone id in check mode (#56702)
* Returns zone ID for existing zone or `null`
* route53_zone: add module unit tests
* route53_zone: add compatibility with Python 2.6 to the unit tests
* route53_zone: address pycodestyle warning (add blank line)
2019-05-24 16:28:55 +05:30
Sam Doran
8f4f3750fe
Ensure uri module always returns status even on failure (#56240)
- Also return url and update docs for other values to indicate they are only returned on success.
- Add integration tests
- Use info variable for common return values
- Use -1 as default status rather than None. This is lines up with with existing code in urls.py
- Add unit tests to ensure status and url are returned on failure
2019-05-23 10:17:17 -04:00
Matt Martz
493cf817a9 Don't rely on netloc for determining hostname and port, just use hostname and port (#56270)
* Add changelog fragment
* Fix IPv6 address parsing for py2.6, and add tests
* make sure hostname isn't None
2019-05-20 16:50:54 -04:00
EvgenyF
ea4842c0d3 Changing the license to Apache 2 2019-05-20 10:14:32 -07:00
Martin Krizek
34e9d6781b Templar: encapsulate _available_variables (#55435)
Ensure variables are reset between iterations
2019-05-20 11:49:54 -04:00
rajaspachipulusu17
8c29c78e22 Pluribus Networks vrouter loopback interface module with UT (#56450)
* Pluribus Networks vrouter loopback interface module with UT

* Sanity fixes
2019-05-20 12:04:05 +05:30
rajaspachipulusu17
7a615a9e0e Pluribus Network vrouter ospf module with unit tests (#56435)
* Pluribus Network vrouter ospf module with unit tests

* Sanity fix

* Doc fixes
2019-05-20 12:02:05 +05:30
Andrey Klychkov
386cef18ed module_utils.postgres: added unittests (#56381) 2019-05-17 23:33:45 -07:00
Andrey Klychkov
f1b5836836 lib/ansible/parsing/ajson.py: added UNIT-tests (#56398) 2019-05-17 23:29:42 -07:00
anasbadaha
5a7bce1f8d Adding New Model onyx_qos for Configuring QoS on Onyx Switches (#55127)
* Adding New Model onyx_qos for Configuring QoS on Onyx Switches

Signed-off-by: Anas Badaha <anasb@mellanox.com>

* Fix Pep8 Failures in onyx_qos

Signed-off-by: Anas Badaha <anasb@mellanox.com>

* Fix Pep8 Failures phase 2

Signed-off-by: Anas Badaha <anasb@mellanox.com>

* Fix Samer's Comments on onyx_qos Module

Signed-off-by: Anas Badaha <anasb@mellanox.com>

* Fix Shippable Comments Phase 3

Signed-off-by: Anas Badaha <anasb@mellanox.com>

* Fix Current Version 2.9

Signed-off-by: Anas Badaha <anasb@mellanox.com>
2019-05-17 14:20:56 -04:00
James Tanner
940d58e1b3 Nullify improperly licensed test file 2019-05-15 13:57:36 -04:00
Gonéri Le Bouder
cf78759f5b vmware_vm_facts: fix the support with regular ESXi
Ensure the module still work with the ESXi where CustomFieldsManager
does not exist.

From: https://www.vmware.com/support/developer/converter-sdk/conv60_apireference/vim.CustomFieldsManager.html

    The CustomFieldsManager object is used to add and remove custom fields to
    managed entities.
    The custom fields values set on managed entities are available through the
    customValue property and through the summary objects for VirtualMachine
    and HostSystem. They are not available directly through this managed object.
    This functionality is only available through VirtualCenter.

Fixes: #56071
2019-05-13 17:25:16 -04:00
anasbadaha
0f852f01c0 Adding Support For EVPN in BGP Module (#55503)
* Adding Support For EVPN in BGP Module

Signed-off-by: Anas Badaha <anasb@mellanox.com>

* Fix Pep8 Failures in onyx_bgp.py

Signed-off-by: Anas Badaha <anasb@mellanox.com>

* Fix Pep8 Failures in onyx_bgp.py Phase 2

Signed-off-by: Anas Badaha <anasb@mellanox.com>

* Fix Samer's Comments

Signed-off-by: Anas Badaha <anasb@mellanox.com>

* Remove file Variable

Signed-off-by: Anas Badaha <anasb@mellanox.com>
2019-05-11 08:21:10 -04:00
anasbadaha
0cb0fa918f Adding Support for NVE Protocol in onyx_protocol (#55513)
* Adding Support for NVE Protocol in onyx_protocol

Signed-off-by: Anas Badaha <anasb@mellanox.com>

* Fix Pep8 Failures in onyx_protocol.py

Signed-off-by: Anas Badaha <anasb@mellanox.com>
2019-05-11 08:09:48 -04:00
anasbadaha
031655def0 Adding Support for Traffic Class in Onyx Switches (#55577)
* Adding Support for Traffic Class in Onyx Switches

Signed-off-by: Anas Badaha <anasb@mellanox.com>

* Enhancing the code and elemenating code duplicate

Signed-off-by: Anas Badaha <anasb@mellanox.com>
2019-05-11 08:08:52 -04:00
vicmunoz
ecdb616954 NetApp ONTAP module for manage ipspaces (#49821)
* NetApp ONTAP module for manage ipspaces

* fixes for ci_cd and code layout

* indentation fixes

* code style fixes

* fixing yamllint issue

* unit test for module na_ontap_ipspace

* fixing sanity tests

* change pytest.skip to pytest.mark.skip

* adding ansible version to 2.9
2019-05-10 11:24:02 -04:00
Felix Fontein
bd47e64bc7 Hetzner failover IP: refactoring (#56203)
* Rename helper function.

* Extract hetzner.py module_utils.

* Rewrite docs.

* Add module docs fragment.

* Split up get_failover function.

* Add tests for new function.

* hetzner_pass -> hetzner_password

* Move common argspec to module_utils.
2019-05-10 08:33:51 +02:00
zengchen
d8314e1a45 refactor moudule utils of hwc_utils.py (#55858)
* use navigate_value instead navigate_hash

* add async wait method

* update dict compare

* remove unuse methods

* not all modules have timeouts parameter

* navigate_value, the input data may be None
2019-05-09 09:04:51 -04:00
rajaspachipulusu17
458b473d06 Pluribus network prefix list module (#55686)
* Pluribus network prefix list module

* Doc fix and unit test fix

* Added default value with args spec change

* Sanity fix
2019-05-09 10:31:06 +05:30
Trishna Guha
2e8a3efccb
Revert nxos, ios, iosxr return_timestamps (#56206)
* Revert "nxos_command:run_commands results failure when commands array size >1 (#52670)"
This reverts commit 0df5b92af3.
* Revert "added timestamps to nxos_command module (#50261)"
This reverts commit e150943314.
* Revert "added timestamps to ios_command module (#50323)"
This reverts commit 2a432a093b.
* Revert "added response_timestamps to iosxr_command module (#50095)"
This reverts commit 2a0c356da9.
2019-05-08 20:49:29 +05:30
Trishna Guha
57e0567310
fix nxos_vlan mode idempotence bug (#55144)
* fix nxos_vlan mode idempotence bug

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* Fix CI failure

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2019-05-08 11:19:15 +05:30
Felix Fontein
ba9fee6c37 Hetzner failover IP module (#56103)
* First version of Hetzner failover IP module.

* Extend module.

* Add comments.

* Add basic unit tests.

* Add more tests.

* Tests for set_failover.
2019-05-07 19:11:15 +02:00
Anatoly Pugachev
6e73150244 refactor iscsi network facts module, remove external grep call, add unit test (#55643)
* remove external grep call and parse with python
* use function for repeated code
* use module.get_bin_path() for iscsiutil on HPUX
* some code opt for HPUX
* clean up non-module code, module being defined is a requirement for this code
* import get_bin_path() directly and use without module prefix
* Add integration tests for AIX and HP-UX
* add changelog fragment
* Apply suggestions from code review
Co-Authored-By: mator <matorola@gmail.com>
* Apply suggestions from code review #2
Co-Authored-By: Sam Doran <sdoran@redhat.com>
* Remove strict requirement on executable to exist for get_bin_path() as
it will allow facts gathering to continue without an error. Almost all
other files under facts do not have "required=True" (except 2 files,
which should be probably fixed). And check return value for
get_bin_path() , before run attempt.

* add check for AIX lsattr run_command return code
2019-05-07 12:26:20 -04:00
rajaspachipulusu17
5309d6c131 Pluribus networks fabric local module with UT (#55872)
* Pluribus networks fabric local module with UT

* Sanity fix

* Ansible doc standards

* Unit test fix
2019-05-02 18:34:29 +05:30
Anatoly Pugachev
b9af6847c2 network facts, add unit test for FC WWN (#55848)
* use 'None' as return value for get_bin_path and set return code to non-zero on run_command error
2019-04-30 17:26:00 -04:00
Sam Doran
b3ce3fc5eb
Restore ansible --version output (#55728)
* Add custom action class for version info
* Use args from CLI as prog for ArgumentParser object
* Make prog a required parameter of create_base_parser() and update all uses to pass in the newly required parameter.
* Add unit test for checking ansible --version
* Update other related unit tests
2019-04-29 16:38:31 -04:00