Commit Graph

3169 Commits (36311633299fe9af67214ff8027f21e63c84467a)

Author SHA1 Message Date
Matt Clay 3631163329 Clean up and migrate Azure tests. (#28103)
* Remove placeholder Azure test.
* Migrate Azure tests to ansible-test.
* Initial cleanup on remaining legacy Azure tests.
7 years ago
Toshio Kuratomi ac56a2f138 Remove wildcard imports and get_exception calls
Fixed module_utils
7 years ago
Toshio Kuratomi 039383d90f Fix symbolic mode usage in unarchive with zip files
Fixes #21090
7 years ago
Matt Clay caf8bbf3bd Add Azure support to ansible-test. (#28092)
* Initial Azure cloud testing support.
* Add missing Azure requirements.
* Fix test handling of setup and requirements.
* Update Azure cloud plugin.
* Add setup_azure role for integration tests.
* Update minimal Azure integration test sample.
7 years ago
Matt Clay c27ebfc368 Migrate roles from ansible/azure-testing (#28074)
* Migrate roles from ansible/azure-testing as-is.
* Fix yamllint issues.
* Remove unused binary file.
7 years ago
Matt Clay 5b6321e45d Update ansible-test handling of setup.py changes. 7 years ago
chriskarel 991918e9d2 Fix idempotency for Unix permissions in zip files. (#24580)
* Fix idempotency for Unix permissions in zip files.

This fix prevents the unarchive module from reporting 'changed' when a zipfile contains items with Unix permissions that differ from the system default.

* Update zip unarchive tests.

Additional tests for the unarchive module with zip files:
- Test file in zip archive with non-default permissions
- Test file added to zip archive with Windows permissions

* Additional fix for mixed win/unix archives.

  Turns out my original fix fails under some mixed archives, as setting the umask to zero can be applied to those files.  This creates a per-file umask variable, so a mix of permission types don't cause problems.

* CI Checks

CI checks for archives with:
* non default Unix permissions
* Windows permissions


* Workaround for BSD differences.

Using Zipinfo due to lack of support in BSD unzip.
Permissions handling is also different in BSD -- always applies UMASK to file permissions.

* Added checks for creating directories and SSH keys for existing users.
7 years ago
Ricardo Carrillo Cruz a5b483da16 Replace username for name in eos_user integration tests (#28067)
username param is read by eos action plugion load_provider, if present
it is set as the play context remote user.
That means if you have a play remote_user: admin it won't be used, but instead
whatever is put in the task argument username.
Changing the tests to use name fixes the issue, we may want to remove username
as valid module argument in other change.
7 years ago
Sloane Hertel 1de91a9aa0 [cloud] Convert `s3` module to use boto3 (#21529)
* replace boto with boto3 for the s3 module

make s3 pep8 and remove from legacy files

fix s3 unit tests

* fix indentation

* s3 module - if we can't create an MD5 sum return None and always upload file

* remove Location.DEFAULT which isn't used in boto3 and tidy up the docs

* pep8

* s3: remove default: null, empty aliases, and required: false from documentation

fix incorrectly documented defaults

* Porting s3 to boto3. Simplify some logic and remove unused imports

* Fix s3 module variables

* Fix a typo in s3 module and remove from pep8 legacy files

* s3: add pagination for listing objects.

Fix logic and use head_object instead of get_object for efficiency.

Fix typo in unit test.

* Fix pagination to maintain backwards compatibility.

Fix incorrect conditional.

Remove redundant variable assignment.

Fix s3 list_object pagination to return all pages

* Use the revised List Objects API as recommended.

* Wrap call to paginated_list in a try/except

Also remembered to allow marker/prefix/max_keys to modify what keys are listed

* Simplify argument
7 years ago
Matt Clay 869e90e12a Don't fail coverage reporting due to parse errors. 7 years ago
Jordan Borean 5fbbf0e75a win_hotfix: new module to install Windows hotfixes (#27260)
* win_hotfix: new module to install Windows hotfixes

* revert to older module util loader style to satisfy the checks for now

* Changes from PR

* changed the test hotfix so we can run tests in shippable
7 years ago
Jordan Borean 44ed891290 win_mapped_drive: new module (#27020)
* win_mapped_drive: new module

* Rebased from upstream and updated copyright text
7 years ago
Jordan Borean e46adece48 win_user_right: add module with tests (#26276)
* win_user_right: add module with tests

* fixed up name of module in docs

* forgot the test module

* fixed up whitespace

* changes made to win_user_right based on feedback

* moved away from using secedit to Win32 with P/Invoke

* tidied up copyright for documentation
7 years ago
Ganesh Nalawade 3b0e9ded91 Fix fallback and boolean check in argspec (#27994)
Fixes #27978

*  Add missing assignment for param key in fallback handling
*  Add check for frozenset type
*  Unit testcase
7 years ago
Ricardo Carrillo Cruz e8f1c1511c Implement purge on eos_vrf (#28013) 7 years ago
Martin Krizek 1c4e491eac yum: do not hide yum's errors (#27696) 7 years ago
David Newswanger a3ad614759 ignore failures when trying to remove interfaces that are already missing using nxos_config (#28003) 7 years ago
Ricardo Carrillo Cruz 87757ca385 Remove eos group_vars creds and increase eapi timeout (#28008)
We don't need provider creds as we set those at inventory group vars,
increasing eapi timeout as some eapi tests are flip flopping with
timeouts.
7 years ago
Adrian Likins 220db9cdd2 Better vault pass prompt behav on EOF, more unit tests (#27981) 7 years ago
Adrian Likins 82f550e8cd Add prompt formats for 2.3 compat ask-vault-pass (#27974)
The prompt_formats dict didn't get the 'prompt_ask_vault_pass'
item added for interactive --ask-vault-pass, which
caused "KeyError: u'prompt_ask_vault_pass'"

Fixes #27885
7 years ago
Valentin Krasontovitsch cfff72e9db Use apt-get as fallback for apt upgrade
In answer to #2540, `aptitude` was introduced as tool of choice for running
upgrades in the apt module and installing new packages that arise as
dependencies during upgrades.

This recently lead to problems, as for example Ubuntu Xenial (16.04) ships
without aptitude (installed).

Studying the man pages of both apt-get and aptitude, it appears that we can
achieve the effects of `aptitude safe-upgrade` using

```
apt-get upgrade --with-new-pkgs --autoremove
```

while `aptitude full-upgrade` seems to be identical to `apt-get dist-upgrade`.

We use `apt-get` as described above as a fall-back in case that `aptitude`
cannot be found, issuing a warning when it does so.

Furthermore it introduces a flag `force_apt_get` which may be used to enforce
usage of apt-get (which does not issue a warning).

The integration tests are updated accordingly.

Cf. also the discussion in #27370.

Fixes #18987
7 years ago
Abhijeet Kasurde f7321a87ca Pep8 fixes for rabbitmq modules (#24590)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
7 years ago
rahushen 85fc4c67ef Add integration tests for nxos_facts, nxos_bgp, nxos_bgp_af, nxos_bgp_neighbor, and nxos_evpn_global (#26924)
* Add new ITs for nxos_bgp, nxos_bgp_af, nxos_bgp_neighbor, and nxos_evpn_global

* Add nxos_facts IT and enhance existing tests

* switch nxos_feature tests to use bgp

* misc. test fixes

* Add checks for titanium in IT

* Handle non-titanium case in tests
7 years ago
Ricardo Carrillo Cruz 7e2169f6d5 Add aggregate functionality to eos_vrf (#27915)
* Add aggregate functionality to eos_vrf

* Add tests for eos_vrf aggregate option

* Remove test2 and test3 vrfs at the beginning of the eos_vrf tests

* Pull all vrfs

With aggregate, we need to get all VRFs and we then compare with
desired VRFs, instead of assuming it will be just one.
7 years ago
Dag Wieers eee09565b1 utilities modules: PEP8 compliancy (#27741) 7 years ago
Matt Clay 6c4bf53518 Restore f5 unit test requirements. (#27992) 7 years ago
Philippe Dellaert 920cd7bb1c New module: Waiting for VMware tools to become available (#27236)
* Adding VMware tools module
Functionality: Waits for VMware tools to become available (running
state)

* Adding base integration test preparations
Until govcsim supports actual guest tool status, the tests are disabled

* Cleanup and better getvm method

* Updating Changelog

* Adding required metaclass and future import

* Rename to vmware_guest_tools_wait

* Cleanup of documentation

* Fixing review remarks
7 years ago
Zac Medico 501fc7a248 template: fix KeyError: 'undefined variable: 0 (#27972)
* template: fix KeyError: 'undefined variable: 0

For compatibility with the Context.get_all() implementation
in jinja 2.9, make AnsibleJ2Vars implement collections.Mapping.
Also, make AnsibleJ2Template.newcontext() handle dict type
for the 'vars' parameter.

See: d67f0fd4cc
Fixes: https://github.com/ansible/ansible/issues/20494

* add units/template/test_vars

* intg tests for jinja-2.9 issues like 20494

test cases here are based on
https://github.com/ansible/ansible/issues/20494#issue-202108318
7 years ago
David Moreau-Simard b35c749268 Add a sensu_client module
This provides a sensu_client module in order to be able to dynamically
configure a Sensu client.

It takes a different approach than the existing Sensu modules such as
sensu_check but is hopefully a much more flexible and simple way of
handling configurations.
7 years ago
David Moreau-Simard 7a56e5d45d Add sensu_handler Ansible module
This provides a sensu_handler module in order to be able to dynamically
configure a Sensu handler.
7 years ago
Nathaniel Case a78f3faa6c nxos_bgp_neighbor_af does not want required_together (#26370)
* nxos_bgp_neighbor_af does not want required_together

* fixup tests

* Fix max_prefix_* issues

* Require address-family

* Fix idempotency for next_hop_third_party

* Fix idempotency for allowas_in*

* Fix idempotency for *_in and *_out

* Reorder command generation again

`default` is first, then `max-prefix`, then booleans
7 years ago
Colin Nolan db50650365 Adds support for all Consul 0.8 ACL rule scopes (#25800)
* Added in support for 'agent' and 'node' types.

* Tidies and moves `consul_acl` module closer to PEP8 compliance.

* Switched from using byspoke code to handle py2/3 string issues to using `to_text`.

* Made changes suggested by jrandall in https://github.com/ansible/ansible/pull/23467#pullrequestreview-34021967.

* Refactored consul_acl to support scopes with no pattern (and therefore a different HCL defintion).

* Corrects whitespace in Consul ACL HCL representation.

* Fixes Consul ACL to return the HCL equivalent JSON (according to the Consul docs) for the set ACLs.

* Repositioned import to align with Ansible standard (!= PEP8 standard).

* Adds Python 2.6 compatibility.

* Fixes PEP8 issues.

* Removes consul_acl.py as it now passes PEP8.

* Follows advice in the "Documenting Your Module" guide and moves imports up from the bottom.

* Tidies consul_acl module documentation.

* Updates link to guide about Consul ACLs.

* Removes new line spaces from error message string.

* Provide better error message if user forgets to associate a value to a Consul ACL rule.

* Minor refactoring of Consul ACL module.

* Fixes bug that was breaking idempotence in Consul ACL module.

* Detects redefinition of same rule.

* Adds test to check the Consul ACL module can set rules for all supported scopes.

* Fixes return when updating an ACL.

* Clean up of Consul ACL integration test file.

* Verify correct changes to existing Consul ACL rule.

* Adds tests for idempotence.

* Splits Consul ACL tests into cohesive modules.

* Adds test for deleting Consul ACLs.

* Test that Consul ACL module can set all rule scopes.

* Fixes issues surrounding the creation of ACLs.

Thanks for the comments by manos in https://github.com/ansible/ansible/pull/25800#issuecomment-310137889.

* Stops Consul ACL's name being "forgotten" if ACL updated by token.

* Fixes incorrect assignment when a Consul ACL is deleted.

* Fixes value of `changed` when Consul ACL is removed.

* Fixes tests for Consul ACL.

* Adds interal documentation.

* Refactors to separate update and create (also makes it possible to unit test this module).

* Improves documentation.

* Completes RETURN documentation for Consul ACL module.

* Fixes issue with equality checking for `None` in ACL Consul.

* Fixes Python 2 issue with making a decision based on `str` type.

* Fixes inequality check bug in Python 2.

* Adds tests for setting ACL with token.

* Adds support for creating an ACL with a given token.

* Outputs operation performed on Consul ACL when changed.

* Fixs issue with test for creating a Consul ACL with rules.

* Corrects property used to set ACL token in python-consul library.

* Fixes tear-down issue in test that creates a Consul ACL using a token.
7 years ago
saichint 14186af558 Fix for nxos_ospf idempotent issue (#27913) 7 years ago
Nathaniel Case 01dda25e0f fix nxapi transport in nxos_snmp_location (#27849)
* fix nxapi transport in nxos_snmp_location

* Appease Shippable
7 years ago
Nathaniel Case c1bf74283e Network load_config: Capture configuration output and display as warnings (#27851)
* Capture configuration output and display as warnings

* Don't break on nxapi

nxapi errors very loudly instead, so no need to muck about with warnings
7 years ago
Ricardo Carrillo Cruz 9f26b853e8 Remove vyos_facts neighbors integration tests (#27957)
The tests rely on setting the lldp IP on the management interface.
However, the IP discovered is the private IP of the node, and tests
require accessing it via Nodepool node public IP.
Removing that test for now to get CI green again, we'll reasses once we
release 2.4.
7 years ago
Trishna Guha a005ca035d remove replace config test (#27953)
remove replace config eos_config test
7 years ago
Ricardo Carrillo Cruz 0f77afbd60 Change play timeout for persistent connection command timeout (#27948)
There's been a change in persistent connect framework that switches
playbook timeout (which corresponds to 'timeout' param) to command_timeout.
While we fix this and return the functionality, let's put the command_timeout
in place to avoid CI being red.
7 years ago
Ganesh Nalawade c05b303db5 junos lldp interface test fix (#27946) 7 years ago
Trishna Guha dd8b65395f fix eos failed tests (#27945)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
7 years ago
Matt Clay a40cb5a47f Miscellaneous ansible-test updates. (#27937)
* Add keep alives to ansible-test ssh delegation.
* Improve ansible-test JSON parsing error messages.
* Increase ansible-test delegation sleep and retry.
* Update ansible-test to recognize .psm1 files.
7 years ago
Dag Wieers 6874ba23ff New module: Support manipulating XML files (#25323)
* Import original unmodified upstream version

This is another attempt to get the xml module upstream.
https://github.com/cmprescott/ansible-xml/

This is the original file from upstream,
without commit 1e7a3f6b6e2bc01aa9cebfd80ac5cd4555032774

* Add additional changes required for upstreaming

This PR includes the following changes:

- Clean up of DOCUMENTATION
- Rename "ensure" parameter to "state" parameter (kept alias)
- Added EXAMPLES
- Remove explicit type-case using str() for formatting
- Clean up AnsibleModule parameter handling
- Retained Python 2.4 compatibility
- PEP8 compliancy
- Various fixes as suggested by abadger during first review

This fixes cmprescott/ansible-xml#108

* Added original integration tests

There is some room for improvement wrt. idempotency and check-mode
testing.

* Some tests depend on lxml v3.0alpha1 or higher

We are now expecting lxml v2.3.0 or higher.
We skips tests if lxml is too old.

Plus small fix.

* Relicense to GPLv3+ header

All past contributors have agreed to relicense this module to GPLv2+, and GPLv3 specifically.

See: https://github.com/cmprescott/ansible-xml/issues/113

This fixes cmprescott/ansible-xml#73

* Fix small typo in integration tests

* Python 3 support

This PR also includes:
- Python 3 support
- Documentation fixes
- Check-mode fixes and improvements
- Bugfix in check-mode support
- Always return xmlstring, even if there's no change
- Check for lxml 2.3.0 or newer

* Add return values

* Various fixes after review
7 years ago
Matt Clay 5cb3acaed1 Add missing unit test requirement. 7 years ago
Adrian Likins c38ff3b8f8 pylint fixes for vault related code (#27721)
* rm unneeded parens following assert
* rm unused parse_vaulttext_envelope from yaml.constructor
* No longer need index/enumerate over vault_ids
* rm unnecessary else
* rm unused VaultCli.secrets
* rm unused vault_id arg on VaultAES.decrypt()

pylint: Unused argument 'vault_id'
pylint: Unused parse_vaulttext_envelope imported from ansible.parsing.vault
pylint: Unused variable 'index'
pylint: Unnecessary parens after 'assert' keyword
pylint: Unnecessary "else" after "return" (no-else-return)
pylint: Attribute 'editor' defined outside __init__

* use 'dummy' for unused variables instead of _

Based on pylint unused variable warnings.

Existing code use '_' for this, but that is old
and busted. The hot new thing is 'dummy'. It
is so fetch.

Except for where we get warnings for reusing
the 'dummy' var name inside of a list comprehension.

* Add super().__init__ call to PromptVaultSecret.__init__
pylint: __init__ method from base class 'VaultSecret' is not called (super-init-not-called)

* Make FileVaultSecret.read_file reg method again

The base class read_file() doesnt need self but
the sub classes do.

Rm now unneeded loader arg to read_file()

* Fix err msg string literal that had no effect
pylint: String statement has no effect

The indent on the continuation of the msg_format was wrong
so the second half was dropped.

There was also no need to join() filename (copy/paste from
original with a command list I assume...)

* Use local cipher_name in VaultEditor.edit_file not instance
pylint: Unused variable 'cipher_name'
pylint: Unused variable 'b_ciphertext'

Use the local cipher_name returned from parse_vaulttext_envelope()
instead of the instance self.cipher_name var.

Since there is only one valid cipher_name either way, it was
equilivent, but it will not be with more valid cipher_names

* Rm unused b_salt arg on VaultAES256._encrypt*
pylint: Unused argument 'b_salt'

Previously the methods computed the keys and iv themselves
so needed to be passed in the salt, but now the key/iv
are built before and passed in so b_salt arg is not used
anymore.

* rm redundant import of call from subprocess
pylint: Imports from package subprocess are not grouped

use via subprocess module now instead of direct
import.

* self._bytes is set in super init now, rm dup

* Make FileVaultSecret.read_file() -> _read_file()

_read_file() is details of the implementation of
load(), so now 'private'.
7 years ago
schwatvogel b8d371ca8b Fixes #23558 rpm key ids (#27847)
* Changed rpm-keyid extraction and verification method
* minor style fixes
* fixed rpm key deletion,added integration test for mono key,fixed wording in integration tests
7 years ago
Matt Clay 2d2377bccc Remove f5 test requirements to fix CI. 7 years ago
saichint babec35faa Fix nxos_vtp_password and nxos_vrf_interface for remove idempotency tests (#27724)
* fixes for 27600 27676

* add sanity tests
7 years ago
David Newswanger b985c34dd4 added integration tests for vyos_facts (#26748)
* broke vyos facts into two files

* list vyos facts when failing

* dynamically determine ip

* broke up assert
7 years ago
Abhijeet Kasurde e244deedbd Add wait for vcsim to come online (#27887)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
7 years ago
mzizzi 4648dc9702 [cloud] Add more configurable backoff implementations to CloudRetry/AWSRetry (#27251) 7 years ago