* The chroot connection plugin crashes because its constructor calls
self.get_option(...) before the plugin loader has established its
self._load_name. Therefore, we should defer the self.get_option(...)
call so that it happens in connect().
Fixes#59063
* User now can be specify datastore cluster for deploying OVF
* Added find_resource_pool_by_cluster API
Fixes: #57849
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* The description has been replaced with proxy_password and proxy_username.
* Rename 59068-fix doc for yum_repository.py to 59068-fix_doc_for_yum_repository.yml
The Display class has no `info` attribute/method. The use of the method
was raising an Exception in task_queue_manager and displayed an
unappropriate deprecation warning.
* Add SNOW OAuth Support and Multi-record Query
* Add OAuth documentation to snow_record_find
* Fix lint and verification issue for PR 58410
* Fix E309 and E324 errors in PR 58410
* Fix E307, need advice on E309
* Fix E309 for PR 58410
* Re-add instance, username and password documentation
* Fix data type mismatch in documentation
* Remove doc_fragment overlap
* Refactor service now module space
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* Changes as per review comments and renamed file to vmware_content_library_info
* Removing password field from publish info dictionary
* Removed current password field from publish info
* Modified vmware_content_library_info module with review comments.
* Review comments. Moved test .yml files under tasks folder
* Moved test files under module name folder. Handled library_get call under try catch to throw proper error message
* Fixed precheck failure bare except. Catching Exception
* Fix reported AIX filesystem module incorrect fail_json() usage and
extend reporting on an error.
Fixes#58609
* pep8 and ansible-test fixes, as well one missed msg param
ansible-test only passes files which have the .py suffix for sanity
tests on python files. This change will allow sanity tests to run on
the Python files in hacking/
* Rename test-module to test-module.py
* Symlink test-module for backwards compat since end users may be using
test-module
* Fix test-module sanity errors that are now triggered
* Rename ansible_profile to ansible-profile.py
* Rename build-ansible
* cosmetic: Remove useless call to ec2_argument_spec()
* aws_s3: Improve ETag handling
* Extract ETag calculation into a utility function for reuse by
aws_s3_sync.
* Reduce code duplication in put/get by restructuring the logic
* Only calculate ETag when overwrite == different
* Fail gracefully when overwrite == different and MD5 isn't available
(e.g. due to FIPS-140-2).
* aws_s3: clean up integration tests
Clean up tests, add tests for overwrite settings in both directions.
* Add msg parameter to the mandatory filter
The `mandatory` filter would be more useful, particularly when dealing with nested dictionaries, with the simple addition of a `msg` parameter for supplying it with a custom failure message.
In "status: present" playbook execution for a VDO volume that is
absent, all of the parameters that are given in the playbook are
issued to the "vdo create" command, therefore any parameters that
become "unrecognized" will result in the "vdo" command returning an
error with the message "unrecognized arguments", which can then be
relayed back to the user. This is a gracefully handled failure case.
Examples of "unrecognized" parameters are new features that are not
yet in the current version of VDO, or features that were removed
since the current version of VDO.
In "status: present" playbook execution for a VDO volume that is
already present, the same behavior as the "creation" stage of the
module should occur, but doesn't occur, since the key strings for
the "vdo status" output of the parameter do not exist. This results
in a KeyError on the parameter that no longer exists.
Therefore, use "if statfield in processedvdos[desiredvdo]:" to filter
the modifiable parameters with the ones that are supported in this
VDO version, then use "if statfield not in processedvdos[desiredvdo]:"
to evade the KeyError, and add the "unsupported" parameters.
Also, instead of using the "currentvdoparams" dictionary, which
filters only the parameters reported by the "vdo status" output, use
the "modtrans" dictionary, which contains all of the possible
parameters. Therefore, if the playbook specifies an "unsupported"
parameter, let it be passed on to the "vdo" command, to display an
actionable error message.
This fixes https://github.com/ansible/ansible/issues/54556
Signed-off-by: Bryan Gurney <bgurney@redhat.com>
* 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.
* Fix Pacman regex for unmatched Arch package name
`ansible -m pacman -a upgrade=yes $(hostname)` failed due to not
accounting for the `+` character in the `pacman -Qu` output line:
libsigc++ 2.10.0-1 -> 2.10.1-1
Per the Arch wiki¹, package names can contain alphanumeric characters,
and any of {`@`, `.`, `_`, `+`, `-`}.
The existing `re` covered `_` (part of `\w` in Python), and `-`
(explicitly included). This change adds `@`, `.`, and `+` (in
ASCII-betical order).
¹: https://wiki.archlinux.org/index.php/Arch_package_guidelines#Package_naming
* Add explanation for `pacman -Qu` regex matching
* Remove unneeded non-capturing groups in regex
* 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
* win_domain_user - MAke the query user try catch block more accurate for missing identity
* change to minor_changes
* Update win_domain_user-make-query-try-catch-accurate.yml
* Update win_domain_user-make-query-try-catch-accurate.yml
* Remove redundant line in os_port
The renaming of the key 'vnic_type' to 'binding:vnic_type'
is reduced to a single line.
The old key is removed to avoid to possibility of
inconsistency.
* Add missing parameter in example of os_port
In the example "Create port of type 'direct'" the parameter
"network" is added, because this parameter is required on
creating new ports.
* Correct get_option function name and change flags to become_flags
* Remove the '--' from the returned command
* add changelog fragment
* change changelog fragment description
* move the -q argument to machinectl before the shell argument to resolve issues with machinectl v230 (see #56571)
Warn user about dvswitch permissions since permissions for
a distributed switch must be defined and managed on either
the datacenter or a folder containing the switch.
Fixes: #55248
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* 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
os_quota checks the current quotas for compute, network and volume
services and fails when no volume service is found in the catalog.
Since openstack test deployments without volume services are common,
os_quota shouldn't fail if such service is missing.
This was originally fixed in d31a09ceb7
and later adapted to catch exceptions raised by shade. Since then, this
module moved to using openstacksdk, which doesn't catch the exception
raised by keystoneauth1.
Fixes#41240
* cloud/packet: remove bogus mutual exclusions
operating_system is a required parameter, for custom ipxe it should be
set to custom_ipxe. The always_pxe and ipxe_script_url parameters are
only valid when operating_system==custom_ipxe, but they are not mutually
exclusive.
* cloud/packet: disallow custom_ipxe settings for supported oses.
* 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
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
* 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
* host event log init
* show more events
* add time check
* correct pep8 syntax
* use event id as first elem
* init start event in constr
* update pep8 syntax
* remove precreate
Since bricks_in_volume is a list, it can't be compared to a int.
Traceback (most recent call last):
File \"/root/.ansible/tmp/ansible-tmp-1561989216.06-31322871319024/AnsiballZ_gluster_volume.py\", line 114, in <module>
_ansiballz_main()
File \"/root/.ansible/tmp/ansible-tmp-1561989216.06-31322871319024/AnsiballZ_gluster_volume.py\", line 106, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File \"/root/.ansible/tmp/ansible-tmp-1561989216.06-31322871319024/AnsiballZ_gluster_volume.py\", line 49, in invoke_module
imp.load_module('__main__', mod, module, MOD_DESC)
File \"/usr/lib64/python3.7/imp.py\", line 234, in load_module
return load_source(name, filename, file)
File \"/usr/lib64/python3.7/imp.py\", line 169, in load_source
module = _exec(spec, sys.modules[name])
File \"<frozen importlib._bootstrap>\", line 630, in _exec
File \"<frozen importlib._bootstrap_external>\", line 728, in exec_module
File \"<frozen importlib._bootstrap>\", line 219, in _call_with_frames_removed
File \"/tmp/ansible_gluster_volume_payload_d5mfag24/__main__.py\", line 610, in <module>
File \"/tmp/ansible_gluster_volume_payload_d5mfag24/__main__.py\", line 551, in main
TypeError: '<' not supported between instances of 'int' and 'list'
* 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>
In rabbitmq_binding.py the SSL parameters ca_cert, client_cert, client_key were only passed to requests for post requests.
This change updates the DELETE and GET requests to include these parameters as well.
* Add network resource modules utils function
* `FactsBase` parent class to handle
facts gathering
* `ConfigBase` parent class for resource
module config handling
* utils funtions for resource modules
* Fix review comments
* Fix CI issues and review comments
* Fix review comments
* Fix CI issues and minor updates
* 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
* Update the regular expression to match the more accurate
* Update the regular expression to match the more accurate
* Update the regular expression to match the more accurate
* add a util function to ce.
* add a util function to ce.
* update to fix bugs for ce_static_route
* update to fix bugs for ce_static_route
* update to fix bugs for ce_static_route
* update
* update for shippable.
* New & fixed examples for aws_ssm lookup
* Apply suggestions from code review
Co-Authored-By: Sloane Hertel <shertel@redhat.com>
* Clarify example name
* 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
* 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
* Encoding fixes to support py2 and py3 non-ascii paths
* Remove unused import
* endswith instead of comparing slice on bytes
* join bytes, convert to to_native after
Co-Authored-By: Toshio Kuratomi <a.badger@gmail.com>
* Fix review comments
* Add missing comma
* Encoding fixes to support py2 and py3 non-ascii paths
* Use ascii encoding on paths added to the archive also
* datadog_monitor: Fix docs with datatypes of params
Fixes: #58342
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* indentation and other minor fixes
* ncclient uses same timeout value at the time
of connection initialisation and waiting response
* Ansible has connect_timeout to control the waiting
time during initial connection and `command_timeout`
to control the wait time for resposne. Hence set the
ncclient timeout seperately to Ansible command_timeout
after the connection object is created sucessfully.
* Update documentation for aci_interface_policy_cdp
##### SUMMARY
Documentation only changes. Improved the examples and changed the `version_added` from 2.8 to 2.9.
* Update lib/ansible/modules/network/aci/aci_interface_policy_cdp.py
Co-Authored-By: Sandra McCann <samccann@redhat.com>
* Converted from mixed indentation to spaces
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
When provided with a wrong password `rabbitmqctl
authenticate_user` returns a non-zero exit code
(65). This seems to be unexpected by the module and
it fails when `update_password` is set to 'always'.
To mitigate this behavior we augment the `_exec`
method by adding a `check_rc` flag (which defaults
to `True`, hence it's backward-compatible) and
override it when we need it (in `check_password`
method to address #56164).
* 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'))
* 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
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