Commit graph

3590 commits

Author SHA1 Message Date
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
Jordan Borean
e771b64f1b win_service: quoted path fix (#32469)
* win_service: fix for path in quotes

* Added tests to verify behaviour doesn't regress

(cherry picked from commit 5b1db00b65)
2017-11-03 09:56:08 +10:00
Matt Davis
82c2da31be lock azure containerservice to below 2.0.0
* supersedes/fixes #32518
* only for 2.4.x - we'll make the necessary code changes for 2.5 to work with the updated version
2017-11-02 16:34:29 -07:00
Pilou
35d942d6a0 Fix include_role unit tests (#31920)
* Ensure include_role unit tests check something

This is not the case: get_tasks_vars doesn't yield

* Fix include_role unit tests

Since e609618274, include_role are not
static anymore.

(cherry picked from commit 43914b3837)
2017-11-02 08:39:32 -07:00
Jordan Borean
6a7333950a win_find: allow module to skip on files it fails to check (#32105)
* win_find: allow module to skip on files it fails to check

* fixed up test creation to work pre psv5

(cherry picked from commit 56a7278256)
2017-11-02 09:36:53 +10:00
Ganesh Nalawade
bc01b5d981
eos_eapi: adding the desired state config to the new vrf fixes #32111 (#32112) (#32452)
* adding the desired state config to the new vrf fixes #32111

* fix default vrf initial configured

* add unit test

* Update CHANGELOG

(cherry picked from commit 2c99cbc874)
2017-11-01 23:02:51 +05:30
Ganesh Nalawade
b8ee3bb24f
Fix wrong prompt issue for network modules (#32426) (#32442)
* Fix wrong prompt issue for network moodules

Fixes #31161
Fixes #32416

*  Store the device prompt in case of error
   from remote device
*  Check for prompt value in ios action plugin

*  Add integration test
*  Update Changelog

(cherry picked from commit 26583adb58)
2017-11-01 22:35:47 +05:30
Kedar K
cc0a18e5bd Fixes ios_logging unit test (#32240)
(cherry picked from commit 2aae66fa07)
2017-11-01 08:55:01 -07:00
Paul Neumann
ebd559c43a ios_system: Fix typo in unit test (#32284)
(cherry picked from commit 87f663b950)
2017-11-01 08:54:07 -07:00
Paul Neumann
de60b9e1a8 ios_logging: Fix some smaller issues, add unit test (#32321)
* ios_logging: Fix typo in documentation

* ios_logging: Fix traceback when setting buffered destination without size

When the size parameter is not configured while configuring the buffered
destination, a traceback occurs due to the fact that validate_size expects the
parameter to be an int. Explicitely converting value to int makes the
check work for every case.

* ios_logging: Update size parameter documentation

Update the documentation of the size paramter to reflect the current behaviour
of setting a default of 4096 for the buffered dest.

* ios_logging: Add unit test

Add unit test for ios_logging testing the behaviour clarified in the previous
commits.

* ios_logging: Fix python 2.6 compliance

(cherry picked from commit 53fead7c96)
2017-11-01 08:53:39 -07:00
saichint
7967b75980 Integration Tests only: add static route, snmp_user, snapshot and hsrp it cases (#28933)
* add static route and hsrp it cases

* add snmp_user and snapshot it

* password strength correction

* fix typo

* add compare snapshot as it is fixed in the code now

* skip snapshot tests for titanium

* titanium and nxapi conditions added

(cherry picked from commit c822292347)
2017-11-01 08:53:11 -07:00
Trishna Guha
0711f41e3d
ios_interface testfix (#32381)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-10-31 16:39:04 +05:30
Trishna Guha
618b4999fb
fix CI failure yaml syntax (#32374)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-10-31 12:45:14 +05:30
Trishna Guha
8453398dd4
fix ios_interface test (#32372)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-10-31 11:58:22 +05:30
Matt Martz
071f86afc6 Fix patching to epel package
(cherry picked from commit be9cc70b74)
2017-10-30 14:40:23 -07:00
Trishna Guha
497c73d06e
iosxr integration testfix (#32344)
* Replace GigabitEthernet0/0/0/5 for GigabitEthernet0/0/0/2 in iosxr_interface intent tests (#32116)

There's no 5 interface present in CI nodes.
(cherry picked from commit f079a33563)

* Replace Gigabit0/0/0/2 for Gigabit0/0/0/1 on iosxr_interface.intent (#32120)

(cherry picked from commit a9d8157e81)

* Add ansible_ssh_port to iosxr_user auth tests (#32117)

The CI nodes listen on port 8022, we need to plumb that to avoid
test failures.
(cherry picked from commit 676d446cfc)
2017-10-30 19:24:48 +05:30
Trishna Guha
262d6b6dcc
ios_ping test fix (#32342)
* Introspect the management IP on ios_ping (#31571)

On our CI we don't have external connectivity, so let's ping to
the management interface IP.
Also, ignore errors on the expected failures tests.
(cherry picked from commit c75c4cbfc8)

* Remove duped authorize on ios_ping anchored tasks (#31572)

Otherwise, we get warnings.
(cherry picked from commit ac95ecaf13)

* Introspect platform before running ios tests

* Add authorize

* Fix quotes on ios_ping test (#32131)

(cherry picked from commit ca115b0a8e)

* Fix lookup source tests on ios_system (#32254)

In IOS-XE, you need to pass an interface to lookup-source, otherwise
it fails with bad syntax.
(cherry picked from commit 4b35793f62)

* Remove ip nameservers on ios_system/set_name_servers teardown (#32239)

Not sure why lookup source-interface, the only thing tested on that
file is adding/removing name servers, no lookup is set.
(cherry picked from commit 9752ce368d)

* fix conflict

* Update CHANGELOG

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-10-30 19:17:16 +05:30
Trishna Guha
2c4cb42337
ios_interface provider issue testfix (#32335)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-10-30 11:55:55 +05:30
Trishna Guha
b6c117ebdd
eos_user testfix (#32264)
* Fix eos_user tests (#32261)

(cherry picked from commit be821845e2)

* Add eos_user testfix to CHANGELOG

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-10-27 22:04:25 +05:30
Trishna Guha
e2065dc68c Remove provider from ios integration test (#31037) (#32230)
* Remove provider from  ios integration test (#31037)

*  Remove provider from each task as it is not required.
*  Add `authorize: yes` whereever required
(cherry picked from commit 65ab37cbd3)

* CHANGELOG entry for ios tests fix

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2017-10-27 11:49:40 +05:30
Ryan Brown
a0c123a86e [cloud] Bugfix for aws_s3 empty directory creation (#32198)
* [cloud] Bugfix for aws_s3 empty directory creation

Backport of #32169

* Only make DeleteObject call if there are objects to delete

* Remove pauses from integration tests
2017-10-26 15:04:00 -04:00
Matt Clay
dc90280b8f Disable pylint rules for stable-2.4.
ci_complete
2017-10-26 12:00:57 -07:00
Matt Clay
8d91a6d72e Update ansible-test sanity command. (#31958)
* Use correct pip version in ansible-test.
* Add git fallback for validate-modules.
* Run sanity tests in a docker container.
* Use correct python version for sanity tests.
* Pin docker completion images and add default.
* Split pylint execution into multiple contexts.
* Only test .py files in use-argspec-type-path test.
* Accept identical python interpeter name or binary.
* Switch cloud tests to default container.
* Remove unused extras from pip install.
* Filter out empty pip commands.
* Don't force running of pip list.
* Support delegation for windows and network tests.
* Fix ansible-test python version usage.
* Fix ansible-test python version skipping.
* Use absolute path for log in ansible-test.
* Run vyos_command test on python 3.
* Fix windows/network instance persistence.
* Add `test/cache` dir to classification.
* Enable more python versions for network tests.
* Fix cs_router test.

(cherry picked from commit cf1337ca9a)
2017-10-26 12:00:57 -07:00
Matt Clay
29b50d99c7 Add missing packages to default docker image.
(cherry picked from commit 5663d11b94)
2017-10-26 12:00:57 -07:00
Matt Clay
4978fc633c Fix ansible-test default image. (#31966)
* Add openssh-client to default docker container.
* Include Azure requirements in default container.

To do so, handling of pip requirements was updated to install each
set of requirements separately and then run a verification pass to
make sure there are no conflicts between requirements.

* Add missing --docker-no-pull option.
* Add documentation for the azure-requirements test.

(cherry picked from commit 36b13e3e3d)
2017-10-26 12:00:57 -07:00
Matt Clay
0483401339 Add new default Docker container for ansible-test. (#31944)
* Add new default Docker container for ansible-test.
* Update ansible-test change classification.
* Update list of disabled pylint rules.
* Fix pylint issues with ansible-test.

(cherry picked from commit f76afab6e5)
2017-10-26 12:00:57 -07:00
Matt Clay
dbe3a44a46 Improve python 2/3 ABC fallback for pylint. (#31848)
* Improve python 2/3 ABC fallback for pylint.
* Allow longer method names in ansible-test.

(cherry picked from commit 6c3339402a)
2017-10-26 12:00:57 -07:00
Dave Thelen
2340c7ac6e eos_user: sends user secret first on user creation fixes #31680 (#32162)
* fix command order

* add integration test

* test cleanup

* remove redudant commands

(cherry picked from commit 602a618e60)
2017-10-26 07:43:19 -07:00
rahushen
541d5db97a NXOS: Integration tests to Ansible (part 3) (#29030)
* Add nxos_file_copy IT

* Restructure nxos_igmp tests

* add nxos_igmp_interface IT

* add nxos_igmp_snooping IT

* add nxos_ntp_auth IT

* Add nxos_ntp_options IT

* update nxos.yaml with new tests

* update nxos_ntp_options test

* update nxos_ntp_auth IT

(cherry picked from commit ab84718a01)
2017-10-26 07:38:23 -07:00
Kedar K
70c3aefdaf - Fix to return error message back to the module. (#31035)
(cherry picked from commit 916e6be888)
2017-10-26 07:38:23 -07:00
Ganesh Nalawade
bc12de27dd Remove provider from prepare_ios_tests integration test (#31038)
(cherry picked from commit b86eea9a52)
2017-10-26 07:38:23 -07:00
rahushen
0aa015de5e change ports to non well known ports and drop time_range for N1 (#31261)
(cherry picked from commit c976ac7ed6)
2017-10-26 07:38:23 -07:00
Brian Coca
b61bfc87b8 better cleanup on task results display (#27175)
* better cleanup on task results display

callbacks get 'clean' copy of result objects
moved cleanup into result object itself
removed now redundant callback cleanup
moved no_log tests

* moved import as per feedback

(cherry picked from commit 01b6c7c9c6)
2017-10-26 07:32:33 -07:00
Matt Clay
3f4005038d Fix docker_secret integration test dependencies.
(cherry picked from commit eb899c9bcd)
2017-10-18 14:37:33 -07:00
Abhijeet Kasurde
7e6554b9ff Correct usage for shutil.rmtree (#31541)
* Correct usage for shutil.rmtree

Fix adds correct usage of shutil.rmtree in git module

Fixes: #31225

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

* Include archive tests so they get run

* Use new include syntax

* Cleanup syntax on git tests

- use multi-line YAML
- remove unneeded {{ }} around vars in conditionals
- remove unneeded quotes
- add task file name to task names for easier troubleshooting when things fail

* Make archive tests work for RHEL/CentOS 6

The older versions of Jinja2 in RHEL/CentOS 6 required assertion tasks using the map filter to be skipped.

The older version of git required gzip compression to be skipped on RHEL/CentOS 6.

* Account for ansible_distribution_major_version missing

(cherry picked from commit a047fe0e4c)
2017-10-18 14:14:24 -07:00
Jordan Borean
466baba040 win_regedit: fix extra info coming into stdout (#31813)
(cherry picked from commit 888de842b3)
2017-10-18 14:09:18 -07:00
Matt Clay
5d2f07aebb Multiple Parallels host support for ansible-test. (#31552)
(cherry picked from commit 05ec376197)
2017-10-12 11:56:48 -07:00
Matt Clay
e8d4667b87 Remove cryptography install from CI other test.
(cherry picked from commit 03e18aa52e)
2017-10-12 07:36:07 -07:00
Matt Clay
78cb32ccb7 Update Azure tests to limit cryptography version. (#31616)
(cherry picked from commit 8acb901bf2)
2017-10-11 19:19:21 -07:00
Ganesh Nalawade
e001fb7c14 Fix rollback in junos_config (#31424) (#31563)
* Fix rollback in junos_config (#31424)

* Fix rollback in junos_config

Fixes #30778

*  Call `load_configuration` with rollback id in case
   the id is given as input
*  Pass rollback id to `get_diff()` to fetch diff from device

* Fix unit test

(cherry picked from commit 88da95bb77)

* Update changelog
2017-10-11 15:28:42 +05:30
Toshio Kuratomi
e60e70ccd6 Try to cleanup after the rpm_key test
(cherry picked from commit dde2c96d67)
2017-10-10 17:41:06 -07:00
Lukas Bednar
ead2fc5a64 [rpm_key] Fix to import first key on the system (#31514)
* [rpm_key] Fix to import first key on the system

Fixes: #31483

* [rpm_key] removed unsafe_shell and "throwaway" underscore

* [rpm_key] adding test to add the first key on system

(cherry picked from commit 5ccc1072ea)
2017-10-10 10:59:03 -07:00
Sam Doran
60874bad3e Remove sysctl entries when state=absent (#31486)
* Remove sysctl entry when state=absent
* Cleanup sysctl integration test syntax
* Correct grammar on error message
* Add sysctl integration test for state=absent
(cherry picked from commit 2610b521bc)
2017-10-10 09:01:53 -07:00
Jordan Borean
cb39aed465 win_copy: allow src to have invalid windows chars (#31392)
* win_copy: allow src to have invalid windows chars

* create file with colon instead of avoid checkout errors

(cherry picked from commit c4b51009f0)
2017-10-06 15:24:20 +10:00
Sam Doran
71e0540016 Make ansible_selinux facts a consistent type (#31065)
* Make ansible_selinux facts a consistent type

Rather than returning a bool if the Python library is missing, return a dict with one key containing a message explaining there is no way to tell the status of SELinux on the system becasue the Python library is not present.

* Fix unit test

(cherry picked from commit e7902d888c)
2017-10-05 09:19:56 -04:00
Matt Clay
72154072bb Switch CI for OS X back to a single job. (#31265)
* Update Shippable scripts for group/non-group use.
* Switch CI for OS X back to a single job.

(cherry picked from commit 5a91ed0a3b)
2017-10-04 13:26:13 -07:00
Matt Clay
389356d612 Run OS X and FreeBSD CI tests using groups. (#31254)
* Run OS X and FreeBSD CI tests using groups.
* Improve readability of Shippable jobs.

(cherry picked from commit 72237b63e7)
2017-10-04 13:26:13 -07:00
Matt Clay
e25d44f97c Run all Windows tests if change detection disabled (#30320)
* Run all Windows tests if change detection disabled
* Run all Windows versions if change detection disabled

(cherry picked from commit 765718bed2)
2017-10-04 13:26:13 -07:00
Matt Clay
75bfd4cf2f Update Windows CI groups from 2 to 3.
(cherry picked from commit c00ad0868e)
2017-10-04 13:26:13 -07:00
Matt Clay
2572b2147e Fix ansible-test config management.
(cherry picked from commit a333f2e5b0)
2017-10-04 12:53:29 -07:00
Sam Doran
e157082f5e Correctly write SELinux config file (#31251)
* Add new lines to end of config file lines

* Properly write out selinux config file

Change module behavior to not always report a change but warn if a reboot is needed and return reboot_required.

Improve the output messages.

Add strip parameter to get_file_lines utility to help with parsing the selinux config file.

* Add return documentation

* Add integration tests for selinux module

* Use consistent capitalization for SELinux

* Use atomic_move in selinux module

* Don't copy the config file initially

There's no need to make a copy just for reading.

* Put message after set_config_policy in case the change fails

* Add aliases to selinux tests

(cherry picked from commit 00df1fda10)
2017-10-03 23:42:33 -04:00
Jordan Borean
39196a7f2f win_become: move error handling to Ansible outside of shell (#31227)
* win_become: move error handling to Ansible outside of shell

* trimmed the output so double newlines don't get set

* added test for non-zero exit code

* missed issue URL on test

* changed exit to SetShouldExit

(cherry picked from commit e61c2799ff)
2017-10-04 13:07:36 +10:00
Sam Doran
88a2c3c047 Update elasticsearch_plugin.py (#28936)
* Update elasticsearch_plugin.py

Change module to work with Elasticsearch 2.x and 5.x automatically.
Update examples and docs.
Supersedes #21989

* Check system paths for elasticsearch-plugin binary

Use get_bin_path from basic.py for searching paths.

* Create a copy of PLUGIN_BIN_PATHS rather than modifying the global

* Use provided plugin_bin path first before trying other places

Change global PLUGIN_BIN_PATHS to a tuple

(cherry picked from commit a5ee865634)
2017-10-03 22:30:30 -04:00
Jordan Borean
df4daeb9a9 win_copy: fix for copying encrypted file without pass (#31084)
* win_copy: fix for copying encrypted file without pass

* fix pep8 issue

* reduced the diff and fixed some minor issues

(cherry picked from commit bba941cd5b)
2017-10-03 12:52:43 -07:00
Adrian Likins
74e0643dbb Handle vault decrypt --output=- (#31066)
In cli.CLI.unfrack_path callback, special case if the
value of '--output' is '-', and avoid expanding
it to a full path.

vault cli already has special cases for '-', so it
just needs to get the original value to work.

Fixes #30550
(cherry picked from commit 278ff19bea)
2017-10-03 14:20:31 -04:00
Brian Coca
c6691eef52 remove unused ssh pipelining setters
fixes #31125

(cherry picked from commit 101377768b)
2017-10-03 09:22:49 -04:00
Jordan Borean
737a0d6015 win_dotnet_ngen: fix after broken in 2.4 (#31076)
* win_dotnet_ngen: fix after broken in 2.4

* added description to return values

(cherry picked from commit 12a4dca447)
2017-10-03 06:39:51 +10:00
Jordan Borean
310610de47 win_msg: added doc about msg limit and included an explicit check for better error handling (#31078)
(cherry picked from commit 67fd98da09)
2017-10-03 06:34:28 +10:00
Matt Clay
5db1d1a881 Pin docker simulator versions.
(cherry picked from commit c055795e02)
2017-10-02 13:20:10 -07:00
Brian Coca
a81dc232e3 remove action plugin only fields from 'file' calls (#31047)
* remove action plugin only fields from 'file' calls

fixes #30556

* Add a test for #30556
(cherry picked from commit ac9278ff0f)
2017-09-29 17:13:58 -07:00
Adrian Likins
4025b47629 Fix fact failures cause by ordering of collectors (#30777)
* Fix fact failures cause by ordering of collectors

Some fact collectors need info collected by other facts.
(for ex, service_mgr needs to know 'ansible_system').
This info is passed to the Collector.collect method via
the 'collected_facts' info.

But, the order the fact collectors were running in is
not a set order, so collectors like service_mgr could
run before the PlatformFactCollect ('ansible_system', etc),
so the 'ansible_system' fact would not exist yet.

Depending on the collector and the deps, this can result
in incorrect behavior and wrong or missing facts.

To make the ordering of the collectors more consistent
and predictable, the code that builds that list is now
driven by the order of collectors in default_collectors.py,
and the rest of the code tries to preserve it.

* Flip the loops when building collector names

iterate over the ordered default_collectors list
selecting them for the final list in order instead
of driving it from the unordered collector_names set.

This lets the list returned by select_collector_classes
to stay in the same order as default_collectors.collectors

For collectors that have implicit deps on other fact collectors,
the default collectors can be ordered to include those early.

* default_collectors.py now uses a handful of sub lists of
collectors that can be ordered in default_collectors.collectors.

fixes #30753
fixes #30623

(cherry picked from commit 95abc1d82e)
2017-09-28 10:56:18 -04:00
Jordan Borean
9a22c93606 fix for webapppool when specifying an attribute that holds a collection (#30729)
* fix for webapppool when specifying an attribute that holds a collection

* re-add always block on test

(cherry picked from commit a41077df20)
2017-09-28 16:16:52 +10:00
Adrian Likins
042079aa87 Use vault_id when encrypted via vault-edit (#30772)
* Use vault_id when encrypted via vault-edit

On the encryption stage of
'ansible-vault edit --vault-id=someid@passfile somefile',
the vault id was not being passed to encrypt() so the files were
always saved with the default vault id in the 1.1 version format.

When trying to edit that file a second time, also with a --vault-id,
the file would be decrypted with the secret associated with the
provided vault-id, but since the encrypted file had no vault id
in the envelope there would be no match for 'default' secrets.
(Only the --vault-id was included in the potential matches, so
the vault id actually used to decrypt was not).

If that list was empty, there would be an IndexError when trying
to encrypted the changed file. This would result in the displayed
error:

ERROR! Unexpected Exception, this is probably a bug: list index out of range

Fix is two parts:

1) use the vault id when encrypting from edit

2) when matching the secret to use for encrypting after edit,
include the vault id that was used for decryption and not just
the vault id (or lack of vault id) from the envelope.

add unit tests for #30575 and intg tests for 'ansible-vault edit'

Fixes #30575

(cherry picked from commit a14d0f3586)
2017-09-26 12:31:58 -04:00
Adrian Likins
2149d1092b Fix 'distribution' fact for ArchLinux (#30723)
Allow empty wasn't breaking out of the process_dist_files
loop, so a empty /etc/arch-release would continue searching
and eventually try /etc/os-release. The os-release parsing
works, but the distro name there is 'Arch Linux' which does
not match the 2.3 behavior of 'Archlinux'

Add a OS_RELEASE_ALIAS map for the cases where we need to get
the distro name from os-release but use an alias.

We can't include 'Archlinux' in SEARCH_STRING because a name match on its keys
but without a match on the content causes a fallback to using the first
whitespace seperated item from the file content as the name.
For os-release, that is in form 'NAME=Arch Linux'

With os-release returning the right name, this also supports the
case where there is no /etc/arch-release, but there is a /etc/os-release

Fixes #30600

* pep8 and comment cleanup

(cherry picked from commit 3eab636b3f)
2017-09-25 15:06:05 -04:00
Ganesh Nalawade
3680d28e58 Increase pause time in junos integration test (#30740) (#30799)
*  Increase pause time to a value greater
   than persistent connection timeout to clean
   out socket path.
(cherry picked from commit c3d226a739)
2017-09-23 18:42:00 +05:30
Adrian Likins
bca1818b1e Fix pkg_mgr fact on OpenBSD (#30725)
* Fix pkg_mgr fact on OpenBSD

Add a OpenBSDPkgMgrFactCollector that hardcodes pkg_mgr
to 'openbsd_pkg'. The ansible collector will choose the
OpenBSD collector if the system is OpenBSD and the 'Generic'
one otherwise.

This removes PkgMgrFactCollectors depenency on the
'system' fact being in collected_facts, which also
avoids ordering issues (if the pkg mgr fact is collected
before the system fact...)

Fixes #30623

(cherry picked from commit 12404f470a)
2017-09-22 14:24:57 -04:00
Jordan Borean
34ceed635d win_domain_membership: added better error handling and basic tests (#30674)
(cherry picked from commit fb628acb6e)
2017-09-22 06:10:14 +10:00
Hervé Beraud
9bc6cca9f8 [fix] no-unicode-literals sanity error on ansible.egg-info (#30446)
* [fix] no-unicode-literals sanity error on ansible.egg-info

(cherry picked from commit 0e9ae5b8cc)
2017-09-21 12:48:03 -07:00
Ryan Brown
fd42243936 Split ec2_elb_* modules in service of rename/interface changes (#30716)
* Split ec2_elb_* modules in service of rename/interface changes (#30532)

* Undeprecate ec2_elb_*
* Make ec2_elb* full fledged modules rather than aliases
* Split tests for ec2_elb_lb and elb_classicb_lb
* Change names in documentation of old and new elb modules

Add tests for ec2_elb_lb

* Update CHANGELOG with new status of ec2_elb_* vs. elb_classic_*
2017-09-21 14:43:45 -04:00
Ganesh Nalawade
6f461fbfd0 Increase socket connect retry timeout for integration test (#30681) (#30683)
*  Increase persistent connection local socket
   retry timeout to fix intermittent failure in
   network integration test
(cherry picked from commit 869cd6f729)
2017-09-21 11:02:22 +01:00
Adrian Likins
f8ad9ca75d Don't ask for password confirm on 'ansible-vault edit' (#30514)
This is to match the 2.3 behavior on:

        ansible-vault edit encrypted_file.yml

Previously, the above command would consider that a 'new password'
scenario and prompt accordingly, ie:

        $ ansible-vault edit encrypted_file.yml
        New Password:
        Confirm New Password:

The bug was cause by 'create_new_password' being used for
'edit' action. This also causes the previous implicit 'auto prompt'
to get triggered and prompt the user.

Fix is to make auto prompt explicit in the calling code to handle
the 'edit' case where we want to auto prompt but we do not want
to request a password confirm.

Fixes #30491

(cherry picked from commit 307be59092)
2017-09-20 11:00:42 -04:00