Commit graph

2103 commits

Author SHA1 Message Date
Wojciech Wypior
99f9eab19d fixes assert statements in tests (#59998)
(cherry picked from commit d00aaf66d7)
2019-09-04 12:21:23 -07:00
Sam Doran
0bc1285987 [stable-2.8] fixes issue with recieve parameter idempotency (#59999) (#60541)
* [stable-2.8] fixes issue with recieve parameter idempotency (#59999)

fixes assert statements in unit tests
(cherry picked from commit c9a9621a02)

Co-authored-by: Wojciech Wypior <w.wypior@f5.com>

* Add changelog
2019-09-03 10:44:21 -07:00
Sam Doran
b51fdab9ea [stable-2.8] Fix unit tests to work with pytest >= 5.0 (#60246) (#60332)
pytest made a change in the way the message from ExceptionInfo objects was returned.

https://docs.pytest.org/en/latest/changelog.html#pytest-5-0-0-2019-06-28.
(cherry picked from commit 2d266fbc87)

Co-authored-by: Sam Doran <sdoran@redhat.com>
2019-08-12 18:12:28 -07:00
Sam Doran
fa0cd3782f [stable-2.8] Move assertion in unit test inside loop (#60232)
(cherry picked from commit aa717661af)

Co-authored-by: Sam Doran <sdoran@redhat.com>
2019-08-09 14:40:07 -07:00
Yaakov Selkowitz
5d3f0fe02c facts: fix double-counting of CPUs on POWER systems (#58360)
On POWER systems, /proc/cpuinfo provides a 'processor' entry as a
counter, and a 'cpu' entry with a description (similar to 'model name'
on x86). Support for POWER in get_cpu_facts was added via the 'cpu'
entry in commit 8746e692c1.  Subsequent
support for ARM64 in commit ce4ada93f9
used the 'processor' entry, resulting in double-counting of cores on
POWER systems.

When unit tests were later written for this code in
commit 55306906cf, the erroneous values
were just accepted in the test instead of being diagnosed.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
(cherry picked from commit 93d9d64038)
2019-08-09 14:20:32 -07:00
Jill R
08e23a2a93 Don't truncate cidr_ipv6 addresses in ec2_group.py (#59106)
* Better cidr_ipv6 validation in ec2_group.py

* Improve warning/error handling, add changelog

* Update unit test for ipv6 validation

* Fix logic that was causing non /128 cidrs with host bits to not be handled

(cherry picked from commit 4308b87d72)
2019-08-09 14:02:42 -07:00
Toshio Kuratomi
e08427a138 Correct places where match was intended
pytest.raises has two parameters, message and match.  message is meant
to be the error message that pytest gives when the tested code does not
raise the expected exception.  match is the string that pytest expects
to be a match for the repr of the exception.  Unfortunately, it seems
that message is often mistakenly used where match is meant.  Fix those
cases.

message is also deprecated so removed our usage of it.  Perhaps we
should write a sanity test later that prevents the use of
pytest.raises(message) to avoid this mistake.

seealso: https://docs.pytest.org/en/4.6-maintenance/deprecations.html#message-parameter-of-pytest-raises

Also update the exception message tested for as we're now properly
detecting that the messages have changed.

(cherry picked from commit 87601969a3)

Fix root filter test

On python-2.6 the error message is different

(cherry picked from commit 67fb3a8215)

Fix the pytest match test for python-2.6

(cherry picked from commit 8a880d6032)
2019-07-29 12:08:15 -07:00
Toshio Kuratomi
e2c8a64b45 [stable-2.8] Fix for skipping of gitlab_runner test.
Correct variable name for skipping of the gitlab test when gitlab python
client is not installed.
(cherry picked from commit 0c992d5ae4)

Co-authored-by: Toshio Kuratomi <a.badger@gmail.com>
2019-07-26 15:18:31 -07:00
Tyler Ramer
6e9c928817 [2.8] Address regression causing bootproto=dhcp for manual IP addresses
Commit b7724fdf85
appears to have caused a regression, where `ip4`, `gw4`, `ip6`, `gw6`
were converted to `ipv4.address`, `ipv4.gateway` etc.

This causes bootproto (or `ipv4.method`) to remain `dhcp`, as noted in https://github.com/ansible/ansible/issues/36615

This commit only reverts the key-value pairs to the original names,
which is in line with both expectation (manual ip addr == no dhcp) and
the language used in the playbook, which is, for example, "ip4" not
"ipv4.address"

Co-authored-by: Stuart Pollock <spollock@pivotal.io>
Co-authored-by: Tyler Ramer <tramer@pivotal.io>
(cherry picked from commit 8d0f2e5725)
2019-07-22 17:03:59 -07:00
Sam Doran
2f5c3b3cb4 [stable-2.8] Handle situation where ansible_architecure may not be defined when gathering facts (#55466)
(cherry picked from commit f231f21669)

Co-authored-by: Sam Doran <sdoran@redhat.com>
2019-07-22 16:22:04 -07:00
Sloane Hertel
d170588ab6 [2.8] Define region for aws_secret (#58722)
* AWS: Fix KeyError in aws_secret lookup (#54792)

(cherry picked from commit 33d0d36eaa)

* changelog
2019-07-17 12:11:24 -07:00
pratikgadiya12
0f292cd886 nmcli: Argument vlanid (int) is changed internally to string (#58963)
* Argument vlanid (int) is changed internally to string
* Modified test case to check vlan id

Fixes: #58949
(cherry picked from commit e8f4ebb22c)
2019-07-16 17:57:45 -07:00
Sam Doran
6e7fcf38a8 [stable-2.8] Get minor version number for CentOS and Debian (#57814) (#58538)
* [stable-2.8] 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
(cherry picked from commit ab6a9ef130)

Co-authored-by: Sam Doran <sdoran@redhat.com>

* Add a changelog for the version number in facts change
2019-06-30 16:59:38 -07:00
Toshio Kuratomi
83c04bdec5 [stable-2.8] 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
(cherry picked from commit 8acf71f)

Co-authored-by: Toshio Kuratomi <a.badger@gmail.com>
2019-06-29 11:31:58 -07:00
Sloane Hertel
c67980e07b 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

(cherry picked from commit 826f224f02)
2019-06-29 11:13:55 -07:00
Sam Doran
7700c5086d [stable-2.8] 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.
(cherry picked from commit 6cf6f5a34b)

Co-authored-by: Sam Doran <sdoran@redhat.com>
2019-06-29 11:13:28 -07:00
Felix Fontein
b7cc98e86e 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.

(cherry picked from commit 4a12be31fb)
2019-06-24 15:13:30 -07:00
Mariusz Mazur
d9155944cf Backport/2.8/57685 (#57794)
* 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

(cherry picked from commit 51add5aa79)

* Changelog fragment

* Replace nested function with dict_transformations.dict_merge
2019-06-24 09:26:42 -07:00
Sumit Jaiswal
062074e68e Backport PR to fix ios_facts ansible_net_model (#58174)
* 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>
(cherry picked from commit 58d446e61a)

* fix ansible_net_model

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

* Fix ios test for python2 non-ascii paths

(cherry picked from commit eb7e4591ae)
2019-06-21 15:35:33 -07:00
Daniel Mellado Area
20fa1156b7 Add support for vlan update on ovs bridges (#57168)
This commit adds support for vlan update on openvswitch_bridge module.

(cherry picked from commit 091bebcbf7)
2019-06-19 06:18:30 -07:00
Guillaume Martinez
36df5d22a4 gitlab_runner: Fix idempotency when creating runner (#57833)
(cherry picked from commit ec7b18952b)
2019-06-18 10:51:51 -07:00
Chris Archibald
fa6e39ddf2 Backport/2.8/57320 (#58009)
* new feature

(cherry picked from commit dbeaf30f975190cc20fbece88b12d8dd062aad07)

* add fragment
2019-06-18 10:47:47 -07:00
Anton Nikulin
afb718f001 [stable-2.8] ftd_configuration: fix a bug with response parsing (#57480) (#57676)
* 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

(cherry picked from commit 4fa93d5b9b)

* Add backlog entry
2019-06-17 16:27:42 -07:00
Sloane Hertel
4b0c8f1a12 [FactCache] define first_order_merge method (#55781)
* Add first_order_merge method

Add test for updating a key that already exists

* changelog

(cherry picked from commit 598a058afe)
2019-06-17 15:45:58 -07:00
Trishna Guha
30aba1a7fd nxos_vlan purge fix 2.8 (#57442)
* 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

(cherry picked from commit 6bb13bbb84)

* changelog

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2019-06-11 19:50:35 -07:00
Ondra Machacek
4591f36dcd kubevirt_vm: Improve create VM from template (#56833)
* kubevirt_vm: Improve create VM from template

* kubevirt_vm: Fix checking of VM update

* kubevirt: Fix RS and presets template parameters

* kubevirt_vm: simplify previous change + update comments (#56897)
2019-05-30 07:41:39 -07:00
Nathan Swartz
0365d73102 Backport/2.8/57135 (#57137)
* Fix netapp_e_iscsi_target chap secret size and clearing functionality.

* Add changelogs fragment for PR #57135
2019-05-29 11:55:59 -07:00
Sam Doran
bd011688dd [stable-2.8] 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
(cherry picked from commit 8f4f3750fe)

Co-authored-by: Sam Doran <sdoran@redhat.com>
2019-05-24 10:52:05 -07:00
Gonéri Le Bouder
a42c9d17de 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

(cherry picked from commit cf78759f5b)
2019-05-22 13:36:28 -07:00
Matt Martz
b2364fe748 [stable-2.8] 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
(cherry picked from commit 493cf81)

Co-authored-by: Matt Martz <matt@sivel.net>
2019-05-22 11:44:19 -07:00
Trishna Guha
4f37ce32f3 nxos_vlan fix 2.8 backport (#56211)
* nxos_vlan: vlan names containing regex ctl chars should be escaped (#55463)

The `nxos_vlan` module may raise with regex error `sre_constants.error: multiple repeat` in the non_structured codepath if the device has existing vlan names with certain regex control characters; e.g.

```
VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Eth1/3
14   my-vlan-name-is-***              active
```

(cherry picked from commit de8ce08fd8)

* 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>
(cherry picked from commit 57e0567310)

* nxos_vlan fix 2.8 backport

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2019-05-21 09:36:30 -07:00
EvgenyF
4dae67d712 [stable-2.8] Changing the license to Apache 2
(cherry picked from commit ea4842c0d3)

Co-authored-by: EvgenyF <evgenyf@radware.com>
2019-05-20 12:21:28 -07:00
James Tanner
6dd6501742 [stable-2.8] Nullify improperly licensed test file
(cherry picked from commit 940d58e)

Co-authored-by: James Tanner <tanner.jc@gmail.com>
2019-05-15 15:17:56 -04:00
Trishna Guha
72af010414 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.

(cherry picked from commit 2e8a3efccb)
2019-05-09 12:41:15 -07:00
Alex Stephen
2e4c1dc3cb GCP Deprecations 2019-04-23 13:49:26 -06:00
anasbadaha
2cc91e26e0 Adding Support For Vxlan In Onyx Switches (#55081)
* Adding Support For Vxlan In Onyx Switches

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

* Fix Pep8 Failures in onyx_vxlan.py

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

* Fix Pep8 Failures in onyx_vxlan phase 2

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

* Fix Shippable failures

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

* Fix Samer's Comments on PR

Signed-off-by: Anas Badaha <anasb@mellanox.com>
2019-04-11 20:59:11 +05:30
Swartz, Nathan
5e3a7ec1f5 Improve netapp_e_volume module and add unit tests.
netapp_e_volume was refactored for maintainability and its documentation
was improved for better clarity.
2019-04-11 11:16:45 -04:00
anasbadaha
9bd060292e Adding New Model for Configure Buffer Pool on Onyx Switches (#55082)
* Adding New Model for Configure Buffer Pool on Onyx Switches

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

* Fix Pep8 Failures in onyx_buffer_pool.py

Signed-off-by: Anas Badaha <anasb@mellanox.com>
2019-04-11 11:02:08 +05:30
Chris Archibald
e12846f540 Update na_ontap_export_policy_rule to allow multiple rules to be set at once. (#54801)
* update

* add unit tests
2019-04-10 20:48:49 -04:00
Chris Archibald
c51f840faa Allow for multiple LIFS instead of 1 at a time (#54800)
* upload unit tests
2019-04-11 00:15:08 +02:00
Jordan Borean
ebd4462c23
Fix tests for the psrp connection plugin (#55061) 2019-04-10 08:22:48 +10:00
Matt Martz
fbf2d5d2f4
Don't pollute include_variables (#54687)
* Don't pollute include_variables. Fixes #51667. Fixes #54618.

* Rename include_variables to include_args, so we can make the distinction about what they are

* Track args and vars separately

* oops

* oops again

* linting fix

* Add test
2019-04-09 10:14:42 -05:00
Sam Doran
6761fc1475
Update distro unit test (#55003)
Remove test comparing output to platform.linux_distribution() since we are relying on distro.id() and are not concerned about matching the output of platform.linux_distribution()
2019-04-08 16:26:31 -04:00
Chris Archibald
c6f12eea32 push fix (#54916) 2019-04-08 13:11:42 +01:00
Anil Kumar Muraleedharan
f5d97205a0 The module fails on switchport. Check added to fix. (#54970) 2019-04-08 10:41:36 +05:30
Bruno Inec
c637104078 Allow Netbox device modification (#53631)
* netbox_device: Allow device modification

* Add ability to update and existing device
* Allow check_mode
* Fail when device name is missing
* Fail when cannot resolve ID instead of taking ID 1 by default

* netbox_device: Add diff output

* netbox: Some refactoring

* Add diff output and check_mode to netbox_ip_address
* Deduplicate redundant code into netbox_utils

* netbox_utils: A few unit tests
2019-04-07 15:47:11 +05:30
Brian Coca
bda541fa0d
fix missing attribs with dirct module execution (#53875)
* fix missing attribs with dirct module execution
* also make remote tmp handling smarter
 update tests
* set default if attrib does not exist
* add simple test
2019-04-04 09:59:52 -04:00
Claes Nästén
339f6cfcd1 NSO modules now work as expected with NSO 5.X (#54766)
Update NSO modules for NSO 5.0 which change how prefix mapping is made
as a single prefix can have multiple meanings depending on device
being managed
2019-04-03 20:56:35 +01:00
Federico87
48e83c39ba ASA network/service object-group module (#52925)
* add asa_og module

* add test

* fix pep8

* fix some sanity pylint

* fix import error order

* fix import

* replace cmd() method

* rename file and class

* add mock for connection

* fix commands in  replace test function

* fix lines list

* update unit test

* fix 'and' logic for port-object command

* restore previous unit test; fix pep8 and remove debug

* other unit tests

* Add state present, absent, replace

* Update doc; add default for state

* update unit test with state present/absent

* fix typo in unit test

* fix pep8 too many blank lines

* fix show run for service object ASA Ver 8.x

* Add description field; fix bug for state present and absent

* Re-designed module structure for network, service and port objects

* update integration test for new module structure

* fix pep8

* update EXAMPLES and RETURN

* update units tests

* fix module typos in unit test

* removed provider from examples

* fix missing comma in replace test

* fix module name and remove provider

* update license

* remove register; update license; change import order; chage def state

* remove shebang

* fix doc default state

* change import order

* Update year in banner

* fix integration test as set of tasks

* remove arg_spec

* remove extends_documentation_fragment: asa

* Update DOC, remove unused import, change import order
2019-04-03 23:22:45 +05:30
Chris Archibald
ec03ddd336 Multiple fixs for na_ontap_user (#54610)
* Fix ontap user for 9.1

* fix bugs:

* update unit tests
2019-04-01 17:22:48 +01:00