* task_executor.py: Raise 'conditional exception' in case of 'include_*'
Fixes#33632
Signed-off-by: Patrick Ringl <patrick_@freenet.de>
* Re-organize tests, add static include test with undefined var
* Remove unnecessary conditional
* Fixes for mode=preserve
* Document mode=preserve for template and copy
* Make mode=preserve work with remote_src for copy
* Make mode=preserve work for template
* Integration tests for copy & template mode=preserve
Fixes#39279
* Changed mode option in win_copy to hidden option as it doesn't reflect copy mode
This fixes an issue we recently encounteredi with nxos_interface:
```
Traceback (most recent call last):
File "/tmp/ansible_JmLoba/ansible_module_nxos_interface.py", line 777, in main
have = map_config_to_obj(want, module)
File "/tmp/ansible_JmLoba/ansible_module_nxos_interface.py", line 606, in map_config_to_obj
obj['speed'] = re.search(r'speed (\d+)', body).group(1)
AttributeError: 'NoneType' object has no attribute 'group'
```
* Fix#26755 by ensuring that the first nic in the nic list has primary set to True, and all other nics have primary set to False.
* Fix sanity issues and add test for two nics
* Fix typo in test
* fix nic list
* Ensure the niclist variable is used rather than a niclist string
* Add tests just for dual nic, reverting changes to single nic VM creation tests
* Correct idempotency test
Enable awsvpc network mode for ECS services and tasks and
their underlying task definitions
Improve test suite to thoroughly test the changes
Use runme.sh technique to run old and new versions of botocore to
ensure that the modules work with older botocore and older network modes
and fail gracefully if awsvpc network mode is used with older botocore
when pulling an image with force=yes the task was marked as changed
everytime even when the image hasn't changed.
This was due to a bad comparison of the image tag before the pull
and after the pull.
Fixes#22596
Signed-off-by: Alberto Murillo <albertomurillosilva@gmail.com>
* Add note about sefcontext doing no restorecon
To someone like me who is relatively new to SELinux, setting the
"reload" option to yes might suggest that a restorecon is automatically
executed after the semanage call, making the new file context effective
immediately. I have found out that this is not the case and would like
to clarify this to others.
+label: docsite_pr
* Replace note by one suggested by reviewer
Reviewer dagwieers suggested a better notice text during review of my
original one, giving recommendations about what to do to actually get
the newly chosen SELinux context applied to the file.
* a refactor of pool member and node modules to be inline with current f5 conventions
* Added priority_group_activation to pools
* various other small convention fixes and bug fixes
* Adds gnat provisioning to bigip_provision
* Adds special handling for AFM in bigip_provision
* Add device rebooting for provisioning as necessary
* Refactored route domain module to be inline with current f5 conventions
* Minor refactors across modules
* add loadbalancer
* dict check nullable
* add default vallue when get list
* create backend addr pool
* fix the set
* fix to dict
* fix ideponement
* use param security group name when create
* nic can has no nsg
* add test
* fix
* fix
* fix
* fix idemponet
* add document
* fix test
* add configuration
* fix
* fix
* remove all resources
* fix
* fix test
* add version added
* fix lint
* fix lint
* fix lint
* remove new feature and only submit bugfix
* remove useless test
* fix
The VDO Ansible module currently cannot modify the block map cache
size (but can configure the block map cache size for new volumes).
Add the "Block map cache size" parameter to the list of modifiable
parameters.
* Added netbios option to win_domain.ps1 and updated documentation
* formatting change
* formatting change
* adding version added line for domain_netbios_name
* Identation fix
* Clarity fixes for descriptions
Changes to description for netbios_domain_name and uniformity changes to other documentation sections (bringing them in line with other sections of the document).
* Fix minor indentation
* psexec: new module to run commands on a remote Windows host without WinRM
* fix up sanity issue, create test firewall rule for SMB traffic
* Fixed up yaml linting issues, trying to fix on the fly firewall rule
* Added SMB exception to catch when cleaning up PAExec exe
* Don't load profile for Azure hosts when becoming another user
* Fixed up example to use correct option
* Reworded notes section of module docs
* Simplified module options around process integrity levels and the system account
In the particular case of executin "chkconfig --list NAME", ansible
checks the stderr looking for a particular english message.
This message is different in other languages, Spanish for example
(although it have been corrected in the latests versions)
Fixes#29818
* Adding exos_command cli_conf module
* fixing documentation, indentation and metadata_version
* removing doc fragmentation and adding required import
* removing unnecessary code and including company name on short_description
* updating BOTMETA.yml with exos module information
* Improve ec2_ami tests
Ensure that ec2_ami_image_id fact gets set immediately after AMI
creation so that they get torn down even if tests fail
Use YAML anchor to simplify AWS credential passing
Use aws_connection_info to reduce AWS credential boilerplate
Improve exception handling when updating image attributes
Error messages weren't correctly formatted to show image ids.
Node port field is not populated on K8S pods, and it's certainely the most useful port to use in pod when we need to interact with ansible outside of the cluster
* VMware: apply correct value for datacenter in TC
Signed-off-by: Tim Steinbach <tim@nequissimus.com>
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
Per Hashicorp's [guidelines][1] for automated use of terraform CLI, this PR
adds the `-input=false` option to all the commands executed in the
module. If input is required, this causes a hard failure that will
become a module failure.
[1]: https://www.terraform.io/guides/running-terraform-in-automation.html
Fixes#38732
Make matching leading newline for cli prompt
optional as there are cases when returned repsonse
for ios/iosx remote host doesn't have newline before
cli prompt.
* Update nios.py
* Update nios.py
* Update nios.py
* nios lookup errors out when there are no results #37970 Open
Indentation failure issue resolved
* Returning empty list instead of None
In case of no results, res will be returned as an empty list instead of None (implementing ganeshrn comment)
<!--- Your description here -->
If you omit the record type on state absent you will get "record_type not yet supported". Although in my experience so far, if you put the record type it still fails to remove the record but it doesn't crash. (#38730)
+label: docsite_pr
* Adding slxos_config module and supporing util functions.
* Adding slxos module_utils load_config test
* Adding slxos_config module tests
* Removing unneeded required false statements from slxos_config module
* Removing version_aded from slxos_config module
* Removing force and save from slxos config module
* Removing save test
updated with newer methods
fixed ssl name to match ansible convention
more options for host info
added vars_prefix
added comments explaining current flow
reformated commentd out code so pep8 can be happy
enabled caching
* File module: correct description of "state"
It was probably intended to say "intermediate subdirectories will be created" and not "immediate subdirectories will be created".
The «if err» test always passed after #cf938e99926 changed the earlier
assignment to always set err to "\n" if stderr was empty, and so every
script plugin (e.g., ec2.py) started to always report an empty ERROR.
* add user password lock option to user module
* fixup! add user password lock option to user module
* add unlock, set no default
* fixup! add unlock, set no default
* fixup! fixup! add unlock, set no default
* add lock password for FreeBSD, netBSD
* fixup! add lock password for FreeBSD, netBSD
The docs suggest that `port` parameter is the default port upon
which targets listen. As such, a target need only provide a `Port`
key to override the default.
* Add yarn module based off of NPM module, adjust syntax for install cmd
* Update author list
* Add Return docbloc
* Remove extra var assignment
* Always return output without emojis, small changes for yarn 0.16.1
* Move import line, add ANSIBLE_METADATA, bump version_added
* Updating module format to meet newest lint requirements. Update options and example docs.
* Bring back RETURN block and main() execution.
* All trailing whitespace removed.
* Remove json try/except.
* Add initial pass at setting up Yarn integration tests.
* Add better handling for latest and removal states. Add tests for upgrading a single package.
* Fix issue where state=latest for installing all packages caused failure.
* Set yarn bin to latest version for tests. Fix sanity tests.
* Switch template task to copy task in yarn integration tests.
* Update apt.py
Proposing description of "cache_valid_time" for Ansible 2.4 or greater.
If 'cache_valid_time' is set, 'update_cache' is set implicitly.
This means the logic should be reversed.
label: docsite_pr
* Proposing the description of "cache_valid_time"..
This commit follows the discussion in #37972.
label: docsite_pr
* Update win_certificate_store.py
Improvements to describe the different destination stores.
+label: docsite_pr
* Update win_certificate_store.py
Whole line needs to be quoted -- lingfish YAML fail.
* Remove raw byte-strings from cliconf plugins of supported platforms + edgeos
Remove uses of to_bytes, too
* Update CliConfBase docstring to reflect current position on byte strings
* Fix the function_name handling logic for lambda_policy
Switch the logic handling function_names that are ARNs
so that ARNs are correctly handled and detected
* Add tests for lambda_policy function_arn
Ensure that function_arn works.
Needs a reasonable ansible_lambda_role.
This fix adds a check if Datacenter contains cluster but does not
have ESXi server associated with that cluster.
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This fix adds exception handling which is raised when user
does not have correct set of permissions/privileges to read virtual machine
facts especially host system configuration.
Fixes: #37056
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* Add supported connection in junos module documentation
Add supported connection type in junos module doucmentation.
* adds link to platform docs
* makes recommended connection a code snippet
* does this fix banner and command?
* does this fix the rest of the errors?
The tls_* parameters are not present in Zabbix Server versions prior to
3.0. Thus the API response does not contain these keys and the
zabbix_host module failed. This commit adds checks if the parameters are
present in the API response and otherwise just completely ignores these
parameters. The documentation already states that they are not supported
for Zabbix Server versions below 3.0.
* Skip self._parent on dynamic, defer to grandparent for attr lookup
* Revert _inheritable
* Add tests for include inheritance from static blocks
Fixes#38037#36194
this change further enables the ansible-vcr project to collect fixtures per host in
situations where the host context is totally lost due to delegation.
* Keep some original pre-delegate values in connection options
* More concisely reparent, ensuring we don't go too shallow or too deep in this process. Fixes#38357
* More explicit reparenting, with a short circuit for a common case
* We need new_block to have a parent, otherwise we lose context with this approach
* Remove duplicate parent assignment
* Change callers of Block.copy to not use exclude_parent=True, when including the parent, exclude tasks
* centralize doc/config plugin lists
also update list for generation in docsite
added note to ensure they are in sync
* updated shell page to list plugins
added some more docs hinting at plugins being configurable
* fix edit link for plugins
This fix adds following -
* Check for None or blank value in project_path
* Make terraform binary path as required
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
'retries' argument was added to InfluxDBClient in version 4.1.0,
versions lower than this fails if retries are specified.
This fix adds a conditional to check if version is greater than equal to
4.1.0 and depending upon that adds 'retries' option.
Fixes: #38204
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* respect skeleton argument in usermod mode for FreeBSD
* use FreeBSD's own (more sophisticated) home creation function rather than ansible's create_home(), which does not handle skeleton files correctly for FreeBSD
If user does not specify any network type then set network type
to dhcp. There are additional checks around 'ip', 'netmask' and
'type' in network spec.
Fixes: #38466
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
If format is passed as None to get_config api, wrong command is
genereted ie. `show running-configuration | None | section interface`.
Add format type in command only if format value is either not `text`
or `None`.
* Foreman: Make the foreman callback more defensive
This ensures the ssl_verify attribute is always set. It also handles
None in _disable_plugin.
* Foreman: Handle ints in verify_certs
The default value for verify_certs is 1 which is an int. That has no
lower() function. By casting it to a str we can handle it later in
_ssl_verify().
* Foreman: Clean up coding style
* Foreman: Use get_option in favor of _plugin_options
Error was:
File "/tmp/ansible_qY_BMb/ansible_module_firewalld.py", line 703, in <module>
main()
File "/tmp/ansible_qY_BMb/ansible_module_firewalld.py", line 548, in main
module.fail(msg='firewall is not currently running, unable to perform immediate actions without a running firewall daemon')
AttributeError: 'AnsibleModule' object has no attribute 'fail'
* allow user control of lookup error behaviour
this does not affect undefined vars, only other exceptions raised by a lookup
i.e lookup('file' ..) not finding a file
This change allows users to pass bond options
alongside bond mode, in order to allow greater
flexibility for bond creation. Previously,
bond options were derived from bond mode, e.g.
"miimon" was set to 100 for mode 3 (load-balance),
however a user may want to use 200.
A bugfix backported to 2.5 also contained the new toggle option. The release
manager approved backporting this added feature to the dot release, so updating
devel to accurately reflect when the fetaure was added.
* Adding slx_command module and supporting module_utils.
This commit adds the slx_command module and tests as well as the
required slxos module_utils.
* Update copyright in header
* Adding missing module init
* Cleaning up shebangs/licensing.
* Incorporating feedback
Removing reference to `waitfor` alias in `slxos_command` module.
Adding `Extreme Networks` to `short_description` of `slxos_command` module.
* Adding cliconf tests
* Fixing 3.X tests
* Adding docstrings to test methods for slxos cliconf tests
* Adding slxos terminal tests
* Adding slxos module_utils tests
* Adding Extreme Networks team members to BOTMETA.yml
* Add troubleshooting URL for persistent socket path related issue
socket path timeout related error messages are not displayed on the
console as the ansible-connection process does not have access to it.
Until this is fixed need to point to troubleshooting URL so that
users can take corrective actions.
* Fix CI issue
* fix inventory plugin source caching
- avoid caching invetnory sources in loader in base
- same fix for yaml plugin
- idem for 'auto' plugin
fixes#37162
* fix mock dataloader func sig
actual error reprting on failed galaxy clone
also allow debugging to see stdout/stderr from command
handle output for all commands on error
also use std temp dir instead of random
avoids some repetitive loading
- read config file only once
- now cache the ini parser per file
- optimize shell plugin loading
tried to 'optimize' vars_plugins loading but it creates issues with precedence,
probalby due to iterator not being reset, will look into it in subsequent fix/PR
* restrore showing stderr on script success
accidentally removed during transition to plugin, with toggle for those
who prefer the quiet way
fixes#33776
* stderr display if no other errors capture first
* fixed issue with error encoding
* ignore version when deciding callback loading
The code already defaulted to load the callback if the properties are not present
there was no need for us to also check the version
fixes#38270
* fix error msg on set optoins to use correct name
This commit moves code to look for vars files/dirs to a common place and
uses it for loading role defaults/vars. This allows things such as
'defaults/main' or 'vars/main' being a directory in a role, allowing
splitting of defaults/vars into multiple files. This commit also fixes
the role loading unit tests for py3 when bytestrings are used for paths
instead of utf8 strings.
This fixes#14248 and #11639.
* fix urpmi.update path #37432
* improve urpmi
* use get_bin_path rather than hard coding the path
* fix pep8 issue
* avoid using global
* - `RPM_PATH`, `URPMIUPDATE_PATH`, `URPME_PATH`) aren't constants, they should be lowercase rather than uppercase
- shorten too long lines
- remove unused import
* revert removed imports
* use lowercase rather than uppercase
* update doc
* update doc
* update doc after sanity check
* 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
* Optimize file handling
Use the best practice of opening and doing operations on an opened file
Signed-off-by: Daniel Andrei Minca <mandrei17@gmail.com>
* Fix docstring to Sphinx type
- update the docstrings to Sphinx type, as suggested by Toshio
- Move the pattern object assignment outside the context manager, as
suggested by Matt
Signed-off-by: Daniel Andrei Minca <mandrei17@gmail.com>
* 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
* Reflect updated names of the aws_batch_job modules
* Remove mention of `lambda_invoke` module which has yet to make it to
Ansible.
* Update broken rst link in win_dsc module
* Start of tests for ansible.module_utils.urls
* Start adding file for generic functions throughout urls
* Add tests for maybe_add_ssl_handler
* Remove commented out line
* Improve coverage of maybe_add_ssl_handler, test basic_auth_header
* Start tests for open_url
* pep8 and ignore urlopen in test_url_open.py tests
* Extend auth tests, add test for validate_certs=False
* Finish tests for open_url
* Add tests for fetch_url
* Add fetch_url tests to replace-urlopen ignore
* dummy instead of _
* Add BadStatusLine test
* Reorganize/rename tests
* Add tests for RedirectHandlerFactory
* Add POST test to confirm behavior is to convert to GET
* Update tests to handle recent changes to RedirectHandlerFactory
* Special test, just to confirm that aliasing http_error_308 to http_error_307 does not cause issues with urllib2 type redirects
* Allow to set tls_ca_cert or skip verify for grafana datasources
* version_added in documentation for new options tls_skip_verify
* Added default value for tls_skip_verify option in doc
* Fixed author git account
* Updated author
For connection=local check only if the transport value in
provider is cli and the respective module support cli
transport. If not report back appropriate error message.
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.
* manageiq_provider: method docstrings fixes
* manageiq_provider: refactoring step towards DRY
`resource` is now same in `edit_provider()` and `create_provider()`,
to be extracted to main later.
* manageiq_provider: Fix creation of openshift provider
Fixes#38331.
Sending `api_version` to openshift provider would cause error:
"OpenShift api_version cannot be modified"
due to https://github.com/ManageIQ/manageiq-providers-kubernetes/blob/gaprindashvili-2/app/models/manageiq/providers/kubernetes/container_manager.rb#L37
In `edit_provider` we `delete_nulls()` on the whole data being sent
so `api_version` was omitted if not specified.
In `create_provider()` we only did it on endpoints list so `api_version`
was always sent - now doing on whole data.
Physical devices are listed using 'pvs' command. Then, for
'/dev/dm-*' devices 'dmsetup' command is used to find pv_name.
An error occurs when 'pvs' command list an unknown device:
$ pvs --noheadings -o pv_name,vg_name --separator ';'
/dev/dm-0;vg_var
/dev/mapper/sdb3_backups;vg_data_backups
$ dmsetup info -C --noheadings -o name /dev/dm-0
Device dm-0 not found
Then the module fails:
{
"changed": false,
"err": "Device dm-0 not found\nCommand failed\n",
"msg": "Failed executing dmsetup command.",
"rc": 1
}
This failure can be avoided when the unknown device isn't used in
module parameter 'pvs'.
* 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 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
This offers an optimization that allows loading larger
inventories of various structure by improving the
scaling laws involved for adding hosts and groups.
The primary speed benefit is the elimination of duplicate
recusion from traversing converging paths.
* 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
The gunicorn module has a hard-coded reference to '/tmp' which may
or may not be the actual temp directory for an operating system.
This patch replaces '/tmp' with module.tmpdir which should
resolve to the correct temp directory for the OS.
Fixes Issue #36953
Signed-off-by: Eric Brown <browne@vmware.com>
* 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.
* Fix bug 36936
* Added version_added to argument and fixed whitespace
* Update panos_import documentation
Update parameter documentation and add note.
* Add type documentation
* added version number for documentation
For real
* Integrated recommended changes
- Added recommended changes from PR
* Changed validate_ssl default back to True considering there is a
note at the top of documentation explaining change
* Format changes based on recommendations from gundalow
* Rename validate_ssl to validate_cert
* Change description to remove SSL reference
* Change url default ih documentation
* Integrated small changes from bug report
- Renamed validate_cert to validate_certs
- Changed documentation for disabling cert validation
Consolidate waiters to a single file
* Add waiter message with token ID
* Add waiter
Add waiter for WAF change tokens
Working waiter for waf_condition module
Add support for waiters to waf_rule
* WAF data model refactor
* Fix ref to self.client
* Add custom waiters to aws_waf_web_acl
* Allow add/remove rule tasks to operate in parallel, then wait for their change tokens to complete
* Move waiter into run_func_with_change_token_backoff since it is generic to all WAF update operations
* Wait for deletes on waf_web_acl
* Remove always-wait
* Remove waiter retry catch
* Add OpenNebula one_image_facts module
`one_image_facts` - module for gathering facts about OpenNebula images
Add integration tests
* Add an alias for ids
Map values can contain commas, e.g.
- name: Configure OVN bridge mapping
openvswitch_db:
state: present table: open_vswitch record: . col: external_ids key: ovn-bridge-mappings
value: '"vmnet-static:br-vmnet-st,vmnet-dynamic:br-vmnet-dyn"'
Previous behaviour was splitting the value and raised an exception.
`get_options` is an undefined method from CallbackBase
As a result, remove the trailing `s` letter.
Signed-off-by: Daniel Andrei Minca <mandrei17@gmail.com>
This fix adds check for NMClient, NetworkManager availability
while using require_version API.
Fixes: #38042
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* Add error handling for junos in case wrong connection type
Fixes#37990
If a junos module doesn't support given connection/transport type
return appropriate error message.
* Fix CI issues
* Fix review comment
* fixes issue when netconf would report ios is not supported
This change now will map ansible_network_os=ios to the correct netconf
plugin implementation. This will resolve an error where the netconf
connection plugin will report that ios is 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
Iterating an object and changing it at the same time is unsecure and no longer permitted in Python >= 3.6
Provisioning an instance fail with the Python error: "RuntimeError: dictionary changed size during iteration"