Commit Graph

1394 Commits (a7bc11ce67ee58f384c82b6dcae4feede19044a5)

Author SHA1 Message Date
Matt Clay a7bc11ce67
Work around virtualenv/venv issue in ansible-test. (#62111)
Creating a virtual environment using `venv` when running in a virtual environment created by `virtualenv` results in a copy of the original virtual environment instead of creation of a new one.

To work around this, `ansible-test` now identifies when it is running in a `virtualenv` created virtual environment and uses the real Python interpreter to create the `venv` virtual environment.
5 years ago
Jill R 414d844ed2 AWS ec2_vpc_net: Enable ipv6 CIDR assignment (#60983)
* AWS ec2_vpc_net: Enable ipv6 CIDR assignment

Enable IPv6 CIDRs in ec2_vpc_net, and fix ec2_vpc_subnet tests that
were depending on the aws cli for CIDR assignment.

Related to: #27800
5 years ago
Matt Clay 983f0ad5a0 Properly exclude tests/output/ from code coverage. 5 years ago
Matt Clay f110abb806
Fix ansible-test to ignore `tests/output/`. (#62084)
The `test/results/` directory for Ansible test output was already ignored when not using git.

When Ansible Collections were switched to `tests/output/` the ignore entry was previously overlooked.
5 years ago
Matt Clay 064e8e1ef4
Fix ansible-doc traceback and sanity test. (#62040)
* Fix ansible-doc traceback for removed modules.

This avoids tracebacks with errors like the following when a module has been removed:

module module_name missing documentation (or could not parse documentation): 'NoneType' object does not support item assignment

* Fix ansible-doc sanity test warning handling.

Warnings about removed modules/plugins on stderr are now properly ignored.

Previously an ansible-doc error could result in unrelated errors going undetected because tests were stopped early and the underlying error was ignored.
5 years ago
Felix Fontein c19cea9b03
openssh_keypair: make sure public key has same permissions as private key (#61658)
* Make sure public key has same permissions as private key.

* Add changelog.

* Text, not binary.
5 years ago
Matt Clay c77ab11051
Fix issues with ansible-test --venv option. (#62033)
* Fix ansible-test venv activation.

When using the ansible-test --venv option, an execv wrapper for each python interpreter is now used instead of a symbolic link.

* Fix ansible-test execv wrapper generation.

Use the currently running Python interpreter for the shebang in the execv wrapper instead of the selected interpreter.

This allows the wrapper to work when the selected interpreter is a script instead of a binary.

* Fix ansible-test sanity requirements install.

When running sanity tests on multiple Python versions, install requirements for all versions used instead of only the default version.

* Fix ansible-test --venv when installed.

When running ansible-test from an install, the --venv delegation option needs to make sure the ansible-test code is available in the created virtual environment.

Exposing system site packages does not work because the virtual environment may be for a different Python version than the one on which ansible-test is installed.
5 years ago
Nathaniel Case 50e09be14f
Allow the use of _paramiko_conn even if the connection hasn't been started. (#61570)
* Allow the use of _paramiko_conn even if the connection hasn't been started.

I'm not sure what the benefit is of Noneing paramiko_conn on close, but will keep for now

* Fix test

* Try to fix up net_put & net_get

* Add changelog
5 years ago
Jordan Borean 6e8d430872
win_become - don't dispose logon token until end (#61905) 5 years ago
Mario Lenz 900a51b283 VMware: Fix issue with order of changes in vmware_vcenter_statistics 5 years ago
Gonéri Le Bouder 3ea8e0a144 VMware: not ssl.SSLContext if validate_certs false (#57185)
Python < 2.7.9 does not have the ssl.SSLContext attribute.
ssl.SSLContext is only required when we want to validate the SSL
connection. If `validate_certs` is false, we don't initialize the
`ssl_context` variable.

Add unit-test coverage and a little refactoring:

- avoid the use of `mocker`, when we can push `monkeypatch` which is
  `pytest`'s default.
- use `mock.Mocker()` when possible

closes: #57072
5 years ago
Mark Chappell 1f38a12057 Fix behaviour of module_utils/ec2 compare_policies when dealing with bare bools and ints. (#61115)
* module_utils/ec2: (unit tests) Move unit tests for module_utils/ec2.py into test/units/module_utils

- compare_policies was refactored from s3_bucket
- "ec2_utils" doesn't seem to have ever existed

* module_utils/ec2: (unit tests) Add unit test for comparing quoted and unquoted bools and numbers within policies

As per https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_grammar.html

"Values are enclosed in quotation marks. Quotation marks are optional for numeric
and Boolean values."

* module_utils/ec2: Explicitly convert bools and ints to strings when comparing policies

See also: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_grammar.html
5 years ago
Abhijeet Kasurde 3703c3bb1a
atomic_image: Fix absent state (#61827)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
5 years ago
Simon Dodsley df49a9e58c purefa_info: Fix failure due to API version check (#61925) 5 years ago
Felix Fontein d40ba28fb4
docker_container: improve port range parsing error behavior (#61740)
* Improve port range parsing.

* Add changelog.
5 years ago
Chris Trufan 943888b955 Fixes to ecs_certificate cert chain for #61738 (#61858)
* Fixes to ecs_certificate cert chain for #61738

* Added changelog fragment

* Fixes to ecs_certificate for cleaner join, and better integration test

* Fix integration test formatting

* End cert chain with a \n

* Update changelogs/fragments/61738-ecs-certificate-invalid-chain.yaml

Co-Authored-By: Felix Fontein <felix@fontein.de>

* Update main.yml
5 years ago
Andreas Calminder cac93cbd1f os_port allowed_address_pairs and extra_dhcp_opts list of dicts comparison fix (#56577)
* compare list of dicts

* update example for dhcp_server_opts to include ip_version which is automatically added by openstack

* add note about dhcp_server_opts

* add changelog fragment

* fix forgotten exception+pass

* no need to excplicitly check for None

* fix oops

* fix import error

* missed missing_required_lib

* changelog fragment formatting and grammar fixes

* update requirements in documentation and fix spelling
5 years ago
Mark Chappell b8650c0a50 aws_asg: Fix idempotency when using tags and metrics (#61284)
* Update AWS hacking policy to enable ASG Tagging management

* aws_asg: Add tests for ASG Tagging (including idempotency)

* aws_asg: ignore sort order when comparing tags on the ASG (fix idempotency)

* ec2_asg: (integration tests) test for idempotency when managing metrics collection

* ec2_asg: sort list of enabled metrics to ensure clean comparisons.
5 years ago
Matt Martz 8331c8fdc3
Properly hide limit and list-hosts args from ansible-inventory (#61618)
* Properly hide limit and list-hosts args from ansible-inventory. Fixes #61604

* Add changelog fragment

* Consolidate limit

* Fix positional argument with --graph

* Properly error for hidden arguments

* linting issue

* host pattern changelog
5 years ago
Sam Doran 61efffcbe1
User - correct group removal description in docs (#61936) 5 years ago
Ganesh Nalawade 4f29b5a76b
Fix ansible-connection persist after playbook run complete issue (#61591)
* Fix ansible-connection persist after playbook run issue

*  PR https://github.com/ansible/ansible/pull/59153 to add support
   for delaying the ansible-connection added an old issue of
   ansible-connection persisting even after playbook run is finished
   till either command timeout or connect timeout is triggered.
   ansible-connection persist after playbook execution is done
   and also delays the connection initilization untill a method
   in invoked from module side on the connection object.

* Add chanegelog
5 years ago
Matt Davis 7f4328ad12
allow external collections under the ansible NS (#61908)
* fixes #59988
5 years ago
Felix Fontein e06dbe6e4f
Azure _info modules: fix returned ansible_facts when called as _info (#61805)
* Fix Azure _info modules which still returned ansible_facts.

* Adjust PR #.

* Fix wrong assignment.

* Reorganize code for clarity.
5 years ago
Bill Dodd 2a932ad7cf Fix power command ResetType mapping logic (#59927)
* fix power command ResetType mapping logic

* add changelog fragment
5 years ago
Jordan Borean 3a7b77a94c
ansible-galaxy fix --server option for roles (#61820) 5 years ago
Matt Martz 8214d188cf Don't truncate the last character from galaxy urls. Fixes #61624 (#61775) 5 years ago
Scott Luther 0c73e47a42 fix erroneous failures in docker_compose due to deprecation warnings … (#61650)
* fix erroneous failures in docker_compose due to deprecation warnings from docker (#60961)

* Update error handling to work with new method of capturing output

Co-Authored-By: Felix Fontein <felix@fontein.de>

* update error handling

* fix syntax error

* fix indentation

* fix indentation (again)

* remove erroneous line
5 years ago
kucharskim 1dea661ce8 Allow 13 asterisk characters in password field without warning (#54893)
On OpenBSD, 13 asterisk characters as a password hash, marks the
account as disabled. Otherwise daily(8) script which executes
security(8) will email operator about not properly locked accounts.

Before the diff, we see following warning:

> [WARNING]: The input password appears not to have been hashed. The 'password' argument must be encrypted for this module to work properly.

After the diff, warning is gone.
5 years ago
Sloane Hertel 91ccb03552 aws_s3 - wait for the bucket before setting ACLs (#61735)
* Wait for the bucket to become available if possible before setting ACLs
5 years ago
Mark Chesney 01f4081b66 Fix creation of DigitalOcean droplets using digital_ocean_droplet module (#61655)
* Omit disallowed 'id' attribute in request body to create a droplet

* Add changelog fragment for PR #61655
5 years ago
Bill Dodd 088d821f75 Fix KeyError exceptions in GetLogs command (#59877)
* fix KeyError exceptions in GetLogs command

* add changelog fragment

* refine the list of LogEntry properties to collect
5 years ago
Alexandre Mulatinho e4d72dd981 luks_device.py: Allow manipulate LUKS containers with label or UUID (#61603)
* luks_device.py: Allow manipulate LUKS containers with label or UUID

- Allow create a LUKS2 container format with label support
- Allow manipulate (open, close, modify) an LUKS container based on
  both label (LUKS2 format) or UUID instead of using devices only.

Fixes: #58973
Signed-off-by: Alexandre Mulatinho <alex@mulatinho.net>

* test_luks_device.py: organizing tests to support labels

- Add label on some tests and fix errors reported by Shippable

Signed-off-by: Alexandre Mulatinho <alex@mulatinho.net>

* luks_device.py: adjusting versions and messages

- Modifying version_added from 2.9 to 2.10
- Fixing some messages
- Created a changelog fragment
- Moving blkid from scope

Fixes #58973
Signed-off-by: Alexandre Mulatinho <alex@mulatinho.net>
5 years ago
Maxim Babushkin f1a1b72f07 os_server - add "tag" to instance nics (#61119)
A custom "tag" could be passed to the instance metadata with the nics.
Add support for the "tag" to the module.
5 years ago
Guillaume Leroy 21b101f8e1 add option to define keysize at luks partition creation (#61522)
* add option to define keysize at luks partition creation

* Bump version_added.

* Extend tests.
5 years ago
René Moser 1ff20e9804 apt_repository: implement update cache retrying (#57266)
* use exponential backoff
* make cache update retries and max delay in between configurable
5 years ago
René Moser fd4ff54580 apt: honor cache_update=false on auto-install deps (#56549)
* apt: honor cache_update=false on auto-install deps
* add porting guide
5 years ago
René Moser 01ae6991bd apt: use exponential backoff for apt update cache retries (#60527)
* make retries and max delay configurable
5 years ago
Mark Chappell 35359959de aws_codecommit: Fix integration tests and Add support for updating the description (#61263)
* Update DevOps AWS policy
- Fix typos in permission names
- While AWS claims you can use 'arn:aws:codecommit:*' it errors unless you use '*'

* aws_codecommit: (integration tests) Migrate to module_defaults

* aws_codecommit: (integration tests) Fix integration tests

* aws_codecommit: (integration tests) Add tests for updating the description

* aws_codecommit: Add support for updating the description and rename "comment" option to "description"
5 years ago
Toshio Kuratomi 8f6dbb732a
[WIP] Cleanups and version bumping for 2.10 (#61572)
* Cleanups and version bumping for 2.10

* Fix changelog url now that stable has been branched

* Fix the lenth of the porting guide title now that the version is two digits
5 years ago
Jordan Borean 951dac7691
Azure fix _info/_facts return values for some modules (#61584)
* Azure fix _info/_facts return values for some modules

* Further test fixes

* securitygroup fixes after the move to _info module
5 years ago
Simon Dodsley cd24d57636 Add IOPs bandwidth support to volumes (#61577) 5 years ago
Matt Clay 4063d58339 Use relative submodule status in ansible-test.
The `git submodule status` command is relative to the current git repository by default.
When running from a repository subdirectory paths can be returned above the current directory.
Specifying the current directory with `git submodule status` avoids listing submodules above that directory.

This will fix issues when testing a collection that is rooted below the repository root when that repository uses submodules.
5 years ago
Felix Fontein 0c592c8225
CloudStack modules: rename _facts -> _info (#61090)
* Rename cloudstack _facts -> _info

* Add changelog.

* Fix errors due to overloaded get_result having different parameter names.

* Fix examples.

* Change debug tasks.

* Remove unneeded code.

* Change from rename -> deprecate+new module.

* Make cs_zone_info return a list.

* Make cs_instance_info return a list.

* Fix return value docs.

* Fix typo.

* Improve tests.

* Fix cs_zone_info.

* Linting.

* Fix alias/option switch.

* Fix version numbers.

* Extend docs.
5 years ago
René Moser 3bfeae9040 vultr: add changelog and update porting guide (#61520) 5 years ago
Matt Davis d81ae27a4a
Collection role relative deps (#61517)
* default collection support

* playbooks run from inside a registered collection will set that collection as the first item in the search order (as will all non-collection roles)
* this allows easy migration of runme.sh style playbook/role integration tests to collections without the playbooks/roles needing to know the name of their enclosing collection

* disable default collection test under Windows

* enable collection search for role dependencies

* unqualified role deps in collection-hosted roles will first search the containing collection
* if the calling role has specified a collections search list in metadata, it will be appended to the search order for unqualified role deps

* disable cycle detection unit test

* failing on 3.7+, needs proper cycle detection
* see #61527
5 years ago
James Cammarata 51b33b79c0
T woerner max concurrent (#60702)
* play, block, task: New attribute forks

With this it is possible to limit the number of concurrent task runs.
forks can now be used in play, block and task. If forks is set in different
levels in the chain, then the smallest value will be used for the task.

The attribute has been added to the Base class as a list to easily provide
all the values that have been set in the different levels of the chain.

A warning has been added because of the conflict with run_once. forks will
be ignored in this case.

The forks limitation in StrategyBase._queue_task is not used for the free
strategy.

Signed-off-by: Thomas Woerner <twoerner@redhat.com>

* Handle forks in free strategy

The forks attribute for the free strategy is handled in run in the free
StrategyModule. This is dony by counting the amount of tasks where the uuid
is the same as the current task, that should be queued next. If this amount
is bigger or equal to the forks attribute from the chain (task, block,
play), then it will be skipped to the next host. Like it is also done with
blocked_hosts.

Signed-off-by: Thomas Woerner <twoerner@redhat.com>

* Test cases for forks with linear and free strategy

With ansible_python_interpreter defined in inventory file using
ansible_playbook_python.

Signed-off-by: Thomas Woerner <twoerner@redhat.com>

* Changing forks keyword to throttle and adding some more docs
5 years ago
Matt Davis 7d1a981b61
default collection support (#61415)
* default collection support

* playbooks run from inside a registered collection will set that collection as the first item in the search order (as will all non-collection roles)
* this allows easy migration of runme.sh style playbook/role integration tests to collections without the playbooks/roles needing to know the name of their enclosing collection

* ignore bogus sanity error

* filed #61460

* fixed task unit test failure

* don't append an empty collections list to the ds

* ignore leftover local_action in mod_args ds action parsing

* fix async_extra_data test to not require ssh and bogus locale

* disable default collection test under Windows

* ensure collection location FS code is always bytes

* add changelog
5 years ago
robertchung caa5abdfc9 Fix TypeError in ec2_group.py for Python3 when sorting dictionary list (#59844)
* Fix TypeError in ec2_group.py for Python3 when sorting dictionary list

* Using json.loads() and dumps() to replace sorting

* Bug fixes for ec2_group.py

* Dictionaries cannot be compared/sorted in Python3

* Diff will occur when the IpPermissions have the same IpRanges but have different ordering

* 'before' will be sorted by 'Type' with high priority than 'IP', but 'boto3.describe_security_groups()' function cannot get 'Type' from Amazon

* Add some basic diff mode testing to exercise the rule-sorting code
5 years ago
Sam Doran 73248bf27d validate-modules - Use error codes instead of numbers (#60711) 5 years ago
Felix Fontein 59ab4d9307
oVirt: rename _facts -> _info (#61299)
* Rename oVirt _facts -> _info

* Adjust PR #.

* Forgot update BOTMETA / ignore.txt for doc fragment.

* Compatibility for 3rd-party modules using module_utils or info doc fragment.

* Update note.

* Fix/improve docs.

* Update lib/ansible/modules/cloud/ovirt/ovirt_event_info.py

Co-Authored-By: Sloane Hertel <shertel@redhat.com>

* Fix variable.

* Fix return value documentation for ovirt_external_provider_info.
5 years ago