* Use `compile` before `eval` in collection loader.
This fixes two issues:
1. File names are available when tracing execution, such as with code coverage.
2. Future statements are not inherited from the collection loader.
* Add unit tests for collection loading.
These tests verify several things:
1. That unit tests can import code from collections when the collection loader is installed.
2. That tracing reports the correct file and line numbers (to support code coverage).
3. That collection code does not inherit __future__ statements from the collection loader.
* Update unit test handling of the collection loader.
Since the collection loader is installed simply by importing ansible.plugins.loader,
we may already have a collection loader installed when the test runs. This occurs if
any other tests are collected which use that import during collection. Until that code
is moved into an initialization function to avoid loading during import, the unit tests
will need to replace any existing collection loaders so that they reflect the desired
configuration.
* Insert into sys.modules before calling exec.
This is a requirement of PEP 302.
It will prevent recursion errors when importing the current module or using a relative import.
* Use the correct value for __package__ in modules.
This allows using relative imports in collections.
* Add warning about modifying code for trace test.
* Add test for relative import in collection.
* Add __init__.py to collection to satisfy pylint.
The relative-beyond-top-level rule in pylint may not be appropriate for collections.
However, until that rule is disabled for collections this will keep tests passing.
* ansible-galaxy: add collection init sub command
* Fix changelog and other sanity issues
* Slim down skeleton structure, fix encoding issue on template
* Fix doc generation code to include sub commands
* Added build step
* Tidy up the build action
* Fixed up doc changes and slight testing tweaks
* Re-organise tests to use pytest
* Added publish step and fixed up issues after working with Galaxy
* Unit test improvments
* Fix unit test on 3.5
* Add remaining build tests
* Test fixes, make the integration tests clearer to debug on failures
* Removed unicode name tests until I've got further clarification
* Added publish unit tests
* Change expected length value
* Added collection install steps, tests forthcoming
* Added unit tests for collection install entrypoint
* Added some more tests for collection install
* follow proper encoding rules and added more tests
* Add remaining tests
* tidied up tests and code based on review
* exclude pre-release versions from galaxy API
* Add apply to k8s module
Use apply method for updating k8s resources.
* Improve apply documentation
* k8s: Make apply and merge_type mutually exclusive
* Handles:
PSAvoidTrailingWhitespace
PSAvoidGlobalVars
PSAvoidAssignmentToAutomaticVariable
PSAvoidUsingCmdletAliases
PSAvoidUsingWriteHost
PSUseDeclaredVarsMoreThanAssignments
PSUsePSCredentialType
PSAvoidUsingPositionalParameters
PSAvoidUsingEmptyCatchBlock
PSAvoidUsingWMICmdlet
Replaced Write-Host with Write-Output
Added smart reboot check for win_domain feature installation
Modify the Creation of the pagefileto fit to CIM
Changelog fragment addition
Ignore.txt without fixes
* Changes after community reviews
* Change Out-Null to '> $null'
* Fixes after jborean93 comments
* Test
* Revert "Test"
This reverts commit 35c5c0648fa9d2868a18094d84954e53ffa28880.
* Removed all > $null since they broke the module since the output got dumped
* run test again
* Revert "run test again"
This reverts commit 80eaf07143f9d8cb0116cbbc68a6a69c0ace840c.
* Changes after community review
* ignore PSUseDeclaredVarsMoreThanAssignments that are on a diffrent PR
* CI failed on extra line in ignore.txt
* Review changes
* PSlint errors
* Trail space
* send to null breaks the tests for Set-Workgroup
* Lint stuff
* win_domain_user issue of indent.
* Update win_domain_user.ps1
* Update win_domain_membership.ps1
* Fix redirect to null
* lint space issue
* removed return from set-workgroup
* removed send to null
* Add purge_tags to s3_bucket to allow preservation of existing tags
Adding `purge_tags` with default `True` to maintain existing behaviour
allows users to set it to `False` to preserve existing tags
Fixes#29366
* s3_bucket: Add further tests and improve tag handling further
Additional tests for purge_tags: False suggested some incorrect
logic and thus further improvements
Increase wait timeout on bucket deletion as it wasn't always completing
in the default 100 seconds
* The DRS rule will be updated if any changes in the configuration without deleting the existing rule.
The rule itself is updated by the given configuration.
* Lint errors fixed
* VMware: update vmware_vm_vm_drs_rule testcases
* correct argument name
* added documentation
* adding missing version_added to doc
* correcting description in docs
* change type to list
* add tests
* correct test file
* Update testing policies to ensure all required permissions are present
* Tidy up security policies to reduce duplicate permissions
* Make roles static so that they can be present before CI is run,
meaning that role creation permission is not required by the CI
itself, only by someone setting up the roles prior to testing
* Move contents to cloudfront policy to network policy to ensure policy
count (maximum of 10) stays low
* Maintain compute policy below 6144 bytes
- use include_vars to set appropriate packages and pip packages per distribution and version
- install an older version of Docker CE on RHEL 8 since a dependency is unavailable
- disable warnings on tasks that are ok
- skip tests for CentOS/RHEL 6
- use single include_vars task rather than multiple set_fact tasks
- use multi-line YAML to break up long conditionals
- use version() test rather than direct comparisions
- use different appstream package on RHEL since '@swig:3.0/default' is not working in the GA
* junos_facts refactor to work with resources modules
* Refactor junos_facts module to work with
network resource module.
* Fix unit test failures
* Fix review comments
Otherwise lingering terminated instances may be in the result
Use the instance profile arn or the role name, but not the role arn
Mark tests as unstable
Not waiting outputs results in a format that will never
be matched by the tests
Ensure instances get tidied up
Allow ec2:ReportInstanceStatus
ec2_instance: Improve test cleanup on failing tests
Improve describe/modify attribute error handling
Address feedback on PR
Also moved environment setup and environment cleanup to separate task
files
Added CI group
Updated c4.large instances to t3.nano, use ENA enabled AMI
Updated AMIs with Amazon Linux AMI
Updated us-east-1 AMI id
Specify EBS size
typo, volume_size
Removed 'state: running', updated AMI with amz ami
Also added several wait: false to speed things up
Check for instance state, correctly
Accept pending as valid state
tags_and_vpc_settings do not wait for instance to complete
wait for termination protected instance
Updated IAM role name to match with policy
Skip env cleanup when in CI
Do not wait instance in external_resource_attach
ENI remove is done in env_cleanup/CI
wait some time for instance_profile instnace to be up
Updated ebs_optimized_images
Corrected task name
Added aws_cleanup var in cloud-config-aws
typo in runme
default aws_cleanup to true
* postgresql_ext: add version new option
* postgresql_ext: add version new option, fix ssl tests
* postgresql_ext: add version new option, fix tests
* postgresql_ext: add version new option, fix examples
* postgresql_ext: add version new option, fix the doc
* postgresql_ext: add version new option, fix examples
* postgresql_ext: add version new option, fix typo in tests
* consul_session: Python 2.6 is always required on managed node
* consul_session: document all types
* consul_session: add doc for 'id' parameter
* consul_session: improve parameter descriptions
- use formatting functions in descriptions
- 'name' parameter is required when state=node
* consul_session: use required_if
* consul_session: add integration tests
* consul_session: use 'retry' with network dependent tasks
* Use ansible-ci-files bucket for consul binaries
Co-Authored-By: Matt Clay <matt@mystile.com>
* Get the most detailed version number from distro.version() for CentOS and Debian
* Update tests and fixtures
* Update fixture generation script to gather distro info and work with Python 3
* Update LinuxMint fixtures
* Cleanup fixture formatting
* Improvements based on feedback from abadger:
- use unicode since that is what distro returns
- use frozenset with a tuple
- include link Debian to bug
* Skip gitlab tests if dependencies aren't met
* Skip certain unittests if passlib is not installed
* Fix tests with deps on paramiko to skip if paramiko is not installed
* Use pytest to skip for cloudstack
If either on Python-2.6 or the cs library is not installed we cannot run
this test so skip it
Set default value for the following optional parameters:
- vcenter_port
- vmware_proxy_host
- vmware_proxy_port
This way we won't get an error if they are not define in the
configuration file.
* Fix onepassword lookup plugin crashing on fields with no 'name' or 't' property.
* Fix onepassword_facts module crashing on fields with no 'name' or 't' property.
* Add unit test for onepassword lookup plugin failing on entries without a name.
* Add changelog fragment for onepassword lookup plugin and onepassword_facts module fixes on fields without a name.
* nxos_vpc: pkl_vrf fixes for #57069Fixes#57069
- Symptom: When playbooks specify `pkl_vrf: default`, the result is that the cli does not set the `vrf` state.
- Analysis:
- First issue: 'default' is a reserved word when used with the `peer-keepalive` `vrf` keyword. It refers to the default rib.
- This is confusing in several ways because `peer-keepalive`'s *default* vrf is the `management` vrf.
- Second issue: When changing only one optional value (`pkl_vrf`) while other optional values are idempotent (`pkl_src`), the result is that the idempotent values are ignored; unfortunately the device cli *replaces* the entire command, in which case the idempotent values are removed.
- e.g. playbook specifies this:
```
{ pkl_dest: 10.1.1.1, pkl_src: 10.2.2.2, pkl_vrf: my_vrf }
```
```
peer-keepalive dest 10.1.1.1 src 10.2.2.2 # original
peer-keepalive dest 10.1.1.1 src 10.2.2.2 vrf my_vrf # intended result
peer-keepalive dest 10.1.1.1 vrf my_vrf # actual result
```
- Third issue: the `pkl` getter was relying on positional data. This broke when the `udp` keyword nvgen'd where `vrf` used to appear (shifting all keywords to the right).
- Tested on regression platforms: `N3K,N6k,N7K,N9K,N3K-F,N9K-F`
* PEP fixes
* PEP fix 2
* pkl should merge by default, not override
* rmv debugs
* add mike's tests
* fix comments
* Fix notifying handlers by using an exact match rather than a string subset if listen is text rather than a list
* Enforce better type checking for listeners
* Share code for validating handler listeners
* Add test for handlers without names
* Add test for templating in handlers
* Add test for include_role
* Add a couple notes about 'listen' for handlers
* changelog
* Add a test for handlers without names
* Test templating in handlers
* changelog
* Add some tests for include_role
* Add a couple notes about 'listen' for handlers
* make more sense
* move local function into a class method
* Lookup secret id by name if not set
* Lookup config id by name if not set
* Add changelog fragment
* Remove usage of secret/config_id in examples
* Python 2.6 compat
* Extend secrets and configs tests
Targets are always expanded to full lists now instead of optimizing
for shorter lists by collapsing directories.
This change only affects unit tests and the ansible-doc sanity test,
as they were the only remaining tests using the old behavior.
* new module uses modern ansible AWS standards
* adds additional tests for snapshots
* Update return_skeleton_generator for python3 - should
set type to `str`, not `string`.
Module tracebacks may be reported on stdout instead of stderr when
using some connection plugins. For example, the ssh connection plugin
will report tracebacks on stdout due to use of the -tt option.
This change results in tracebacks being recognized on both stdout
and stderr, instead of the previous behavior of just stderr.
ci_complete
- don't background the nuage-vsd-sim
- increase the asncy timeout
- use uri to actually query the simulator API to make sure it is ready for connections
* datadog_monitor: Fix docs with datatypes of params
Fixes: #58342
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* indentation and other minor fixes
openvswitch_db was not parsing properly some arguments, which caused
some commands to be executed when they shouldn't. This commit fixesit
and adds unit testing for the usecase.
Closes-Bug: #55432
Closes-bug: #43858
* tower_role: ensure alias of validate_certs is handled
* tower modules: remove tower_verify_ssl alias too
Error was:
Failed to update role: The Tower server claims it was sent a bad request.
GET https://tower/api/v2/projects/22/object_roles/
Params: [('tower_verify_ssl', False), ('role_field', 'admin_role')]
Data: None
Response: {"detail": "Role has no field named 'tower_verify_ssl'"}
Full traceback:
File "/tmp/ansible_tower_role_payload_7_2p0X/__main__.py", line 145, in main
result = role.grant(**params)
File "/usr/local/lib/python2.7/dist-packages/tower_cli/resources/role.py", line 365, in grant
return self.role_write(fail_on_found=fail_on_found, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/tower_cli/resources/role.py", line 242, in role_write
fail_on_multiple_results=True, **data)
File "/usr/local/lib/python2.7/dist-packages/tower_cli/models/base.py", line 301, in read
r = client.get(url, params=params)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 546, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/tower_cli/api.py", line 299, in request
kwargs.get('data', None), r.content.decode('utf8'))
* Fix service integration test.
Set the proper file mode when copying before asserting the mode is correct.
* Fix certificate_complete_chain test.
Do not assume that testhost is the same as localhost.
* Fix nested template test.
There were two issues with the previous implementation:
1. The LOGNAME environment variable may not be set.
2. The comparison assumed that testhost is localhost.
* Fix variable display for cartesian lookup test.
* Fix vars list test.
The test assumed that the ansible_user variable is always set,
which is not guaranteed when using connections other than local.
* Fix supervisorctl integration test.
Use ansible_user_id instead of ansible_user since ansible_user
is not guaranteed to be available when the connection is not local.
* Fix file integration test.
Use ansible_user_id instead of ansible_user since ansible_user
is not guaranteed to be available when the connection is not local.
* Fix expect integration test.
Do not assume module_utils is available for utility scripts.
* Fix python_requirements_info integration test.
Check for pip instead of ansible, since ansible is not guaranteed
to be installed when using a connection other than local.
* Fix ansible-runner integration test.
Use implicit localhost to run the test since it requires access
to the ansible installation currently being tested.
* Fix tower_common integration test.
Accept errors on stdout or stderr.
* Fix tower_user integration test.
Recognize errors on stdout or stderr.
* win_pagefile - Fix idempotency when same settings as current
* Fix tests and code
* Fix problem with system managed
* Fix again systemmanaged detection
* Change check of systemmanged in creation
* Fix readability and wrong flag for test
* Add back _contains_vars method as maybe_template. Fixes#58282
* Remove template guard in a few places
* maybe_template sounds like it might template something, rename to is_possibly_template
* Add tests for is_possibly_template
* Update testing policy to be correct for RDS test suite
* Create read replica in same region to avoid more permissions being
required
* Ensure modifying DB doesn't try to downgrade engine version
* Add tags to main test suite to limit number of tests run for problem
solving
Fixes: #22034
This patch adds support for a tls_version parameter that allows the
TLS version used to be configurable. By default the module will let
the underlying system libraries pick the maximum supported version.
This parameter is useful for servers that are unable to support
newer versions of TLS
* Add tests for KubeAPIVersion
* Legibility improvements for KubevirtVM tests
* Create units.utils.kubevirt with common stuff
* Add some VMIRS unit tests
* openssh_keypair: bugfix make regenerating keypairs via force possible / add invalid file handling
* openssh_keypair: change permissions of read-only file instead of deleting it for regeneration; add changelog fragment
* address review feedbak, refactor
* add integration tests for bigfixes
* linter: fix indent
* fixup integration tests: use force when regenerating an invalid file
* linter: fix indent
* openssh_keypair: address review feedback
* openssh_keypair: fixup, remove backtick
* openssh_keypair: address review feedback
* Only pass 'y' into stdin of ssh-keygen when file exists.
* Allow multiple databases(not all) to be dumped from mysql
Fixes: #56059
* Altered fail message to provide atleast one database name
* Minor grammatical fix
* Fix failing SAN comparison for older cryptography versions due to not implemented __hashh__ functions.
* Fix SAN comparison: IPv6 addresses need to be normalized before comparing strings.
* Add changelog.
* Fix comment.
* Improve error for docker modules when docker-py can't be imported.
* Add changelog.
* Mention platform and Python interpreter in more cases.
* Clarify wording.
* Adjust tests.
Add a new file to record the variables that are shared with the two
scenarios (real_lab and vcsim).
The goal is to reduce the the amount of boilerplate configuration from
a user perspective.
* Improve type information in module documentation
- Removed some duplicate documentation
- Ensure org_id is always string
- Add type information for items which don't have it
* Fix whitespace
* Use different package for DNF tests
Ninja caused errors in Fedora 30. This works in both Fedora 29 and 30.
* Fix git integration tests
Git >= 2.21.0 has either a bug or change in behavior where it errors when fetching a
repository containing submodules that are behind the upstream submodule commits.
It's weird and I don't fully understand it.
Get around this my checking out specific commits from a repository rather than
switch the origin URL.
* Fix PostgreSQL tests
The error message is slightly different
* nxos_bgp_neighbor: Add bfd support
- Add support for bfd state in nxos_bgp_neighbor
- Feature Pull Request
- nxos_bgp_neighbor
- Tested on platforms: `N3K,N6K,N7K,N9K`
* bfd T/F now bfd enable/disable
* pep fix ws
* add IAM role assumption to aws_ec2 inventory
* Ensure inventory._options has necessary option keys populated since the plugin docs parser isn't accessible to unit tests yet
* Remove lexers which have been fixed in Pygments 2.4.0.
* Add Pygments >= 2.4.0 to test runner.
* Fix pages that triggered lexer errors.
Co-Authored-By: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
We can switch to wait_for / meta, as using pause can lead to race
conditions on slower / faster hardware.
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
* Combine testing policies
Because of the maximum of 10 policies per group, need to
consolidate testing policies as best we can.
* Tidy put-account-setting tasks and add permission
Using `environment` and `command` rather than `shell` avoids the
need for `no_log` and means that people can fix the problem
* refactor ecs_cluster test suite
move from runme.sh technique to virtualenv
use ec2_instance rather than ec2 module to
avoid need for boto
* Ignore `<rpc-reply>` node from candidate and
running configuration in xml diff
* Add route-policy as prerequisite to BGP coonfiguration
in integration test
* Change RHEL8 image name to match changes in ansible-test
Continue to use the beta version of RHEL 8 until we fix tests that are breaking with the GA version.
* Skip ufw integration test on RHEL 8 Beta
* Initial proposal for new parameter option for response format
- output_version parameter dictates the response key case
- new is snake_case, old is camelCase
- If new, conversion is done at the end of module execution
- This is purely a proposal and not a final draft
* Add support for ANSIBLE_MERAKI_FORMAT env var
- If env var is set to 'camelcase' it will output camelcase
- Otherwise, will default to snakecase
- Added note to documentation fragment
- As of now, all module documentation needs to be updated
* Fix pep8 errors and remove output_version args
* Restructure check in exit_json so it actually works
* Add changelog fragment
* Change output_format to a parameter with env var fallback
- ANSIBLE_MERAKI_FORMAT is the valid env var
- Added documentation
* Convert to camel_dict_to_snake_dict() which is from Ansible
- Fixed integration tests
* Fix yaml lint error
* exit_json camel_case conversion handles no data
- exit_json would fail if data wasn't provided
- Updated 3 integration tests for new naming convention
* convert_camel_to_snake() handles lists and dicts
- The native Ansible method doesn't handle first level lists
- convert_camel_to_snake() acts simply as a wrapper for the method
- There maybe a situation where nested lists are a problem, must test
- Fixed integration tests in some modules
* A few integration test fixes
* Convert response documentation to snake case
* Updated testcase
* Added check mode support
* Added check for mutual exclusive for Name and UUID
Fixes: #57580
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* Improve change reporting for meraki_ssid
- Documentation is more clear about dependencies
- Not all change reports are accurate without new algorithm
- Improved integration tests
* Rename changelog fragment
* Enable all tests in integration tests
- Fix type merging
* Add more integration tests for code coverage
* Update URL creation
* Add support for check mode
* Add diff support
- diff support is based on "have" and "want" data structures.
- Review needs to be done on the diffs for accuracy and usefulness.
- Changed change mode changed responses to be accurate.
* Remove config template based integration tests
* Remove usage of global var log_path
* Add changelog and edit ignore.txt
* win_pagefile: not using testPath
* Revert "win_pagefile: not using testPath"
This reverts commit c8bc10234048257414454905e1c860a8f57a3b3f.
* PSLint error
* Update win_domain_membership.ps1
* Update win_domain_controller.ps1
Set ansible_buffer_read_timeout to be larger then
ansible_command_timeout, as both appliance / controller are on the same
physical network and we are not triggering ansible_command_timeout.
Signed-off-by: Paul Belanger <pabelanger@redhat.com>