Commit Graph

499 Commits (934b64519191b0df70495deecbb349532af48597)

Author SHA1 Message Date
David Newswanger b9b5183644 enabled vyos banner and config (#26438) 7 years ago
Matt Davis 08af853ee9 fix win_shell/win_command nonzero RC failure setting (#26443)
* as a result of recent core engine changes to ignore rc, modules are responsible to set `failed` on nonzero RC if they want that behavior
* the `failed` filter currently triggers on nonzero RC, which caused the tests to false-pass
* updated tests to explicitly check both rc and failed keys, as well as using the failed filter.
7 years ago
Jordan Borean 8e9d04043a win_regedit: fix for same dword value (#26415) 7 years ago
Rene Moser c92170e90d cloudstack: cs_instance: extent integration tests for ssh key handling 7 years ago
Trishna Guha ad3fe08aae fix vyos_banner multiline string issue (#26383)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
7 years ago
Matt Davis 0ee46cb0df converted become runas to explicit CreateProcessWithLogonW (#26378)
* fixes become_method: runas for unprivileged users
* sets permissions on tempdir appropriately
* allows automatic system environment generation for new token (old Process.Start way prevents this)
* add basic become runas tests
7 years ago
Brian Coca 8f758204cf correct, cleanup & simplify dwim stack (#25956)
* correct, cleanup & simplify dwim stack

latlh chIS logh HeS qar wej chel laD
better errors
update find_file to new exception

* addressed latest comments

* test should not use realpath as it follows symlink

this fails when on OS X as /var is now a symlink to /private/var
but first_found was not supposed to follow symlinks
7 years ago
Ganesh Nalawade 11e72d495d Add net_logging platform agnostic module and junos implementation (#26316)
* Add net_logging platform agnostic module and junos implemenatation

*  net_logging platform agnostic module
*  junos implemenatation of logging module
*  net_logging integration test
*  junos_logging integration test
7 years ago
Abhijeet Kasurde 5c374cd1ae Add Test Suite for vmware_vswitch (#26076)
Fix adds test suite for vwmare_switch

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
7 years ago
Abhijeet Kasurde 69e55b2cfe Add testsuite for VMware Distributed vSwitch (#26193)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
7 years ago
Abhijeet Kasurde 28fcfcdbef Add testsuite for vmware cluster (#26281)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
7 years ago
Trishna Guha 93bbcd8a32 vyos_user fix idempotent (#26289)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
7 years ago
Mike Wiebe 240de965ee Fix nxos_acl module and add IT tests (#25966)
* Fix nxos_acl module and add IT tests

* Add nxos_acl test

* Add additional properties to test
7 years ago
David Newswanger 9500aac5b9 added integration tests for dpkg_selections (#26043) 7 years ago
Ricardo Carrillo Cruz 8a1cd05fdc Assert vyos_user commands output against first element of array (#26233) 7 years ago
Ricardo Carrillo Cruz c8ba8bdd6d Add ios_static_route module (#25527)
* Add ios_static_route module

* Add ios_static_route integration tests

* Add platform agnostic integration tests for IOS

* Replace unicode function to ansible module_utils to_text

* Add collections handling logic

* Add integration tests for collections

* Make collections and prefix mutually exclusive

* Add net_static_route integration tests for collections

* Do not store load_config return value, as it returns nothing
7 years ago
David Newswanger 5242ff1b59 added integration tests for rpm_key (#26134) 7 years ago
Ganesh Nalawade 911a7e085e Add active param to junos declarative modules (#26222)
*  active/deactivate configuration capability
*  integration test refactor
7 years ago
Trishna Guha 15e78d1073 fix iosxr_user integration test (#26220)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
7 years ago
Jordan Borean 98fc54f02d win_find: fix for empty nested directories (#26164) 7 years ago
Dag Wieers 0a15ab7ce9 win_say: Fix issue, add integration tests (#26089)
* win_say: Fix issue, add integration test

This PR includes:
- Make speed_speech an integer parameter
- Test for empty parameters too
- Add integration tests

* Improve the $speech_speed parameter handling

As requested
7 years ago
David Moreau-Simard 9fdd07fba8 Provide the list of files that were included by include_vars
include_vars will now also return a key 'ansible_included_var_files'
which contains the list of files that were successfully loaded.
This is useful information and, amongst other things, a way for users
to know exactly what files were included when debugging their
playbooks.
This also allows us to improve the integration tests around
include_vars.
7 years ago
Dag Wieers 5be32aa5af Move ping and win_ping closer together (#26028)
So in an effort to verify if Windows modules are feature complete
compared to the python equivalent, I stumbled upon these differences.

This PR includes:
- Add missing 'data' option from documentation
- Simplify ping module
- Update integration tests to test exception
7 years ago
Trishna Guha be11d12fa2 fix vyos_user integration test assert (#26185)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
7 years ago
Dag Wieers bb7ebc6a55 win_msg: Added integration tests, parameter fixes (#26126) 7 years ago
Abhijeet Kasurde 96dcd1060c Add testsuite for vmware_datacenter (#26133)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
7 years ago
Abhijeet Kasurde 79b2897462 Update vmware_guest_find module (#26066)
Fix updated following:
* Update Documentation
* Update Examples
* Find VM's folder using VM's UUID
* Make name as optional parameter

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
7 years ago
Toshio Kuratomi e238ae999b Cyptography pr 20566 rebase (#25560)
Make pyca/cryptography the preferred backend for cryptographic needs (mainly vault) falling back to pycrypto

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

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

* Handle wrong password given for VaultAES format

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

* Namespace all of the pycrypto imports and always import them

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

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

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

(cherry picked from commit 9e16b9db275263b3ea8d1b124966fdebfc9ab271)

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

* Attempt to add pycrypto version to setup deps

* Change hacking README for dual pycrypto/cryptography

* update dependencies for various CI scripts

* additional CI dockerfile/script updates

* add paramiko to the windows and sanity requirement set

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

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

* helper script for manual testing of pycrypto/cryptography

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

* Run unittests for vault with both cryptography and pycrypto backend
7 years ago
Matt Davis 36ad934156 re-enable non-pipelined mode for Powershell (#25012)
* fixes #23986
* fixes 3rd-party Windows connection plugins that don't support pipelining (eg awsrun)
7 years ago
Jordan Borean b41c42cf0d win_share: Add integration tests and various fixes (#25691)
* win_share: Add integration tests and various fixes

* docs and comments updates based on PR review

* fixed up documentation issue with URL
7 years ago
Daniele Lazzari 9d932b64f0 New module: Add module to install/remove/register/unregiser windows powershell modules (windows/win_psmodule) (#23604)
* Add new windows module win_psmodule

* Add checkmode, allow_clobber parameter, integration tests

* Add aliases, replace win_raw with win_shell

* restore original test_win_group1.yml, add powershel version test

* fix var type

* add conditional on assert

* integration tests conditional tasks review

* documentation fix, test fix, adds result.change

* fix yml

* fix railing whitespace

* add nuget_changed and repository_changed in result
7 years ago
Andreas Olsson 05dc76f3b2 In the git module let ssh do its own host checking
There are too many possible special cases for Ansible to be able to
precheck known_hosts files without introducing all kinds of false
failures.

* Alternative known_hosts paths
* Alternative host name aliases
* ssh host certificates
* SSHFP + DNSSEC

Fixes #24860
7 years ago
mihu 6b76bc924f [cloud] New feature for ec2_group: allow deleting groups by id (#26022) 7 years ago
Rene Moser 3fe5de907f cloudstack: cs_host: add integration tests 7 years ago
Matt Clay 15beaed6bc Update FreeBSD pg test to use postgresql95-server.
The py-psycopg2 package now requires postgresql95-server instead of
postgresql93-server. Installing py-psycopg2 will automatically remove
postgresql93-server if it is installed, breaking integration tests.
7 years ago
Matt Clay b82cc8e7cc Fix network integration test config. (#26057)
* Remove unsupported network tests from CI.
* Add `net` to list of network target prefixes.
7 years ago
Trishna Guha 66f9e23e43 vyos net_system implementation (#25994)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
7 years ago
jctanner 996dcb989c Add the cloud provider script for the vcenter simulator container (#25964) 7 years ago
Ganesh Nalawade b2f46753ec Add junos_system declartive module and other related change (#25859)
* Add junos_system declartive module and other related change

*  junos_system declartive module
*  integration test for junos_system
*  integration test for net_system (junos platform)
*  pep8 fixes for junos modules
*  move to lxml from elementree for xml parsing as it support
   complete set of xpath api's
*  other minor changes

* Fix CI and doc changes

* Fix unit test failures

* Fix typo in import

* Fix import issue for py2.6

* Add missed Element in import
7 years ago
Trishna Guha 947e9aba45 Add vyos_banner implementation module (#25862)
* Add vyos_banner implementation module

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

* vyos_banne integration test

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

* vyos_banner unit test

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

* minor fix on banner text

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
7 years ago
Jordan Borean 6d01168238 win_acl_inheritance: Added tests and formatting improvements (#25382) 7 years ago
Jordan Borean c05d3c3821 win_owner: added tests and fixed up bool handling (#25088)
* win_owner: added tests and fixed up bool handling

* explicitly gathering facts in test

* Removed manualy entry in test group
7 years ago
Dag Wieers 0aba04fdad win_uri: Add integration tests, new functionality... (#25373)
This is a cleanup of the win_uri module to make it feature-complete.

This PR includes:
- Added check-mode support
- Add as many options from the uri module as possible
  - Added creates
  - Added follow_redirects
  - Added maximum_redirection
  - Added password
  - Added removes
  - Added return_content
  - Added status_code
  - Added timeout
  - Added user
  - Added validate_certs
- Fixed list-handling for comma-separated strings
- Added basic integration tests (should come from uri module)
7 years ago
David Newswanger ca16956337 added integration tests for apt upgrade (#25670)
* added integration tests for apt upgrade

changed version number for hello to 2.6 so that it works with Ubuntu 12.04

prevent tests from checking if aptitude is installed on non ubuntu systems

changed ordering on when statements for safe and full upgrade types so that the OS check happens before the aptitude check

added integration tests for apt upgrade

changed version number for hello to 2.6 so that it works with Ubuntu 12.04

* Moved additions to tasks/main.yml to make revisions easier. Changed tasks to multiline format
7 years ago
David Newswanger 1bc5761bea added integration tests for yum repository (#25671)
* added integration tests for yum repository

* fixed escaped single quote

* extended yum_repository tests to include fedora

* removed unused variable file

* added check for return values

* replaced escaped double quotes with single quotes, switched to lookup for reading repofile
7 years ago
Abhijeet Kasurde 7348a613bb Correct usage of fail_json in hg module (#25847)
Fix adds correct usage for fail_json and also adds
testcases to verify this.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
7 years ago
Ganesh Nalawade 450263e934 Add junos_banner declartive module (#25826)
* Add junos_banner declartive module

*  junos_banner implementation
*  Integration test for junos_banner
*  Integration test for net_banner (junos)
*  Minor fixes

* Minor doc change
7 years ago
John R Barker 448efdb9e5 MySQL Password updates (#25825)
* MySQL Password updates

* Disable user_password_update_test
7 years ago
John R Barker 7ee7fa7332 Use stronger password for MySQL (#25821)
Previously we were getting "Your password does not satisfy the current policy requirements"
Possibly caused by a software update on Fedora
7 years ago
Ganesh Nalawade 2ff464c949 Add net_interface declarative module (#25766)
* Add net_interface declartive module

*  Add net_interface module
*  Add junos_interface implementation module
*  Other minor changes

* Add integration test

*  Integration test for net_interface
*  Integration test for junos_interface

* Fix CI failures

* Documentation changes
7 years ago
Ben Berry 1267567556 Check sysctl no name (#25041)
* add integration tests for no name on sysctl

* better error validation, add test for no value
7 years ago
Trishna Guha 41f6f8f410 Idempotent behaviour in ios_user integration test (#25774)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
7 years ago
Trishna Guha 98269888a9 iosxr_banner Implementation module (#25744)
* Add iosxr_banner implementation module

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

* Integration test for iosxr_banner

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

* Unit test for iosxr_banner

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

* remove blank line pep8

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
7 years ago
Trishna Guha 44687bb917 Add iosxr_user implementation module (#25615)
* Add iosxr_user implementation module

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

* iosxr_user Integration test

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

* iosxr_user Unit test

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

* Modify integration test with idempotent case

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
7 years ago
Trishna Guha b3c22a96bd Add vyos_user implementation module (#25677)
* Add vyos_user implementation module

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

* Integration test for vyos_user

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

* Make state absent work

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

* Unit test for vyos_user

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

* Standardize user names

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

* Modify integration test with idempotent case

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

* Add role as alias to level

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
7 years ago
Trishna Guha 9c6ee8d0bb Add nxos_banner implementation module (#25695)
* Add nxos_banner implementation module

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

* nxos_banner integration test

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

* nxos_banner unit test

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

* doc update

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
7 years ago
Dag Wieers 1c9a570ffe win_timezone: Add diff support, integration tests (#25284)
* win_timezone: Add diff support, integration tests

This PR includes:

- Diff support
- Returns both previous_timezone and timezone
- Adds integration tests
- More examples
- Improved documentation

* Merged the changes from jborean93's PR
7 years ago
Jordan Borean d3352c5b49 win_tempfile: Added integration tests (#25069)
* win_tempfile: Added integration tests

* fixed up tests
7 years ago
Ganesh Nalawade b69c7f50d0 Add junos_vlan platform agnostic module (#25652)
* Add junos_vlan platform agnostic module

*  junos_vlan implementation

*  integration test for junos_vlan

* Minor fixes

* Fix Integration test failure
7 years ago
Andrew Saraceni 91e995d691 Allow win_scheduled_task to support adding and removing task paths (#24025)
* allows win_scheduled_task to support adding and removing task paths

* fix line length for documentation

* added integration tests for path creation and removal

* removing ability to remove TaskPath if a task isn't removed.  also removed superfluous line of code in Invoke-TaskPathCheck function
7 years ago
Dag Wieers bf43eb92f5 win_firewall: check-mode support, integration tests (#25127)
* win_firewall: check-mode support, integration tests

This PR includes:
- Check-mode implementation
- Documentation improvements
- Ensure module output is consistent (no matter what profiles are provided)
- Fixed indentation
- Cosmetic changes
- Integration tests

* win_firewall: check-mode support, integration tests

This PR includes:
- Check-mode implementation
- Documentation improvements
- Ensure module output is consistent (no matter what profiles are provided)
- Fixed indentation
- Cosmetic changes
- Integration tests
7 years ago
Sloane Hertel 3f0c47196e [cloud] s3: deleting a nonexistent bucket should not give a traceback Fixes #25445 (#25487)
* trying to delete a nonexistent bucket should not fail

* Improve error handling for deleting s3 bucket

* Allow successful deletion

* Add test for deleting a nonexistent bucket

rename integration test target from s3 to aws_s3
7 years ago
Ricardo Carrillo Cruz 9725e056bc Add missing register on openvswitch_db integration tests (#25609) 7 years ago
Ricardo Carrillo Cruz 0dbea4575c Add assertions to openvswitch_db integration test (#25600)
* Add missing delegate_to on openvswitch_db integration test runner

* Add assertions to openvswitch_db integration test
7 years ago
Ricardo Carrillo Cruz 081e138cf1 Add missing delegate_to on openvswitch_db integration test runner (#25597) 7 years ago
Ricardo Carrillo Cruz c296fcb0e0 [WIP] Add openvswitch_db integration tests (#23803)
* WIP Add openvswitch_db integration tests

* Add  ovs.yaml playbook entrypoint for OVS

* Add test case pattern filtering

* Clear out aliases for now

Running tests on posix group just fails, containers do not have ovs
7 years ago
Abhijeet Kasurde b89cb95609 Fix spelling mistakes (comments only) (#25564)
Original Author : klemens <ka7@github.com>

Taking over previous PR as per
https://github.com/ansible/ansible/pull/23644#issuecomment-307334525

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
7 years ago
Pilou 460d932aa8 postgresql_user: fix bugs related to 'expires' option (#23862)
* Factorize tests related to no_password_change using an include task

* Refactor: deduplicate tasks

* postgresql_user: test 'expires' parameter

* Change 'valid until' even it's the only updated field

* value is changed when another value is provided

* value isn't returned when unset

* Remove unused variable

* psycopg2.extras.DictRow is able to handle comparison

* postgresql_user: simplify helper method

* postgresql_user: define variable just before using it

* Fix comparison between user input and applied configuration

* new test: adding an invalid attribute

* Refactor, add cleaning task

* Check that using same attribute a 2nd time does nothing

* Always try to remove created user

* postgresql_user: fix pep8
7 years ago
René Moser 0a972ea6bf wait_for: add some integration tests (#25553) 7 years ago
René Moser 29817ab115 cloudstack: add tests, fix pep8 (#25518)
* cloudstack: cs_zone: fix pep8

* cloudstack: cs_zone: add tests
7 years ago
Ricardo Carrillo Cruz 72e65e4290 Platform agnostic module for VRFs (#25383)
* WIP VRF platform agnostic module

* Fixed examples refering vlans instead of vrfs

* Add integration tests
7 years ago
Ricardo Carrillo Cruz d83f254bb6 New eos_vrf module (#25427)
* New eos_vrf module

* Add CLI integration tests

* Check rd only if not None
7 years ago
Trishna Guha 91e5fce90f Add ios_user implementation module (#25413)
* Add ios_user module

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

* Integration test for ios_user

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

* Add unit test for ios_user

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
7 years ago
Jordan Borean 89caef8fb6 win_environment: Added tests and return info in document (#25064)
* win_environment: Added tests and return info in document

* fixing up some yaml issues

* some more things I should have detected

* fixing up test tag name
7 years ago
Trishna Guha 36082e32b4 Add integration test for nxos_user (#25464)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
7 years ago
Trishna Guha b1b68840be Add missing integration test for eos_user (#25463)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
7 years ago
Ricardo Carrillo Cruz b3e8c48d4b New module: Add support for Arista EOS vlan (network/eos/eos_vlan) (#25355)
* WIP Add eos_vlan module

* Fix docstrings

* Fix pep8 issues

* Add active/suspend states logic

* Add integration tests for eos_vlan

* Fix map_config_to_obj on EAPI

* Sixify iteritems

* Add platform agnostic net_vlan integration tests
7 years ago
Matt Martz 004e99316c Allow template files to be vaulted (#22951)
* Allow template files to be vaulted

* Make sure to import exceptions we need

* get_real_file can't take bytes, since it looks specifically for string_types

* Now that we aren't using open() we don't need b_source

* Expand playbooks_vault docs to include modules that support vaulted src files

* Add vaulted template test
7 years ago
Daniele Lazzari eda6a6baee New module: Add module to add/remove a network static route on windows (windows/win_route) (#23405)
* adds win_route windows module

* fix documentation indent

* fix documentation pep8 issues

* fix documentation issues

* genaral code review

* changed 'supported_by' in doc, supports_check_mode removed

* use of powershell cmdlet instead of route command, destnation in CIDR format, adds check mode support

* adds win_psmodule module

* documentation review

* documentation review

* removed files accidentatlly pushed

* add integration tests, add return in documentation

* add conditional statement in test, add os requirementes in documentation

* fix documentation

* fix os check in tests
7 years ago
René Moser 894b86a467 cloudstack: cs_zone_facts: add tests and fix pep8 (#25407) 7 years ago
Trishna Guha f6a4803669 New module: platform agnostic way to manage local users on network devices (network/net_user.) (#25259)
* Add net_user platform agnostic module

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

* Integration test for net_user

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

* modify eos_user module to support name param as alias to username

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

* Test collection of users

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
7 years ago
Sloane Hertel c20285782d test conditionals work for invalid elements in list and undefined keys in dicts (#23875) 7 years ago
Michael De La Rue e28845018d [cloud] New module: AWS API Gageway module (#20230)
* Ultra basic api-gateway module based of lambda.py

* Ultra basic deployment added to api-gateway module

* ApiGateway module Allow creation of APIs, more documentation and better return value

* ApiGateway module incorporate review feedback

* ApiGateway module flake8 cleanup

* APIGateway module - more review fixes.

* slightly better messages in api_gateway module

* AWS api_gateway module - try to improve messages in case of exceptions

* rename api_gateway module to aws_api_gateway as discussed in PR 20230

* aws_api_gateway - Allow delivery of swagger either as text or dictionary.

* aws_api_gateway module - introduce 'unit' tests, improve imports using them and small fixes

* aws_api_gateway module - move path expand_user to avoid early typecheck

* aws_api_gateway - version means version of metadata not module - fix to 1.0

* aws_api_gateway module - Rely on module_utils.ec2 for imports & path type for expanduser / cleanups

* aws_api_gateway module - heavy cleanup and refactor of code + cloud retry functionality.

* api_gateway_module - failing test case for handling more than one deployment in succession and API deletion

* add TooManyRequestsException to AWSRetry exception list - makes API deployment work.

* api_gateway_module - Fixes for various review comments + errors from various linters

* api_gateway_module - Fixes for more review comments + linter error

* api_gateway_module - Major refactor into sensible functions - create_response becomes configure_response

* api_gateway_module - should be working under python3; remove test exclusion

* api_gateway_module - finish off remaining review fixes - use ansible defaults and fix mutually exclusive

* api_gateway_module - attempt to improve handling of botocore errors in python3

* api_gateway_module - implement state=absent / API deletion
7 years ago
Robin Roth 8f7c8ef3a5 Reenable git tests (#25341)
* Revert "Temporarily disable failing git test."
* Use correct hash for depth=1 test
7 years ago
Matt Clay dab1b1fe5b Temporarily disable failing git test. 7 years ago
René Moser 53c46df323 cloudstack: new module cs_network_acl_rule (#25325)
* cloudstack: new module cs_network_acl_rule
* fix doc errors
7 years ago
Trishna Guha e90f1d6449 net_command platform agnostic module (#25249)
* net_command platform agnostic implementation

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

* Add net_command platform agnostic module

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

* Add integration test for net_command module

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

* fix yaml issue
7 years ago
Ricardo Carrillo Cruz 955dc6e250 Add net_banner platform agnostic module (#25245)
* Add net_banner platform agnostic module

* Add integration tests for net_banner

* Remove default from required param

* Remove skip/python3 from net_banner aliases
7 years ago
Ricardo Carrillo Cruz ffc74fdca2 Add missing provider on basic-motd IOS test (#25307)
Without this it fails, as it needs elevated privs.
7 years ago
Ricardo Carrillo Cruz 64add28657 Platform agnostic net_system module (#24953)
* Platform agnostic net_system module

Also refactor the action network plugins for better code re-use

Still more refactoring to do once the connection plugin work is complete

* Replace importlib for imp

importlib is not available on 2.6, so we need to stick to imp

* Load action plugin via module metadata

* Better error message if no implementation is found

Now the plugin will show the module name and the network OS in the
error message

* Fix typo on documentation author line

* Fix pep8 issues

* Add missing options key on doc string and stringify version

* Return None in case module has no metadata

* Read module metadata only if it's a python module

Check for module suffix, if it's .py then read metadata.
Otherwise this fails on non-python modules, like Windows PS for example.

* Read metadata variable only if it's a python module

Fix referencing a variable before assignment

* Add action_handler to validate_modules metadata schema

* Pull metadata with plugin_docs get_docstring

Using load_source from PluginLoader is troublesome, it is not guaranteed
a module may be importable at the controller, e.g. if a module depends
on module_utils functions it won't work, because module_utils is not
in the sys path.
Rather than putting that module dependencies introspection, just
use plain parsing like plugin_docs get_docstring does as we only care
about reading ANSIBLE_METADATA.

* Add platform agnostic group of groups for integration tests

This will be the target for platform agnostic integration tests.

* Add integration tests for net_system

* Switch to action plugin inheritance from metadata driven action handler

As the metadata action driven action handler work is being worked on
on its standalone proposal+PR, let's just go back to have one
action handler per platform agnostic module.
Those action plugins will inherit from net_base.

* Add blank line to fix pep8

* Add aliases file to net_system integration test

This will avoid CI failure

* Fix integration tests for net_system

* Give more precedence to task network_os over inventory network_os
7 years ago
Trond Hindenes 055fd6f5f5 New module: win dsc (#24872)
* Added win_dsc module file

* mute output and track reboot requirements

* added tests

* proper conditionals for test

* Added moar conditionals for test

* ci fixes

* Added metadata

* fixed integration test yaml

* ci fix

* ci fix

* added module_version param and output, no longer chokes on multiple versions found.

* ci fix

* code review improvements, make return vars more pythonic, cleanup
removed reference to handles in commit message

* Fixed tests, clearer documentation

* fixed trailing whitespace
7 years ago
Adrian Likins 45a9f96774 Facts Refresh (2.4 roadmap) (#23012)
Facts Refresh (2.4 roadmap)

This commit implements most of the 2.4 roadmap 'Facts Refresh'
- move facts.py to facts/__init__.py
- move facts Distribution() to its own class
- add a facts/utils.py
- move get_file_content and get_uname_version to facts/utils.py
- move Facts() class from facts/__init__ to facts/facts.py
- mv get_file_lines to facts/utils.py
- mv Ohai()/Facter() class to facts/ohai.py and facter.py
- Start moving fact Hardware() classes to facts/hardware/*.py
- mv HPUX() hardware class to facts/hardware/hpux.py
- move SunOSHardware() fact class to facts/hardware/sunos.py
- move OpenBSDHardware() class to facts/hardware/openbsd.py
- mv FreeBsdHardware() and DragonFlyHardware() to facts/hardware/
- mv NetBSDHardware() to facts/hardware/netbsd.py
- mv Darwin() hardware class to facts/hardware/darwin.py
- pep8/etc cleanups on facts/hardware/*.py
- Mv network facts classes to facts/network/*.py
- mv Virtual fact classes to facts/virtual
- mv Hardware.get_sysctl to facts/sysctl.py:get_sysctl

- Also mv get_uname_version from facts/utils.py -> distribution.py
  since distribution.py is the only thing using it.

- add collector.py with new BaseFactCollector
- add a subclass for AnsibleFactCollector
- hook up dict key munging FactNamespaces
- add some test cases for testing the names of facts
- mv timeout stuff to facts.timeout

- rm ansible_facts()/get_all_facts() etc

- Instead of calling facts.ansible_facts(), fact collection
  api used by setup.py is now to create an AnsibleFactCollector()
  and call it's collect method.

- replace Facts.get_user_facts with UserFactCollector
- add a 'systems' facts package, mv UserFactCollector there
- mv get_dns_facts to DnsFactCollector
- mv get_env_facts to EnvFactCollector
- include the timeout length in exception message

- modules and module_utils that use AnsibleFactCollector
  can now theoretically set the 'valid_subsets'

  May be useful for network facts module that currently have
  to reimplement a good chunk of facts.py to get gather_subsets
  to work.

- get_local_facts -> system/LocalFactCollector
- get_date_time -> system/date_time.py
- get_fips_facts -> system/fips.py
- get_caps_facts() -> system/caps.py
- get_apparmor_facts -> system/apparmor.py
- get_selinux_facts -> system/selinux.py
- get_lsb_facts -> system/lsb.py
- get_service_mgr_facts -> system/service_mgr.py
- Facts.is_systemd_managed ->  system/service_mgr.py
- get_pkg_mgr_facts -> system/pkg_mgr.py
- Facts()._get_mount_size_facts() -> facts.utils.get_mount_size()

- add unit test for EnvFactCollector
- add a test case for minimal gather_subsets
- add test case for collect_ids
- Make gather_subset match existing behavior or '!all'

    If 'gather_subset' is provided as '!all', the existing behavior
    (in 2.2/2.3) is that means 'dont collect any facts except those
    from the Facts() class'. So 'skip everything except
    'apparmor', 'caps', 'date_time', 'env', 'fips', 'local', 'lsb',
    'pkg_mgr', 'python', 'selinux', 'service_mgr', 'user', 'platform', etc.

    The new facts setup was making '!all' mean no facts at all, since
    it can add/exclude at a finer granularity. Since that makes more
    sense for the ansible collector, and the set of minimal facts to
    collect is really more up to setup.py to decide we do just that.

    So if setup.py needs to always collect some gather_subset, even
    on !all, setup.py needs to have the that subset added to the
    list it passes as minimal_gather_subset.

    This should fix some intg tests that assume '!all' means that
    some facts are still collected (user info and env for example).

    If we want to make setup.py collect a more minimal set, we can do that.

- force facts_dicts.keys() to a list so py3 works
- split fact collector tests to test_collectors.py

- convert Facter(Facts) -> other/facter.py:FacterFactCollector

- add FactCollector.collect_with_namespace()

    regular .collect() will return a dict with the key names
    using the base names ('ip_address', 'service_mgr' etc)

    .collect_with_namespace() will return a dict where the key names
    have been transformed with the collectors namespace, if there is
    one. For most, this means a namespace that adds 'ansible_' to the
    start of the key name.

    For 'FacterFactCollector', the namespace transforms the key to
    'facter_*'.

- add test cases for collect_with_namespace

- move all the concrete 'which facts does setup.py' stuff to setup.py

    The caller of AnsibleFactCollector.from_gather_subset() needs to
    pass in the list of collector classes now.

- update system/setup.py to import all of the fact classes and pass
  in that list.
- split the Distribution fact class up a bit

    extracted the 'distro release' file handling (ie, linux
    boxes with /etc/release, /etc/os-release etc) into its
    own class.
- extract get_cmdline_facts -> cmdline.py
- extract get_public_ssh_host_keys -> system/ssh_pub_keys.py
- extract get_platform_facts -> system/platform.py

  platform.py may be a good candidate for further splitting.

- rm test for plain Facts() base class
- let the base class for Collector unit tests provide collected_facts

    some Collectors and/or their migrated Facts() subsclasses need
    to look at facts collected by other modules ('ansible_architecture'
    the main one...).

    Collector.collect() has the collected_facts arg for this, so add
    a class variable to BaseFactsTest so we can specify it.

- mv Ohai to other/ohai.py and convert to Collector
- update hardware/*.py to return facts (no side effects)

- mv AnsibleFactCollector to setup.py
- extra collector class gathering to module method in
  facts/__init__.py (collector_classes_from_gather_subset)
- add a CollectorMetaDataCollector collector used to provide
  the 'gather_setup' fact
- add unit test module for 'setup' module
  (test/units/modules/system/setup.py)

- Collector init now doesnt need a module, but collect does

    An instance of a FactCollector() isnt tied to a AnsibleModule
    instance, but the collect() method can be, so optionally pass
    in module to FactCollector.collect() (everywhere)

- add a default_collectors for list of default collectors

  import and use it from setup.py module

  eventually, would like to replace this with a plugin loader
  style class finder/loader

- unit tests for module_utils/facts/__init__.py
- add unit tests for ohai facts collector
- remove self.facts side effect on populate() in hardware/sunos.py
- convert OpenBSDHardware() to rm side effects on self.facts
- try to rm some self.facts side effects in Network()

    plumb in collected_facts from populate() where it is needed.

    stop passing collected_facts into Network() [via cached_facts=,
    where it eventually becomes self.facts]

- nothing provides Fact() cached_facts arg now, rm it

    Facts() should be internal only implementation so nothing
    should be using it.

    Of course, now someone will.

- add a Collector.name attr to build a map of name->_fact_ids

    To properly exclude a gather_subset spec like '!hardware', we
    need to know that 'hardware' also means 'devices', 'dmi', etc.
    Before, '!hardware' would remove the 'hardware' collector name
    but not 'devices'. Since both would end up in id_collector_map,
    we would still end up with the HardwareCollector in the collector
    list. End result being that '!hardware' wouldn't stop hardware
    from being collected.

    So we need to be able to build that map, so add the Collector.name
    attribute that is the primary name (like 'hardware') and let
    Collector._fact_ids be the other fact ids that a collector is
    responsible for.

    Construct the aliases_map of Collector.name -> set of _fact_ids
    in fact/__init__.py get_collector_names, and use it when we are
    populating the exclude set.

- refactor of distribution.py

    make the big OS_FAMILY literal a little easier to read
    Also keys can now be any string instead of python literals

    99% sure the test for 'KDE Neon' was wrong
    I don't see how/where it should or could get 'Neon' instead
    of 'KDE Neon' as provided in os-release NAME=

    Use 'distribution' string for key to OS_MAP

    ie, we dont need to make it a valid python label anymore so dont.

    move _has_dist_file to module as _file_exists
    easier to mock without mucking with os.path

    mv platform.system() calls to within get_distribution_facts() instead
    of Distribution() init.

- remove _json compat module

    The code in here was to support:

      -a 'json' python module that was not the standard one included
      with python since 2.6.

      - potentially fallback to simplejson if 'json' was not available.

    'json' is available for all supported python versions now so
    no longer needed.

- mv get_collector_names -> facts.collector
- mv collector_classes_from_gather_subset -> facts.collector
- mv collector tests from test_facts -> test_collector

- Use six's reduce() in sunos/netbsd hardware facts

- rm extraneous get_uname_version in utils

  only system/distribution.py uses it

- Remove Facts() subclass metaclass usage

  - using fact_id and a platform id for matching collectors

    gut most of Facts() subclasses

    rm Facts() subclasses with weird metaclass

    only add collectors that match the fact_ids and the platform_info
    to the list of collectors used.

    atm, a collectors platform_id will default to 'Generic', and
    any platform matches 'Generic'

    goal is to select collector classes including matching the
    systems platform in collector.py, instead of relying on
    metaclasses in hardware/*. To finish this, the various
    Facts() subclasses will need to be replaced entirely with
    Collector() subclasses.

    use collector classmethod platform_match() to match the platform

    This lets the particular class decide if it is compatible with
    a given platform_info. platform_info is a dict like obj, so it could be
    expanded in the future.

    Add a default platform_match to BaseFactCollector that matches
    platform_info['system'] == cls._platform

    They were needed previously to trigger a module
    load on all the collector classes when we import
    facts/hardare so that the Hardware() and related
    classes that used __new__ and find_all_subclasses()
    would work.

    Now that is done in collectors based on platform matching
    at runtime we dont need to do it py module import/parse
    time. So the non empty __init__.pys are no longer needed
    and their is a more flexible mechanism for selection
    platform specific stuff.

    facts/facts.py is no longer used, rm'ed

- if we dont find an implement class for gather spec.. just ignore it.

  Would be useful to add a warn to warn about this case.

- Fix SD-UX typo (should be HP-UX)

- Port fix for #21893 (0 sockets) to this branch

    This readds the change from 8ad182059d
    that got lost in merge/rebase

    Fixes #21893

- port sunos fact locale fix for #24542 to this branch

    based on e558ec19cd

    Fixes #24542

    Solaris fact fix (#24793)

    ensure locale for solaris fact gathering

    fixes issue with locale interfering with proper reading of decimals

- raise exceptions in the air like we just dont care.

    Pretty much ignore any not exit exception in facts
    collection. And add some test cases.

- added new selinux fact to clarify python lib

    the selinux fact is boolean false when the library is not installed,
    a dictionary/hash otherwise, but this is ambigous
    added new fact so we can eventually remove the type dichtomy and normalize it as a dict

    Re-add of devel commit 85c7a7b844 to
    the new code layout, since it got removed in merge/rebase
7 years ago
Matt Clay 9d8aa43c67 Temporary work-around for setuptools 36.0.0 bug. (#25243)
* Temporary work-around for setuptools 36.0.0 bug.
* Use older setuptools for pip integration test.
* Limit isort version to avoid new test failures.
7 years ago
Sloane Hertel 75bdcce072 s3 integration tests (#22920)
* s3 integration tests

* Make s3 integration tests work in standard integration setup and with fish as current shell
see also https://github.com/ansible/proposals/issues/62 if you don't like this much

* test_s3 integration test - substitute command instead of shell where simple

* test_s3 integration test - random contents + complete elimination of use of shell module by moving to tempfile

* move s3 to integration test targets

* Add a couple more test for . in bucket names

Tidy syntax

remove reference to legacy credentials.yml

remove posix/cli/cloud/aws

* remove from legacy testing

* remove dependencies that aren't used
7 years ago
Dag Wieers d958440bcb win_firewall_rule: Implement idempotency, check-mode and diff support (#23162)
* win_firewall_rule: Small idempotency fix

This PR includes the following changes:
- an idempotency fix when `profile: any`
- better difference output to debug idempotency issues
- documentation fixes (remove `required: false`)
- Parameter handling fixes
- RDP example that matches default RDP rule
- Renamed parameter 'enable' to 'enabled' (kept alias)
- Renamed parameter 'profile' to 'profiles' (kept alias)

* Rewrite module completely

The logic is still intact, but various changes with a single goal:

- Make the module idempotent
- Implement check-mode
- Implement diff-mode
- Adapted integration tests

This fixes #18807 and #23455.

* Change casing to lowercase

* Improve the logic wrt. diff
7 years ago
Dag Wieers 0e160d5c7e Ensure exit_json returns failed = False
This is required for modules that may return a non-zero `rc` value for a
successful run, similar to #24865 for Windows fixing **win_chocolatey**.

We also disable the dependency on `rc` value only, even if `failed` was
set.

Adapted unit and integration tests to the new scheme.
Updated raw, shell, script, expect to take `rc` into account.
7 years ago
Evgeni Golov 1f78715848 apt: include arch in check for installed packages on multi-arch systems (#24846)
* apt: include arch in check for installed packages on multi-arch systems

Thanks: Stefan Löwen <stefan.loewen@gmail.com>

Fixes: #24673

* add an integration test for apt's multi-arch handling
7 years ago
Ricardo Carrillo Cruz 69efb61008 Add provider param to prepare_iosxr_tests role tasks (#25163)
This will avoid passing -u -k to ansible-playbook
7 years ago
Pierre-Louis Bonicoli a4131197e0 PostgreSQL tests: enforce UTF8
By default, client encoding is determined either from the LANG_*/LC_*
environment variables or using encoding of the database.

Containers used in the CI don't define a default locale, then encoding
of default databases was SQL_ASCII.
7 years ago
Pierre-Louis Bonicoli fb1e7aaa81 Creates cluster the same way Debian package does
This task is only executed when the playbook has already been executed
once, for example using 'ansible-test integration' with '--retry-error'
switch when the first run fails.

This modification allows to recreate default databases (postgres,
template0 and template1) using the same encoding that the one used by
the Debian package.

Default encoding is 'SQL_ASCII' when default locale is not set in
/etc/default/locale.
7 years ago
Pierre-Louis Bonicoli ce856c2123 postgresql_user: add tests with hashed password 7 years ago
Dag Wieers 4efec414e7 test/: PEP8 compliancy (#24803)
* test/: PEP8 compliancy

- Make PEP8 compliant

* Python3 chokes on casting int to bytes (#24952)

But if we tell the formatter that the var is a number, it works
7 years ago
Ricardo Carrillo Cruz fd5db52fd9 Add provider to prepare_ios_tests role tasks (#25162)
This avoids passing -u <user> -k, as it will just consume
the credentials from group_vars
7 years ago
Rene Moser 439f0beca5 cloudstack: fix pep8 cs_domain 7 years ago
Rene Moser e3f75227bc cloudstack: fix pep8 cs_affinitygroup 7 years ago
Rene Moser 9fe3891d65 cloudstack: fix pep8 cs_cluster 7 years ago
Reilly Herrewig-Pope 723c8f06ab Allow setting/unsetting BYPASSRLS Postgres role attribute (#24625)
* Allow setting/unsetting BYPASSRLS role attr

* Build valid role attrs against version

* Add integration tests
7 years ago
René Moser d5b04aa1f1 cloudstack: add check mode tests (#24908)
* cloudstack: test: cs_network_acl: add check_mode tests

* cloudstack: test: cs_pod: add check_mode tests

* cloudstack: test: cs_user: add check_mode tests

* cloudstack: test: cs_sshkeypair: add check_mode tests

* cloudstack: test: cs_project: add check_mode tests

* cloudstack: test: cs_vpc: add check_mode tests

* cloudstack: test: cs_vpn_gateway: add check_mode tests

* cloudstack: test: cs_volume: add check_mode tests

* cloudstack: test: cs_vmsnapshot: add check_mode tests

* cloudstack: test: cs_account: add check_mode tests

* cloudstack: test: cs_affinitygroup: add check_mode tests

* cloudstack: test: cs_cluster: add check_mode tests

* cloudstack: test: cs_domain: add check_mode tests

* cloudstack: test: cs_instancegroup: add check_mode tests

* cloudstack: test: cs_iso: add check_mode tests

* cloudstack: test: cs_loadbalancer_rule: add check_mode tests

* cloudstack: test: cs_portforward: add check_mode tests

* cloudstack: test: cs_resourcelimit: add check_mode tests

* cloudstack: test: cs_securitygroup: add check_mode tests

* cloudstack: test: cs_securitygroup_rule: add check_mode tests

* cloudstack: test: cs_configuration: add check_mode tests

* cloudstack: test: cs_firewall: add check_mode tests

* cloudstack: test: cs_instance: add check_mode tests

* cloudstack: query current tags from API

Fixes unexpected tags returned in check mode.
7 years ago
Brendan Almonte 2af5556901 Added autoclean/autoremove for the apt module
- Removed alias autoclean from autoremove.
- Added independent execution of apt-get autoclean/autoremove
- Continued to support --auto-remove as a flag to install/remove

Fixes #22222 #24718
7 years ago
Robin Roth 8fca263560 Refactor zypper version parsing and handling (#24056)
Fixes #23516
7 years ago
Brendan Almonte b820d024fc Add alternative syntax for upgrading all installed packages via apt (#25007)
syntax: 'apt: name=* state=latest'

feature #24189
7 years ago
bengerman13 4b6db5db7c add xattr integration tests to ci (#24950)
* add xattr integration tests to ci

* fix package syntax

* remove unnecessary become, disable xattr for bsd and osx
7 years ago
kkjang daada2000c Fix expect for python 3 (#24912)
* Fix expect for python 3

- Change generator next to python 3 compatible
- Added tests for expect

* Add pexpect to integration.txt

- add pexpect library to requirements for integration tests

* Use ansible_python_interpreter in integration tests for expect

* Use double-quotes for expect integration tests

* Cast user input to string for expect integration tests

* Cast user input to string earlier in expect integration tests

* Use ansible.module_utils.six.moves input for expect integration tests

* Fix yamllint errors in the expect test

* Use cat to trigger timeout for expect integration tests

* Use realpath filter in expect integration tests
7 years ago
Brian Coca 8f97aef1a3 Transition inventory into plugins (#23001)
* draft new inventory plugin arch, yaml sample

 - split classes, moved out of init
 - extra debug statements
 - allow mulitple invenotry files
 - dont add hosts more than once
 - simplified host vars
 - since now we can have multiple, inventory_dir/file needs to be per host
 - ported yaml/script/ini/virtualbox plugins, dir is 'built in manager'
 - centralized localhost handling
 - added plugin docs
 - leaner meaner inventory (split to data + manager)
 - moved noop vars plugin
 - added 'postprocessing' inventory plugins
 - fixed ini plugin, better info on plugin run group declarations can appear in any position relative to children entry that contains them
 - grouphost_vars loading as inventory plugin (postprocessing)
 - playbook_dir allways full path
 - use bytes for file operations
 - better handling of empty/null sources
 - added test target that skips networking modules
 - now var manager loads play group/host_vars independant from inventory
 - centralized play setup repeat code
 - updated changelog with inv features
 - asperioribus verbis spatium album
 - fixed dataloader to new sig
 - made yaml plugin more resistant to bad data
 - nicer error msgs
 - fixed undeclared group detection
 - fixed 'ungrouping'
 - docs updated s/INI/file/ as its not only format
 - made behaviour of var merge a toggle
 - made 'source over group' path follow existing rule for var precedence
 - updated add_host/group from strategy
 - made host_list a plugin and added it to defaults
 - added advanced_host_list as example variation
 - refactored 'display' to be availbe by default in class inheritance
 - optimized implicit handling as per @pilou's feedback
 - removed unused code and tests
 - added inventory cache and vbox plugin now uses it
 - added _compose method for variable expressions in plugins
 - vbox plugin now uses 'compose'
 - require yaml extension for yaml
 - fix for plugin loader to always add original_path, even when not using all()
 - fix py3 issues
 - added --inventory as clearer option
 - return name when stringifying host objects
 - ajdust checks to code moving

* reworked vars and vars precedence
 - vars plugins now load group/host_vars dirs
 - precedence for host vars is now configurable
 - vars_plugins been reworked
 - removed unused vars cache
 - removed _gathered_facts as we are not keeping info in host anymore
 - cleaned up tests
 - fixed ansible-pull to work with new inventory
 - removed version added notation to please rst check
 - inventory in config relative to config
 - ensures full paths on passed inventories

* implicit localhost connection local
7 years ago
bengerman13 25aac6151f add integration tests for xattr module (#24947)
* add integration tests for xattr module

* fix whitespace
7 years ago
jhawkesworth b46c098581 Added win_copy recursive integration test with trailing path separator. (#24523)
This is a reproducer for https://github.com/ansible/ansible/issues/23559

Tests will fail until https://github.com/ansible/ansible/pull/23581 is merged

Note that I believe another commit is also needed for this to work,
specifically the change from: https://github.com/ansible/ansible/pull/23326
7 years ago
pdasilva f8e47e2204 Changed assemble_from_fragments to use os.path.join (#24909)
Fixes #19437
7 years ago
Matt Clay 5babe2daea Increase python version coverage for tests. (#24762)
* Improve ansible-test inventory handling.
* Fix python 3 re-raise of exception from thread.
* Fix python 3 encoding for windows-integration.
* Run network tests on multiple python versions.
* Run windows tests on multiple python versions.
* Support Shippable delegation using --tox.
* Skip vyos_command on python 3 tests until fixed.
* Add python 3 filtering to local and tox.
* Fix tests to support back to back runs.
* Temporarily test networking with python 2.7 only.

Running the tests back to back causes intermittent test failures
which need to be addressed before we can test multiple versions
in a single test run.
7 years ago
Matt Clay c4a2deda9d Restore disabled opensuse integration tests. 7 years ago
Rene Moser e34fd20452 cloudstack: test: fix setup cs_vpc not using zone 7 years ago
Matt Clay a23f503286 Temporarily disable cs_network_acl test in CI.
This test currently conflicts with cs_vpc, causing it to fail if
both tests are run together.
7 years ago
René Moser 3ca3163af1 cloudstack: add new module cs_network_acl (#24609) 7 years ago
John R Barker e9e2d67035 Run vyos_command Network tests in Shippable (#24514)
* Run VyOS Network tests in Shippable

* net_command no longer exists

* network/ci

* Disable other network tests

* pep8 fix

* Fix PEP 8 issue.
7 years ago
Matt Clay 771b467941 Disable unstable win_psexec integration test. 7 years ago
Matt Clay dfd19a812f Miscellaneous bug fixes for ansible-test.
- Overhauled coverage injector to fix issues with non-local tests.
- Updated integration tests to work with the new coverage injector.
- Fix concurrency issue by using random temp files for delegation.
- Fix handling of coverage files from root user.
- Fix handling of coverage files without arcs.
- Make sure temp copy of injector is world readable and executable.
7 years ago
Matt Clay 496280858d Revert "Temporarily disable test which fails in group run."
This reverts commit 99d328976d.
7 years ago
Matt Clay b8cb3f519b Detect and fix environment tampering in tests. 7 years ago
Matt Clay 99d328976d Temporarily disable test which fails in group run. 7 years ago
Dag Wieers e855274dc8 win_psexec: Enable -nobanner option by default (#23422)
* win_psexec: Enable -nobanner option by default

PR also includes:
- Option `nobanner:` to remove this flag
- Improvements to Examples
- Improvement to Return Value
- Add types to all parameters now
- Add (limited) integration tests

* Move sysinternals into C:\Windows\Temp
7 years ago
jctanner e9c2546ffe Add integration test targets for core supported modules (#24217)
A preliminary set of test targets for "core" supported module that had no independent tests. These will also help us ensure python3 compatibility for those modules and prevent future regressions.
7 years ago
René Moser 2ef6713abb cloudstack: new module cs_vpn_gateway (#23954)
* cloudstack: new module cs_vpn_gateway
* add integration tests for cs_vpn_gateway
7 years ago
Matt Davis ead23783be slightly increase win_async_wrapper fire and forget sleeptime
* should fix Shippable timeouts when AWS CPU credits are low- right on the bubble of failure w/ 5s execution
7 years ago
Dag Wieers bc806ff479 Windows: Small fix to Add-Warning and Add-DeprecationWarning (#23520)
Simplified the logic, and fix the issue of having a nested list as
entry.

Also indicate that we deliberately want to retain $null values
(and i.e. do not want them to be turned into a boolean).
7 years ago
Ganesh Nalawade 5b3ea6562b Add junos integration test (#24404) 7 years ago
Benjamin Jolivot e99815e9f5 Fortios file only mode + integration tests (#23275)
* WIP file_mode

* WIP

* Add file_mode + integration tests

* fix pep8

* Update doc fragments
Create mutualy_exclusive param
Fix yamllint problem in tests

* Add aliases file + main playbook for fortios

* Install pyfg before running tests

* Install pyfg before running tests in role

* Remove pre_task as it's done in roles

* Force pyFG minimal version for python3

* role_path not role_dir :(

* Change requirements

* Specify Error type when error on import

* Bug in pygf library with python 2.5 (PR is waiting https://github.com/spotify/pyfg/pull/19)

* Bad requirement format

* still bad format -_-'

* remove test/integration/fortios.py (auto generated by tests)
missing new lines at end of file

* pyFG is now fixed in 0.50
7 years ago
Matt Clay d999d613cb Python 3 fixes for CloudStack modules and tests. (#24400) 7 years ago
René Moser aaf4f04574 automated integration tests for cloudstack (#20552) 7 years ago
Matt Clay 86bf27511c Migrate cs_sshkeypair test to ansible-test. 7 years ago
Matt Clay 17e07a27b2 Enable cloud tests for use with ansible-test. 7 years ago
Toshio Kuratomi a0dfa8616a Make fetch default to fail on errors
Fixes #23501
7 years ago
Toshio Kuratomi 3428f42120 Add integration test that modules are loaded from the expected locations (#24170)
* Add integration test that modules are loaded from the expected locations
* Fix ping module to pass PEP8
7 years ago
SesquipedalianDefenestrator 3f321e7591 Add check_mode to get_url (#20532)
* Add check_mode to get_url that does a HEAD request to make sure the URL exists, but doesn't write the real file

* Add info about new --check behavior to docs.  Add tests for the new behavior.  Populate res_args with the info the tests are looking for.

* Add trailing comma

* Change nonexistent test URL to http://{{httpbin_host}/DOESNOTEXIST.  Fix spacing while I'm at it

* Further spacing cleanup

* State that this functionality is in Ansible 2.4+
7 years ago
Pierre-Louis Bonicoli a13d89da68 Debian: really generate locales
/usr/sbin/locale-gen differs between Debian and Ubuntu. With Debian,
locales must be added to /etc/locale.gen before calling locale-gen
command. With Ubuntu, /etc/locale.gen is updated by
/usr/sbin/locale-gen.

Use the locale-gen module which handles both distributions.
8 years ago
Pilou bf5d87af07 PostgreSQL Integration test suite: improvements (#23631)
* PostgreSQL tests: use package module
* PostgreSQL tests: use ansible_service_mgr in order to test init system
* PostgreSQL tests: fix a typo
* PostgreSQL tests: install only required packages
* PostgreSQL tests: use role default value when unchanged
8 years ago
Nathaniel Case fc0bf87c20 Run `save` inside config mode. (#23977)
* Run `save` before exiting config mode.

* Fix unit tests for `save`

* Allow `save` to be on its own again and introspect success

* Introspecting `compare running` makes this a lot harder.

Move `save` tests to integration tests
8 years ago
Toshio Kuratomi bffccb5396 fetch idempotence test and deprecate validate_md5
Added an integration test for fetch module idempotence.  (Testing
that validate_checksum is doing what it's supposed to is harder as we'd
have to create a race condition with the downloaded data to trigger it.
Probably need to make that a unittest eventually).

Also give a deprecation message to the validate_md5 parameter so that we
can eventually get rid of it.
8 years ago
Brian Coca e29dc49a49 moved to exceptions for basic skip/fails
better handling of checkmode and async
fix test to follow new flow control
8 years ago
Brian Coca 4594bee65a keep unsafe .. unsafe (#23742)
* keep unsafe .. unsafe

fixes #23734, which was broken in previous fix that allowed non string types to be templated
use new 'is_template' function vs bastardizing others
refactored clean_data to allow for arbitrary data structures to clean
fixed/removed some tests

* deal with complex data for is_template

* typos
8 years ago
Guillaume Coré c7f4c97b18 async+script: add integration test (#23818)
see #23729
8 years ago
Ricardo Carrillo Cruz 0bbfd3d4e0 Add missing aliases file to ios_system integration target (#23795) 8 years ago
Ricardo Carrillo Cruz 82fd038998 Add missing aliases file to iosxr integration tests targets (#23796) 8 years ago
Adrian Likins ae3d7fb29e Fix vault reading from stdin (avoid realpath() on non-links) (#23583)
* Fix vault reading from stdin (avoid realpath() on non-links)

os.path.realpath() is used to find the target of file paths that
are symlinks so vault operations happen directly on the target.

However, in addition to resolving symlinks, realpath() also returns
a full path. when reading from stdin, vault cli uses '-' as a special
file path so VaultEditor() will replace with stdin.
realpath() was expanding '-' with the CWD to something like
'/home/user/playbooks/-' causing errors like:

        ERROR! [Errno 2] No such file or directory: u'/home/user/ansible/-'

Fix is to specialcase '-' to not use realpath()

Fixes #23567

* to_text decrypt output when writing to stdout
8 years ago
Brian Coca 8382ed7200 added test emulating #23180 use case 8 years ago
Matt Martz 621e27b5dd Urls client cert auth (#18141)
* Build HTTPSClientAuthHandler more similarly to how HTTPSHandler works

* Add docs for new client cert authentication

* Support older versions of python

* Simplify logic

* Initial support for client certs in urls.py

* Add an extra test

* Add a get_url test for client cert auth

* Add additional test for client cert auth, with validation and ssl mismatch

* Skip assert when http tester not available

* Update version_added for new options
8 years ago
Toshio Kuratomi 78ced5318f Fix for recursive copy slowness
Copy module was walking over files in subdirectories repeatedly (a
directory tree a few levels deep could bring the time spent into the
tens of minutes)

This was traced to the fix for this bug report: https://github.com/ansible/ansible/issues/13013

Fixed #13013 a different way and added an integration test to check for
regressions of #13013 as we optimize this code.

Fixes #21513
8 years ago
Matt Martz ac61f09203 Extra deps needed for building cryptography 8 years ago
Matt Martz 13ac993d25 Fallback to old ssl_wrap_socket 8 years ago
Matt Martz b4b76bab14 Update install deps for SNI tests 8 years ago
Ricardo Carrillo Cruz 13b2f11139 Do not assert session name on idempotent eos banner (#23402)
* Check for proper response key on eos_banner map_config_to_obj

If we run the task with 'login' banner, the 'show banner' command
will return a dict containing key 'loginBanner'.
However for motd, it will just return 'motd'.
Yay naming consistency!

* Do not assert session exists on eos_banner response not changing device
8 years ago
Ricardo Carrillo Cruz ce9826d76e Fix eos_banner basic-motd eapi asserts (#23398)
The commands in EAPI does not contain the plain command sent to the
device as a one liner, but it is split in cmd/input keys.
8 years ago
Ricardo Carrillo Cruz 2cc2b8fb4d Add missing provider to eos_banner basic-motd eapi test (#23396)
Otherwise this stalls and timeouts, it doesn't have creds to run.
8 years ago
Nathaniel Case 98c23a3342 Attempt to clear up nxos_mtu tests and documentation (#23361)
nxos_system wasn't added until 2.3, so nxos_mtu should have been deprecated
then.
8 years ago
Matt Clay 40e88dadbe Disable zypper tests for CI due to timeouts. 8 years ago
Ricardo Carrillo Cruz 4571ff0b52 Fix eapi basic-login asserts (#23318)
The asserts where not checking the commands sent to the device
8 years ago
Ricardo Carrillo Cruz cf30f0f27d Fix asserts on ios_banner tests (#23315)
The contain assert was broken.
8 years ago
Ricardo Carrillo Cruz d268471739 Fix basic-login eapi tests for eos_banner (#23304)
We should be passing the provider dict, not the transport.
8 years ago
John R Barker f22702eee2 enable ios_facts tests again (#23310) 8 years ago
Nathaniel Case d890167575 Fix nxos_facts for nxapi transport (#23302)
* Partial revert of 2e476e64cd

This broke handling of nxos_facts over nxapi

* Fix nxos_facts tests not run in isolation
8 years ago
Robin Roth 6f40cb9647 Add workaround for evasive in apache2_module (#22649)
* Add workaround for evasive in apache2_module

* Fixes #22635
* Clean up workarounds for php/shib
* Add test for evasive workaround
* Remove use of re module, since all searches work with native python

* Add unit tests to apache2_module name replacements

Go back to using re package where needed

* Rename replace_name to create_apache_identifier
8 years ago
Chulki Lee 99ef1f3a9f git: git reset with branch
`git reset <ref>` can be ambiguous and fail to switch to the correct branch.
To avoid it, specify branch as well.
8 years ago
Matt Clay 79fa5ef4cb Add missing group_vars to group_by test. 8 years ago
Brendan Jurd 7fb1519035 Add integration tests for group_by precedence.
Test that, when a group is created with group_by, variables from the
corresponding group_vars/ file are correctly pulled in, and override
variables specified in group_vars/all.

See ansible/ansible#8664.
8 years ago
Matt Clay b7cc4616b1 Fix integration aliases. 8 years ago
Matt Clay 58c2470e8f Fix deploy_helper integration tests. 8 years ago
Ramon de la Fuente 550d229c7b added deploy_helper module tests 8 years ago
Jordan Borean 3e1a16c574 win_find fix up age parameter (#23195) 8 years ago
Jordan Borean 4d1b97d1ae win_stat change return islink to islnk to match stat (#23196) 8 years ago
Ricardo Carrillo Cruz 9cc47df30e Fix eos_banner cli basic_motd integration test (#23158)
A task was lacking the provider variable, causing the test to fail.

Fixes #23130
8 years ago
Konstantin Suvorov c1b3d6a51f Fix 'sequence' lookup shortcut syntax and documentation (#22989)
* fix 'sequence' lookup shortcut syntax and documentation

* Update playbooks_loops.rst

Minor edits for grammar and clarity.

* Update playbooks_loops.rst

Another tweak for clarity.
8 years ago
Ricardo Carrillo Cruz 1fd58c295c Add missing aliases files on nxos integration targets (#23070) 8 years ago
Ricardo Carrillo Cruz 0e954b0fd9 Add aliases file to nxos_interface integration target (#23069) 8 years ago
Ricardo Carrillo Cruz ac6465689c Add nxos_interface integration testing (#23030)
This is a first step before starting the refactoring of
the nxos_interface code.
8 years ago
Miyurz 1ea1becf23 Fixes bug https://github.com/ansible/ansible/issues/22455 - Git reset… (#22502)
* Fixes bug https://github.com/ansible/ansible/issues/22455 - Git reset fails when file with the name 'origin' is present in the repository

* #22455 Integration test for git module to test if it clones a repository with a file named origin

* Fixed yaml errors for test/integration/roles/test_git_clone/tasks/main.yml

* Removed the newly added target git and moved the code to test/integration/targets/git

* Reorganised code structure as per comments

* Fixed playbook name

* Added code that didn't make it to the playbook before.

* No longer need git.yml

* Remove non tasks specific code from tasks file and use existing variables

* Removed msg var from the vars.yml
8 years ago
Matt Clay 318445fe19 Associate `systemd` module with `service` test. (#22847) 8 years ago
Matt Davis e084e8809e force Windows to always use preamble-free UTF8 input encoding (#22934)
* fixes #15770
* When running under the UTF-8 codepage, Powershell subprocesses will fail (eg, Start-Job, others) if the input encoding is using the default BOM preamble. This fix forces it to use no preamble in leaf_exec and win_shell, and includes tests to verify that Start-Job works.
8 years ago
Artem Zinenko f4b34a4c3b win_firewall_rule doesn't fail when profile is "any" or remoteip is IPv4 and the task runs more than once. (#22555)
* Fixed #22554

* Wrote tests for win_firewall_rule module

* Fixed #22786

* Fixed review comments

* Fixed #22799

* Added test when RemoteIP containt a netmask

* Revert comment
8 years ago
Dag Wieers ac43a1bbbc Windows: Use the correct newline sequence for the platform (#21846)
This change to the template action plugin make template use the
platform's native newline_sequence for Jinja.

We also added the option `newline_sequence` to change the newline
sequence using by Jinja if you need to use another newline sequence than
the platform default.

This was previously discussed in
https://github.com/ansible/ansible/issues/16255#issuecomment-278289414

And also relates to issue #21128
8 years ago
Dag Wieers ef36d7de68 win_scheduled_tasks: Improve example test framework (#22833)
Updated as discussed in previous Test Working Group.
8 years ago
Matt Davis 73f50b4f9f fix Windows env handling (#22927)
* fixes #22441
* fixes #22655
* moves all env handling into the exec wrapper; this should work for everything but raw, which is consistent with non-Windows.
8 years ago
Jordan Borean f1ab879bb6 win_reg_stat change the module parameters for standardisation (#22732) 8 years ago
Matt Clay 45951a69a6 Rewrite ansible-pull tests to use local repo. (#22821) 8 years ago
Matt Clay 3585d3d368 Add missing `needs/root` alias to `file` test. (#22800) 8 years ago
Matt Clay b7c80dbb7e Disable failing MySQL tests on FreeBSD. (#22798) 8 years ago
Matt Clay 93d9b04f1d Fix uri options test to work again. 8 years ago
Matt Clay 011b324638 Do not run `win_chocolatey` in CI tests.
The test is failing repeatedly.
8 years ago
Ricardo Carrillo Cruz 6e56a61535 Add ios_banner module (#22687)
With unit and integration tests.
8 years ago
Dag Wieers 72e7927dd5 win_scheduled_task: Added frequency: once and check_mode support (#22611)
* win_scheduled_task: Added frequency: once and check_mode support

This patch includes:
- Renamed `execute:` parameter to `executable:`
- Renamed `argument:` parameter to `arguments:`
- Implemented `frequency: once` support
- Implemented check_mode support
- Fix idempotency issue related to empty description
- Added integration tests

* Improve the integration test structure

I think this is a great way to test normal mode and check-mode from the same playbook.

* Small fixes after review
8 years ago
Jordan Borean 6ce338d29c win_service Added -Force option and minor cleanup (#22598)
* win_service Added -Force option and minor cleanup

* Changed parameter and fixed typos
8 years ago
Matt Davis ce56da69b2 make windows async ... async (#22624)
Fixes #22575 - issue under new exec wrapper where unconstrained handle inheritance (for stdin) caused WinRM to block on breakaway processes. Uses explicit handle inheritance to ensure that only stdin read handle gets inherited. Adds test to ensure that async is actually async.
8 years ago
Peter Sprygada 39c38bf30d fixes candidate var type in junos shared lib (#22551)
* candidate var can now be string, list or element
* fixes minor bug in junos_template for backup argument
* disabled invalid integration test for junos_template
8 years ago