Commit graph

3560 commits

Author SHA1 Message Date
James Cammarata
f1c458303a Backport of b107e397 (Cache tasks as they are queued)
* Cache tasks as they are queued instead of en masse

This also moves the task caching from the PlayIterator to the
StrategyBase class, where it makes more sense (and makes it easier
to not have to change the strategy class methods leading to an API
change).

Fixes #31673

* Cleaning up unit tests due to 502ca780

(cherry picked from commit b107e397cb)
2018-01-15 10:04:08 -08:00
Matt Davis
79d1ba35ad
Cherrypick misc Azure test fixes (#34713)
* Fix test case failure for Azure ACS module (#33623)

* fix azure acs test failure

* change acs location

(cherry picked from commit 8e20ae2de4)

* fix azure test case failure for function apps module (#33658)

(cherry picked from commit f8d7e477f0)

* Fix storage endpoint for Azure Stack (#33946)

* Fix storage endpoint for Azure Stack

https://github.com/Azure/msrestazure-for-python/issues/64

* corrected visual indentation

(cherry picked from commit 6643fe821e)

* Fix incorrect formatting call in azure module (#33561)

Fix corrects formatting call in azure_rm_resourcegroup_facts module.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
(cherry picked from commit 6654d69569)
2018-01-10 13:27:52 -08:00
Matt Davis
6f679b45de cherry-pick #34442 2018-01-09 23:29:31 -08:00
Matt Clay
02b1d90cf3 Make xattr test conditional on feature support.
(cherry picked from commit 77726b471f)
2018-01-08 23:57:50 -08:00
Jordan Borean
9a5bca5668 fix windows tests after recent patch (#34548)
(cherry picked from commit 460deb08cb)
2018-01-07 14:09:25 +10:00
James Cammarata
0b7d78d67f
Don't use getattr in _get_parent_attribute to avoid recursion issues (#33595) (#34532)
* Don't use getattr in _get_parent_attribute to avoid recursion issues

Fixes #23609

* Move extend/prepend to field attribute

Also removes _get_attr* methods that were basically just calling
_get_parent_attribute because it needed to set those params.

Also modifies _get_parent_attribute() to pull those values from the
FieldAttributes instead of using the ones passed into the function.

* Better fixes for _get_parent_attribute
2018-01-05 23:20:47 -06:00
Toshio Kuratomi
1546ddb3c3 Fix up the test-set_mode_if_different unittests 2018-01-04 21:05:38 -08:00
Jordan Borean
cb92c4bea1 win_package: remove case sensitive check for msi extension (#34476)
(cherry picked from commit da69f5aeae)
2018-01-05 07:13:18 +10:00
Matt Davis
3a853fc9b8 fix win_firewall test failure on 2008/2008r2 (#34391)
* ensure that "starting" profile is known instead of relying on default
2018-01-03 05:36:40 -05:00
Matt Davis
cbc07cf9cc backport win_firewall_rule updates
from devel  SHA 89d9444ad560ef5c4a8aac911e2e7abcf7aa9c76
2018-01-02 20:38:00 -08:00
Trishna Guha
284625f18c
NXOS Commit Integration tests to Ansible (part 2) (#28939) (#33964)
* add nxos_aaa_server IT

* add nxos_aaa_server_host ITs

* Add nxos_gir IT

* Add nxos_gir_profile_management IT

* add newly added tests to nxos.yaml

* fix nxos.yaml indentation

* fix indentation again

* skip nxos_git_profile_management IT for titanium

* change idempotency to non-idempotency check

(cherry picked from commit a130549ead)
2017-12-16 10:10:19 +05:30
Maxime de Roucy
86fbaffc07 fix file attributes changed detection
https://docs.python.org/2/library/stdtypes.html#str.split
str.split([sep[, maxsplit]])
If sep is given, consecutive delimiters are not grouped together and are deemed
to delimit empty strings.

>>> "85563      ----------------C-- /var/lib/libvirt/images".split(' ')[0:2]
['85563', '']
>>> "85563      ----------------C-- /var/lib/libvirt/images".split()[0:2]
['85563', '----------------C--']

(cherry picked from commit c2ac9d0831)
2017-12-15 09:50:29 -08:00
Jordan Borean
5dd40349b2 win_iis_webapppool: stop any passwords from being returned (#33931)
(cherry picked from commit 0ca828ebab)
2017-12-15 09:52:52 +10:00
Ganesh Nalawade
2a007e2b4d
Fix ios_interface integration test failure (#33901) 2017-12-14 14:17:08 +05:30
Ganesh Nalawade
13937ce772
ios_config save (#33791) (#33872)
* Fixing save so it still works. Adding changed as an option for save_when.

* Updating unit tests.

* Updating description to state that changed was added in 2.5.

(cherry picked from commit 3a9083cf48)

* Update Changelog
2017-12-13 22:31:09 +05:30
Matt Martz
926dfb7c04 Add test for clean_copy preservation of keys
(cherry picked from commit 5c63bb0090)
2017-12-12 14:27:41 -06:00
Toshio Kuratomi
109471cb7f Remove files from legacy that pass now that W503 is ignored 2017-12-08 11:28:39 -08:00
John R Barker
c7a903c34b Ignore W503 in stable-2.4 (#33716)
* Ignore W503

To avoid backporting from devel (2.5) to 2.4 any code that may fail pep8
backport the current-ignore change.
2017-12-08 10:45:10 -08:00
s-hertel
6a6ae0cede loop doesn't exist in 2.4 2017-12-08 09:53:51 -08:00
Sloane Hertel
f2bf74991e Fix using loops with environment and add tests (#32796)
(cherry picked from commit 7bb35e8781)
2017-12-08 07:22:11 -08:00
Trishna Guha
790e290b6b loopback doesn't support passive_interface (#33252)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
(cherry picked from commit 25a465ffcb)
2017-12-06 12:08:10 -08:00
Martin Krizek
ada8453271 Fix include in loop when stategy=free (#33094)
(cherry picked from commit 3a2a1e054f)
2017-12-06 11:40:09 -08:00
Matt Clay
60bf72d69e Limit pytest < 3.3.0 for python 2.6.
(cherry picked from commit 58286ef93b)
2017-12-05 22:27:16 -08:00
Matt Clay
2b9dd23377 Limit paramiko to < 2.4.0 for python 2.6.
(cherry picked from commit 5f5e150771)
2017-12-05 22:27:11 -08:00
Matt Clay
c422d7a8c6 Update FreeBSD completion for ansible-test.
(cherry picked from commit 73132d3906)
2017-12-05 21:32:43 -08:00
Martin Krizek
5340da2a7d selinux: check if policy exists before switching (#31834)
* selinux: check if policy exists before switching

* Check the policy dir

(cherry picked from commit 0592fd47bc)
2017-11-30 16:10:36 -05:00
R. Francis Smith
f0741ecaa0 updated pamd rule args regexp to match file paths also (#33432)
* Added . and / to rule args regexp

Things like pam_echo.so file=/etc/foo.txt weren't being matched and
causing incorrect change counts.  Adding / and . fixed that.

Fixes #33351

(cherry picked from commit e957760d52)
2017-11-30 16:02:39 -05:00
Mike Wiebe
9845e5a018 Use show command to support wider platform set for nxos_interface module (#33037)
* Use show command to support wider platform set

* Fix unit tests

(cherry picked from commit 95a2140f4b)
2017-11-22 18:28:17 -08:00
Matt Clay
5fa8480a61 Use an abspath for network inventory ssh key path.
(cherry picked from commit 1ee511f82c)
2017-11-22 11:11:58 -08:00
Matt Clay
51d21b0f41 Update vyos completion in network.txt.
(cherry picked from commit 3a6fad38fa)
2017-11-22 10:12:04 -08:00
Matt Clay
5866aac64b Use vyos/1.1.8 in CI.
(cherry picked from commit 887f227994)
2017-11-22 10:05:16 -08:00
Brian Coca
db83d420af jsonify inventory (#32990)
* jsonify inventory
* smarter import, dont pass kwargs where not needed
* added datetime
* Eventual plan for json utilities to migrate to common/json_utils when we split
  basic.py no need to move jsonify to another file now as we'll do that later.
* json_dict_bytes_to_unicode and json_dict_unicode_to_bytes will also
  change names and move to common/text.py at that time (not to json).
  Their purpose is to recursively change the elements of a container
  (dict, list, set, tuple) into text or bytes, not to json encode or
  decode (they could be a generic precursor to that but are not limited
  to that.)
* Reimplement the private _SetEncoder which changes sets and datetimes
  into objects that are json serializable into a private function
  instead.  Functions are more flexible, less overhead, and simpler than
  an object.
* Remove code that handled simplejson-1.5.x and earlier.  Raise an error
  if that's the case instead.
  * We require python-2.6 or better which has the json module builtin to
    the stdlib.  So this is only an issue if the stdlib json has been
    overridden by a third party module and the simplejson on the system
    is 1.5.x or less.  (1.5 was released on 2007-01-18)
(cherry picked from commit ebd08d2a01)
2017-11-21 13:44:51 -08:00
Ganesh Nalawade
ecf2dfd6d5
Fix junos integration test fixes as per connection refactor (#33050) (#33055)
(cherry picked from commit ce04f6e961)
2017-11-19 12:24:44 +05:30
Matt Clay
2f1a60ddac Fix and re-enable zypper* integration tests in CI.
(cherry picked from commit 781219bcfd)
2017-11-17 15:14:59 -08:00
Ganesh Nalawade
2f6e03956f
Fix ios_config integration test failures (#32959) (#32970)
(cherry picked from commit ba0aade8f4)
2017-11-16 18:38:52 +05:30
Trishna Guha
a890108dac
Integration Tests only: nxos_udld, nxos_udld_interface, nxos_vxlan_vtep_vni (#29143) (#32962)
* it cases for vxlan_vtep_vni, udld

* platform specific testing

* fix vxlan_vtep for n7k

* fix udld_intf setup

* skip udld tests on titanium n7k

* remove hardcoding

* fix udld tests for titanium

(cherry picked from commit aef50eaa40)
2017-11-16 07:47:28 +00:00
Trishna Guha
8398de77b2
Fix nxos_snmp_host bug (#32916) (#32958)
* Fix nxos_snmp_host bug (#32916)

* Fix nxos_snmp_host bug

* Enable nxos_snmp_host tests

(cherry picked from commit 208208ab8f)

* update changelog

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-11-16 06:22:02 +00:00
Jordan Borean
b059dfe69f removed psobject to hashtables that were missed (#32710)
* removed psobject to hashtables that were missed

* fix up win_region change

(cherry picked from commit 5e20fd0943)
2017-11-16 08:57:27 +10:00
Matt Clay
2bef683fde Fix ansible-test race calling get_coverage_path.
(cherry picked from commit ef21038dd5)
2017-11-15 12:59:51 -08:00
Matt Clay
c4f61a9db4 Add missing ansible-test --remote-terminate support. (#32918)
* Expand ansible-test --remote-terminate support:

- windows-integration
- network-integration

These commands previously accepted the option, but did not support it.

* Terminate windows and network instances when done.

(cherry picked from commit 6472723ba8)
2017-11-15 12:59:47 -08:00
Adrian Likins
f68330acb2 Fix vault --ask-vault-pass with no tty (#31493)
* Fix vault --ask-vault-pass with no tty

2.4.0 added a check for isatty() that would skip setting up interactive
vault password prompts if not running on a tty.

But... getpass.getpass() will fallback to reading from stdin if
it gets that far without a tty. Since 2.4.0 skipped the interactive
prompts / getpass.getpass() in that case, it would never get a chance
to fall back to stdin.

So if 'echo $VAULT_PASSWORD| ansible-playbook --ask-vault-pass site.yml'
was ran without a tty (ie, from a jenkins job or via the vagrant
ansible provisioner) the 2.4 behavior was different than 2.3. 2.4
would never read the password from stdin, resulting in a vault password
error like:

        ERROR! Attempting to decrypt but no vault secrets found

Fix is just to always call the interactive password prompts based
on getpass.getpass() on --ask-vault-pass or --vault-id @prompt and
let getpass sort it out.

* up test_prompt_no_tty to expect prompt with no tty

We do call the PromptSecret class if there is no tty, but
we are back to expecting it to read from stdin in that case.

* Fix logic for when to auto-prompt vault pass

If --ask-vault-pass is used, then pretty much always
prompt.

If it is not used, then prompt if there are no other
vault ids provided and 'auto_prompt==True'.

Fixes vagrant bug https://github.com/hashicorp/vagrant/issues/9033

Fixes #30993

(cherry picked from commit 86dc3c09ac)
2017-11-15 14:07:39 -05:00
Sam Doran
1379e77bf1 Add proper check mode support to the script module (#31852)
* Do not run script in check mode

Fixes #30676

* Reformat script integration test

* Add integration tests for check mode of script module

* Fix name on test

* Cleanup temp file

* win_script integration test syntaxt changes

* Add check mode tests for win_script

* Use proper variable in test

* Fail if source file does not exist

* Verify script is accessible and don't copy in check mode

Use shlex to properly split shell arguments, though a path with spaces in it still needs to be quoted in the playbook.
Add note to docs describing such.
Improve error message if file is not found indicating there may be a space in the path.

* Properly encode path now that path is split using shlex

* Allow for spaces in both path and script name

* Add unicode character test to Linux script tests

* Add Linux test for space in path to script

(cherry picked from commit ea3638b580)
2017-11-14 11:10:25 -05:00
Trishna Guha
545bd41927
multiple nxos fixes (#32905)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-11-14 15:23:49 +00:00
Trishna Guha
8b19c1c02d
change inventory_hostname to ansible_host to fix test (#32890) (#32891)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
(cherry picked from commit 11de330372)
2017-11-14 10:48:35 +00:00
Ganesh Nalawade
363e605ac4
Change netconf port in testcase as per test enviornment (#32883) (#32889)
(cherry picked from commit c3636108bc)
2017-11-14 15:39:39 +05:30
Trishna Guha
4433544eb0
Fix snmp bugs on Nexus 3500 platform (#32773) (#32847)
* Add n35 platform support

* Fix regex bug and add snmp_location it tests

* Enable nxos_snmp_location tests

(cherry picked from commit de8d00b401)
2017-11-13 11:54:12 +00:00
Adrian Likins
29bdd0b326 Better handling of malformed vault data envelope (#32515)
If an embedded vaulted variable ('!vault' in yaml)
had an invalid format, it would eventually cause
an error for seemingly unrelated reasons.
"Invalid" meaning not valid hexlify (extra chars,
non-hex chars, etc).

For ex, if a host_vars file had invalid vault format
variables, on py2, it would cause an error like:

  'ansible.vars.hostvars.HostVars object' has no
  attribute u'broken.example.com'

Depending on where the invalid vault is, it could
also cause "VARIABLE IS NOT DEFINED!". The behavior
can also change if ansible-playbook is py2 or py3.

Root cause is errors from binascii.unhexlify() not
being handled consistently.

Fix is to add a AnsibleVaultFormatError exception and
raise it on any unhexlify() errors and to handle it
properly elsewhere.

Add a _unhexlify() that try/excepts around a binascii.unhexlify()
and raises an AnsibleVaultFormatError on invalid vault data.
This is so the same exception type is always raised for this
case. Previous it was different between py2 and py3.

binascii.unhexlify() raises a binascii.Error if the hexlified
blobs in a vault data blob are invalid.

On py2, binascii.Error is a subclass of Exception.
On py3, binascii.Error is a subclass of TypeError

When decrypting content of vault encrypted variables,
if a binascii.Error is raised it propagates up to
playbook.base.Base.post_validate(). post_validate()
handles exceptions for TypeErrors but not for
base Exception subclasses (like py2 binascii.Error).

* Add a display.warning on vault format errors
* Unit tests for _unhexlify, parse_vaulttext*
* Add intg test cases for invalid vault formats

Fixes #28038

(cherry picked from commit 9c58827410)
2017-11-10 14:31:32 -05:00
Ganesh Nalawade
5944a447f7
Fix ios_config file prompt issue (#32744) (#32780)
Fixes #23263

Add a carriage return (\r) at end on copy config
command which results in prompt on cli terminal
(cherry picked from commit 37b0537279)

Update CHANGELOG.md
2017-11-10 20:32:35 +05:30
Ganesh Nalawade
eb4c5936f3
Fix junos netconf port issue in integration test (#32610) (#32668)
(cherry picked from commit 6d1d06e0f7)
2017-11-10 20:32:06 +05:30
Chris Meyers
f00f2466d4 tests for InventoryModule error conditions (#31381)
* tests for InventoryModule error conditions

* modified unicode in tests to ahear to Ansible best practices

* flake8 fixes

(cherry picked from commit cf938e9992)
2017-11-08 10:56:19 -08:00