* get_url should accept headers as a dict, instead of only a complicated string
* update headers description text
* Add headers string and dict tests for get_url
* Add intg test for string header format parsing error
* Adjust deprecation version ahead 1 release, add the version dict format was added in to description
* Handle duplicate headers, and make it easier for users to use cookies, by providing a pre-built string
* Ensure proper cookie ordering, make key plural
* Add note about cookie sort order
* Add tests for duplicate headers and cookies_string
* Extend tests, normalize headers between py2 and py3
* Add some notes in test code
* Don't use AttributeError, use six.PY3. Use better names.
* Error if a module is found to shadow a reserved keyword
* Add test for shadowed module
* Bring in functools.wraps for the decorator
* Drop the decorator, make _find_plugin the real function, find_plugin now holds the shadow logic
* Swap order of functions for bottom to top execution order
* Only error for modules
* Add test for loading a lookup plugin that shadows a keyword
Currently, when ones run the module in check_mode it tries to retrieve
values from the actual certificate generated in the generate() function.
Since in check_mode we call dump() without calling generate(), self.cert
is None, leading to self.cert.get_notBefore(), self.cert.get_notAfter()
and self.cert.get_serial_number() raising an error.
> NoneType' object has no attribute 'get_notBefore'
The solution is to have two way to handle dump() method, whether its run
in check_mode=True or check_mode=False leading to different way the
information is retrieved.
* Required changes to support redirects on HTTP 307/308
This ensures HTTP 307 and 308 will redirect the request to the new
location without modification.
* Fix the unused newheaders reference
* Be more compliant
* Add integration tests for follow_redirects=all
* Improve other tests for new behaviour
* Make follow_redirects values more strict
* added eos_smoke tests
* removed left over file
* added note to uncomment broken eapi test when #36919 is fixed
* uncommented fixed test, added unbecome test
* skip become tests when connection=local
* Added module win_pester and relatives integration tests
* Corrected issues as stated by ansible-test
* Added defaults variable in integration tests
* Added task to install Pester if needed in the integration test
* Corrected error in win_psmodule task
* Added Pester installation with Chocolatey when Powershell version < 5
* Get facts...
* Disabled invoke-pester output
* Added pester_result type
* Added jhawkesworth changes proposal
* Corrected documentation linting
* Corrected linting
* Added dagwieers recommendations
* Added dagwieers recommendations
* Corrected linting errors and task error in integration test
* Corrected error in integration test
* Added dagwieers recommendations
* Corrected requirements in the DOCUMENTATION block
* tolerate windows line endings when loading windows module utils. Helpful for old custom windows modules.
* add test modules to demonstrate win line ending module load behaviour.
* attempt to fix sanity check failures
* pep8 fix
* explict skip of test modules from shebang check (core modules must still have expected unix style line endings)
* switch to rstrip() following core team meeting feedback
* Add aws_ses_identity_policy module for managing SES sending policies
* Add option to AnsibleAWSModule for applying a retry decorator to all calls.
* Add per-callsite opt in to retry behaviours in AnsibleAWSModule
* Update aws_ses_identity_policy module to opt in to retries at all callsites.
* Add test for aws_ses_identity_policy module with inline policy.
* Remove implicit retrys on boto resources since they're not working yet.
* Mark UCS integration tests as unsupported.
* Mark various connection tests as unsupported.
* Mark win_domain_group test as unsupported.
* Mark java_cert test as unsupported.
* Mark synchronize-buildah test as unsupported.
* Mark various AWS tests as unsupported.
* Mark azure_rm_acs test as unsupported.
* Mark GCP tests as unsupported.
* stabilize ec2_vpc_subnet module
* Add waiters for ec2_vpc_subnet
Clean up integration tests
* Reenable CI for stabilized ec2_vpc_subnet tests
* rename waiters
* Use module_json_aws where applicable
Handle WaiterError first if waiting failed
* Fix traceback when tagging with keys/values that look like booleans
* Fix check mode with tags
* Add integration tests for tags that look like booleans and check mode
* Add waiter for deleting subnet
* Sleep a few seconds after using aws command line
* Use AnsibleAWSModule to simplify AWS connection
* Add Exception handling, pagination, retries and backoff
* Allow events to be switched off
* Allow details to be obtained without having to specify services
This is required if we want to ensure that #36809 doesn't cause any
important behavioral changes.
This PR changes the uri module to support follow_redirects=urllib2
It also adds a better error message when the connection closes before
any data was returned.
* Fix apt tests
* Enable the test in CI
* Additional fixes not discovered locally
* Don't break mysql tests and fix for 14.04 upgrade
* Remove not needed when cond
* Add shebang to fix-udev script
* Remove workaround in favor of rebuilding containers
* Remove leftover script
SGs created when a VPC ID was not specified would not necessarily
get the default egress rule, even when no explicit egress rules
were set.
Add some checks for egress rules in results from existing tests
* Fix 'New Vault password' on vault 'edit'
ffe0ddea96 introduce a
change on 'ansible-vault edit' that tried to check
for --encrypt-vault-id in that mode. But '--encrypt-vault-id'
is not intended for 'edit' since the 'edit' should always
reuse the vault secret that was used to decrypt the text.
Change cli to not check for --encrypt-vault-id on 'edit'.
VaultLib.decrypt_and_get_vault_id() was change to return
the vault secret used to decrypt (in addition to vault_id
and the plaintext).
VaultEditor.edit_file() will now use 'vault_secret_used'
as returned from decrypt_and_get_vault_id() so that
an edited file always gets reencrypted with the same
secret, regardless of any vault id configuration or
cli options.
Fixes#35834
Fixes#37208
If check_mode is enabled instead of committing th config need to
discard all the chnages to cnadidate db
In case of cli to discard changes issue `rollback 0` command
and for netconf execute `discard-changes` rpc call
* Add tests using a variable in tasks_from field
Related to #32503
* Do not test using hostvars with import_role
hostvars cannot be used with import_role — use include_role instead
* template: Add integration tests for `lstrip_blocks'
Signed-off-by: Alex Tsitsimpis <alextsi@arrikto.com>
* template: Fix passing `trim_blocks' inline
Fix passing `trim_blocks' option to the template module as inline
argument. Previously passing the `trim_blocks' option inline instead of
using the YAML dictionary format resulted in it always being set to
`True', even if `trim_blocks=False' was used.
Signed-off-by: Alex Tsitsimpis <alextsi@arrikto.com>
* template: Add option to `lstrip_blocks'
Add option to set `lstrip_blocks' when using the template module to
render Jinja templates. The Jinja documentation suggests that
`trim_blocks' and `lstrip_blocks' is a great combination and the
template module already provides an option for `trim_blocks'.
Note that although `trim_blocks' in Ansible is enabled by default since
version 2.4, in order to avoid breaking things keep `lstrip_blocks'
disabled by default. Maybe in a future version it could be enabled by
default.
This seems to address issue #10725 in a more appropriate way than the
suggested.
Signed-off-by: Alex Tsitsimpis <alextsi@arrikto.com>
* template: Add integration tests for `trim_blocks'
Signed-off-by: Alex Tsitsimpis <alextsi@arrikto.com>
* template: Check Jinja2 support for `lstrip_blocks'
Since the `lstrip_blocks' option was added in Jinja2 version 2.7, raise
an exception when `lstrip_blocks' is set but Jinja2 does not support it.
Check support for `lstrip_blocks' option by checking `jinja2.defaults'
for `LSTRIP_BLOCKS' and do not use `jinja2.__version__' because the
latter is set to `unknown' in some cases, perhaps due to bug in
`pkg_resources' in Python 2.6.6.
Also update option description to state that Jinja2 version >=2.7 is
required.
Signed-off-by: Alex Tsitsimpis <alextsi@arrikto.com>
* Fix loading of filter and test plugins
Filter and test plugins are different than other plugins in that they
can have many plugins in a single file. Therefore they need to operate
a little differently. They need to have all of the potential files
returned. Then the caller takes care of passing those onto jinja2 in
order for jinja2 to make use of them.
This problem was (most recently) introduced with f921369445
This commit also restructures how we deduplicate plugins to take paths
into account. If we want to start scoping which set of modules are
loaded (due to roles, for instance) we'll need to hang on to the path
information.
* add integration test for override
* Fix style checks for bcoca code
* Implement jinja2 plugin loader as a subclass
Having a subclass allows us to customize the overriding of jinja
plugins. We can then move common parts of common code into the Loader.
* [cloud] ec2_vpc_route_table: ignore routes without DestinationCidrBlock
Add module warnings rather than silently skipping
* Permit warnings for routes tables containing vpc endpoints to be turned off
* Add tests to ensure a VPC endpoint associated with a route table does not result in a traceback
* adding possibility to specify resource group for referred virtual network
* fixed sanity issues
* removed trailing whitespace
* added test
* fixed documentation
* try to fix unstable test
* Tidied up the description of virtual_network_resource_group
* adding possibility of disabling public ip address
* fixed indent
* fixed whitespace
* fixed mistake
* try to create test with vm without public ip address
* try to fix test
* another attempt for test
* fixing test
* create vm with no ip with different name and delete it immediately
* a few additional fixes
* another attempt to pass test
* must be deleted
* simplified no ip test
* reorganised tests
* Wrapped choice in C()
* fixed issue when public ip address should not be created
* adding test for public ip address
* fixed samples
* another fix to sample formatting
* fixed test
* fix test
* fixed test
* another attempt to fix test
* maybe it works now
* still wrong
* improved check per customer request
* removed stupid semicolon
* updated test to match main scenario
* changed ip configurations to list
* another attempt
* add additional test coverage for tower modules
* add test coverage for the tower_credential module
* add test coverage for the tower_user module
* fix a bug in py3 for tower_credential when ssh_key_data is specified
* add test coverage for tower_host, tower_label, and tower_project
* add test coverage for tower_inventory and tower_job_template
* add more test coverage for tower modules
- tower_job_launch
- tower_job_list
- tower_job_wait
- tower_job_cancel
* add a check mode/version assertion for tower module integration tests
* add test coverage for the tower_role module
* add test coverage for the tower_group module
* add more integration test edge cases for various tower modules
* give the job_wait module more time before failing
* randomize passwords in the tower_user and tower_group tests
* Check that connection error msg are not unsafe
* Connection error messages are unsafe: wrap them
For example, in case of error, docker connection plugin returns exception
message containing Go template. These messages weren't tagged as unsafe
and were consequently rendered:
The conditional check 'result is failed' failed. The error was:
{
'msg': u'Docker version check ([\'/usr/bin/docker\', \'version\', \'--format\', "\'{{.Server.Version}}\'"]) failed: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.35/version: dial unix /var/run/docker.sock: connect: permission denied\n',
'failed': True
}:
template error while templating string: unexpected '.'.
String: Docker version check (['/usr/bin/docker', 'version', '--format', "'{{.Server.Version}}'"]) failed: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.35/version: dial unix /var/run/docker.sock: connect: permission denied
* eos can not check config without config session support
* add testcase for check_mode without config session
* fix eos eapi to read use_session env var
Fixes#36979
If `abort` is not issued in the top level session prompt
the existing session goes to pending state.
The fix is to come out of config mode by issuing `end` command
and again to same config session and execute `abort` which
`abort` is issued at the top level session prompt.
Fixes#35993 - Changes to update_size in commit eb4cc31 made it so
the group dict passed into update_size was not modified. As a result,
the 'replace' call does not see an updated min_size like it previously
did and doesn't pause to wait for any new instances to spin up. Instead,
it moves straight into terminating old instances. Fix is to add batch_size
to min_size when calling wait_for_new_inst.
Fixes#28087 - Make replace_all_instances and replace_instances behave
exactly the same by setting replace_instances = current list of instances
when replace_all_instances used. Root cause of issue was that without lc_check
terminate_batch will terminate all instances passed to it and after updating
the asg size we were querying the asg again for the list of instances - so terminate batch
saw the list including new ones just spun up.
When creating new asg with replace_all_instances: yes and lc_check: false
the instances that are initially created are then subsequently replaced.
This change makes it so replace only occurs if the asg already existed.
Add integration tests for #28087 and #35993.
* Remove default admin_distance and fix the idempotence thereof
Fixes#33290
* Fix tests and use yaml anchors to shorten tests
* Add test for undefined admin_distance
* Read config from `show run` if `show ip static route` fails
* Restore flags to ios.get_config & use get_config where appropriate
* win_lineinfile: fix#33858. Removed conversion from \r\n
* win_lineinfile: added test for #33858
* win_lineinfile: added documentation and more tests for change
* win_lineinfile: fixed wrong hash in testing
This fix adds datastore cluster details about datastore in returning
facts. Updated documentation and tests.
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* Decouple config and state check in {network_os }_vlan and { network_os }_vrf modules
Fixes#35567Fixes#34754
`interfaces` option is used for configuration as well as operational state
check. If interface is configured to given vlan or vrf but if
operational state of interface is disabled it results in module failure.
Fix is to decouple same option usage for config and state.
With this fix `interfaces` is used as config option and a new
option named `associated_interfaces` will be used for intent check
for assigned interfaces.
* Fix CI failures
* Fix review comment
* Fixed integration test failure
* ACI: Various changes to module documentation and guide
This PR includes:
- We moved the object class information to the notes
- Add version information to guide chapters
- Add generic note to modules with reference to ACI guide
- Reference known issues in aci_rest documentation
- Remove module_utils function docs from modules
- Indicate which parameters are not required for querying all objects
- Added missing RETURN information
* Fix copyright strings
* Remove aci_domain_to_encap_pool.py for v2.5
* More updates
* PEP8 fix
* Improve listings of parameters/return values
* Adding support for vApp properties.
* vm specification updated only if changes have to be applied. I.e. subsequent updates with the same data will not trigger changed state
* Auxiliary variables renamed, hope this makes the code more readable
* Integration tests changed - re-adding the same properties test not implemented, but tested on real vCenter deployment
* fixing documentation "version_added" for the feature
* Addressing reviewers comments #2:
* documentation updated with the only meaningful value for "option" attribute - "remove"
* Fixed improperly handled case when user requested "add" operation for existent property
* vApp configuration is updated only with properties that contains changes, not with all properties requested by user
* aci_spvpg: Various fixes to integration tests/modules
This PR includes:
- A fix in module_utils aci.py
- Various fixes in integration tests
* Fix typo
* Bug in del(list) logic. Say you have a list of 4 elements a[0-3]
and you have to remove index 1 and 3, if you remove index 1 first
then list is cut short a[0-2] and does not have index 3
Fix: Remove indexes in reverse sorted order e.g. 3 and 1 in above
example so that order of indexes remain preserved even after deleting
fix is to remove indexes in reverse sorted order
* Add test cases for failed case
This PR includes:
- A fix for a recently introduced issue wrt. error handling
- Added integration tests for provoked errors
- Influence standard return values using aci library for aci_rest
- Add proxy support documentation
- Documentation update related to #34175
* fix nxos_l3_interface tests as n35 doesn't support ipv6
* add terminal dont-ask to nxos_feature and nxos_lldp
* put interfaces in L2 mode for N35
* fix nxos_feature unit-tests
This fixes, cloning operation where template or existing VM
does not have network or DVPG. Also, adds some strict type checking in
network parameters.
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This PR includes:
- Rename 'protocol' parameter to 'url_protocol'
- Add limited integration tests (as we have no public firmware access)
- Add missing examples
When ACI modules are being used for querying MOs, we should not return
the previous state, as there is no previous state, there's only the
current state.
This impacts a lot of tests that were used to testing the current state
as 'previous'.
We identified an incompleteness to parameter dependencies that affects
querying all domain-related objects.
This PR also includes:
- Improvements to integration tests
- Add missing vm_provider types
- Fix examples
This relates to #36131
This PR includes:
- A fix to the module where domain_type without domain caused havoc
- A fix to the integration tests when querying all binding objects
- Improvements to integration tests
* Added metrics_collection management to ec2_asg module to switch ASG metrics on and off.
* Fixed typo in documentation of ec2_asg module
* Removed extra blank line in ec2_asg.py
* Docs fixes for ec2_asg module
* Added integration test for ec2_asg metrics flag
* Trying different syntax for ec2_asg test
* Fix vrf parsing in eos_vrf and eos_eapi module
Fixes#30250
Fix logic to parse vrf when interface value in `show vrf`
command output spans on multiple lines
* Add idempotent test case
* Revert "commented out check tests (#35788)"
This reverts commit 3df2561405.
* `discard_changes()` now uses `exit discard`
instead of just `discard`. Also a slight tweak to avoid a second `exit` after
`exit discard`
This PR includes:
- Fixes related to the recent merge of #31637 and #34537
- A generic fix for a reference for assignment issue
- Fixes to aci.boolean() in order to catch exception
copy currently fails if you specify a destination without any directory
component. This is because we take the dirname of the destination for
some processing and no dirname causes issues.
This corrects that by prepending "./" if there is no directory component
in dest.
* [git] Fix fetching branch of shallow clone
* Use absolute file:// paths to make sure git uses shallow clones
* Improve tests
* Fix sanity errors
* Match style according to other (depth) tests
* Improve tests
Now they will fail without the fix of this PR
* New module - elb_target
* Work to add deregister functionality
* Add jurajseffer work on waiting for status change
* List the set of statuses as a choices list
* default target_status_timeout is 60
* Add 'unavailable' as a target status choice per API docs
* Add support to remove targets that are in unused state
* add support for availability zone selection
Fix deregistering targets from used target groups
Fix waiting for unused state for targets that have started deregistering
This fixes a bug when parent's local vars where not available in nested
includes. The bug can only be seen with jinja>=2.9 which changes
how the variable scopes work.
Fixes#34886
* aws ssm parameter lookup test case - fails demonstrating no exception when parameter missing
* aws ssm parameter lookup - fail in case parameter doesn't exist
* aws ssm parameter lookup test case - failing case for nice return from path lookup
* aws ssm parameter lookup - convert incoming taglist to a key-value dictionary
* aws ssm parameter lookup - pep8 / style clean up
* aws_ssm lookup plugin rewrite for more standard interface
* aws_ssm module and lookup - introduce integration test and fix:
* aws_ssm module and lookup - error case integraton test and many PEP8 and other cleanups
* aws ssm parameter lookup - Various fixes in response to review + recursive fix & test
* aws ssm parameter lookup - more in response to review - shertel/abadger
* aws ssm parameter lookup unit test - move to mocker according to abadger
* aws ssm parameter lookup - integrate with new documentation fragment
* aws ssm parameter lookup - accept either aws_profile or boto_profile
* aws ssm parameter lookup - eliminate lookup document fragment until env vars are fixed later
* Add fat filesystem support
fatresize is temporarily disabled
* Refactor Filesystem.get_dev_size
For more sharing with vFAT class
* Fix filesystem tests on some OSs
I think this is due to older mke2fs on those systems.
* Fix vFAT command on FreeBSD
newfs doesn't seem to work on image files
* Refactor filesystem.grow()
Split out grow_cmd generation and Device operations
* Use swap as unsupported filesystem
Except FreeBSD, which doesn't have mkswap
* Be consistent about str(dev) vs dev.path
Prefer str(dev), this works transparently with '%s' formatting.
* Enable vfat resize, only test fatresize >= 1.0.4
Lower versions have a segfault bug.
* Only install fatresize where available
FreeBSD, OpenSUSE, RHEL and CentOS < 7 don't ship it.
* updates to azure_rm_keyvault
* updates to azure_rm_keyvault
* updates to azure_rm_keyvault
* updates to azure_rm_keyvault
* updates to azure_rm_keyvault
* updates to azure_rm_keyvault
* updates to azure_rm_keyvault
* updates to azure_rm_keyvault
* updates to azure_rm_keyvault
* updates to azure_rm_keyvault
* updates to azure_rm_keyvault
* updates to azure_rm_keyvault
* updates to azure_rm_keyvault
* fix update bugs, add update test
This fix adds a verbose message about non-existent VM when specified
with operation, due to idempotency we can not detect correct state.
Fixes: #27384
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* ACI: Change result output as discussed
* Update all modules to use new aci.exit_json()
* Update output_level spec and docs
* Fix integration tests
* Small PEP8 fix
* Asorted fixes to tests and aci_rest
* More test fixes and support for ANSIBLE_DEBUG
* Fix another PEP8 issues
* Move response handling inside ACI module
* Reform of ACI error handling and error output
* Diff multiline json output
* Fix a few more tests
* Revert aci_bd tests
* Small correction
* UI change: existing->current, original->previous
* UI change: config->sent
* Update all modules with RETURN values
* Fix a few more tests
* Improve docstring and add 'raw' return value
* Fix thinko
* Fix sanity/pep8 issues
* Rewrite unit tests to comply with new design