* show original exception for yaml (and other) errors
In places where we need to catch a yaml error and raise
an AnsibleError, add the orig yaml exc to the AnsibleError
via the orig_exc arg.
When the AnsibleError is displayed it will now include the
AnsibleError (AnsibleParserError for example) and the type
and message from the original yaml exception.
This provides more detail to the error messages related to
yaml errors.
This also improves errors from dataloader (for example,
previously if a wrong password was used for a vault encrypted
yaml file, the error was very vague and suggested yaml errors,
but now the message includes the original exception from vault
indicating the password was incorrect or missing).
Add a text note to playbook helper asserts. For playbook
syntax/layout errors that aren't yaml errors, but errors
indicating invalid data structures for a playbook/task/role/block,
we now include some info about where the assert was and
why it was raised.
In places we raise an AnsibleParserError in an except
clause, pass the original exception to AnsibleParserError via
orig_exc arg.
Make assorted error messages a little more specific (like
the playbook helper load methods)
* Revert "Include the original YAML error in syntax error messages"
This reverts commit 781bb44b02.
* Allow cert and private pem information to be passed in via string, eg when obtaining sensitive key details from anisble-vault at runtime
* Allow cert chain body to be passed as a string
* Ensure the new options are set in parameters
* Dont publish the private key in logs
* Set the version_added documentation
* Update documentation inline with review
* Removes file based certificates in favour of string only as suggested in feature review
* Documentation changes as suggested by review
* Make access_token type str, remove alias, and make validate_certs default value true
* Remove comma
* Add bcf switch module
* Remove white space in blank line
* Fix yaml
* Try removing the RETURN just like in the other modules
Given parent include path "{{ var | default('path/file.yml') }}"
os.path.dirname(parent_include_path) yields {{ var | default('path/
which is incorrect in itself but also causes templating errors
due to unbalanced quotes. Fix both problems by templating
parent include path before finding its dirname.
* Support NetBSD 7.1+ style ifconfig -a output
network facts on NetBSD after 7.1 cvs would fail
because of format changes in 'ifconfig -a' output.
update code to support new and old format.
add unit tests for both based on
examples from Bruce V Chiarelli.
* wrap use of interfaces.keys() in list() for py3 compat
* sort interface ids for stability
When creatinf a new VM from template, you can specify the storage domain
name and disk format where to copy all the template disks
For example if you want to create a VM from template into specific
storage domain you can do the following:
ovirt_vms:
name: vm_on_my_storage_domain
cluster: my_cluster
template: my_template
operating_system: other_linux
type: server
cpu_cores: 1
cpu_sockets: 1
state: stopped
clone: True
storage_domain: my_nfs_storage
format: COW
before this change adding nic was allowed only to a vm. Now it is
possible to add it to template.
example:
- name: test add nic to template
ovirt_nics:
auth: "{{ ovirt_auth }}"
state: present
template: mytemplate
name: nic1
interface: virtio
profile: ovirtmgmt
network: ovirtmgmt
* Fix ansible_cmdline initrd fact for UEFI
UEFI cmdline paths use \ path sep which would
get munged by cmdline fact collection.
* Make CmdLineFactCollector easier to test
extract the parsing of the /proc/cmdline content to
_parse_proc_cmdline()
add a wrapper method for get_file_content _get_proc_cmdline()
Add unit tests of _parse_proc_cmdline based on examples
from issue #23647Fixes#23647
* win_environment: Added tests and return info in document
* fixing up some yaml issues
* some more things I should have detected
* fixing up test tag name
* Implemented dconf module for manipulating and reading the dconf database.
* Fixed remote execution for the dconf module when state=present by wrapping the invocation with dbus-launch (dconf requires a running DBus user session). Updated documentation to mention external module dependencies.
* Fixed remote execution for the dconf module when state=absent by wrapping the invocation with dbus-launch (dconf requires a running DBus user session).
* Updated dconf module implementation to make it more robust:
- Detect running D-Bus session, and reuse that one if possible.
- If detection fails, try launching process via dbus-run-session to avoid
left-over D-Bus processes.
- As last resort run dbus-launch, and clean-up after the changes have been
made.
- Updated documentation to mention new dependencies and to be more explicit
about module limitations.
* Fixed PEP8 errors reported by ansibot in dconf module.
* Updated dconf module implementation:
- Fail early if psutil library is not available on the system.
- Go through all of user's processes to locate a running D-Bus daemon.
- Test potential D-Bus session bus address before deciding to (re)use it.
- Added a couple of debug statements.
- Updated documentation to include dbus-send as requirement.
* Updated dconf module implementation:
- Simplified module, removing all code for handling dbus-daemon, as discussed in
a community meeting.
- Module user must ensure that D-Bus user session is available and specified
either via module parameter or environment variable.
- Updated documentation for the change.
* Updated dconf module implementation:
- Add back ability to detect running D-Bus user session.
- Fail-back to using dbus-run-session if running session could not be detected.
* PEP8 fix for dconf module.
* Updated dconf module implementation:
- Introduce correct examples for Gnome DE.
- Rename existing examples to mark them as Cinnamon-specific.
- Use self.module.get_bin_path instead of custom check for dbus-run-session.
- Fixed typo in method documentation for DconfPreference.reset().
* netscaler_service initial implementation
* Changes as requested by reviewers
* Skip some tests if under python2.6 and importing requests library
* Change option "operation" to "state"
* Remove print statements from netscaler module utils
* Catch all exceptions during login
* Fix fail message
* Add common option save_config
PR #5165 at https://github.com/ansible/ansible-modules-core/pull/5165
adds redirection and capture of stdout during execution of
docker-compose.
This doesn't necessarily catch all errors, since some are printed to
stderr and lost.
This extends the redirection to include stderr, and does minor string
processing to attempt to find a 'useful' message to present as the
final Ansible error.
* Allow template files to be vaulted
* Make sure to import exceptions we need
* get_real_file can't take bytes, since it looks specifically for string_types
* Now that we aren't using open() we don't need b_source
* Expand playbooks_vault docs to include modules that support vaulted src files
* Add vaulted template test
If the temp directory creation failed in mkdtemp then temp_path is never
given a value. This would lead to a NameError exception which would
obfuscate the original error (out of disk space being a common one). By
catching NameError, python will raise the original exception as we want.
Fixes#17215
* using a _named_ capture in our assembled pattern, since before/after could potentially contain their own parenthesized captures
* ensuring we only replace against the named capture in question
* removing some duplication in the regexp replacement, that was introduced in ansible/ansible#22535
* fixed edge case of before/after not matching file content to replace
Fixesansible/ansible#24840
Initial commit to split includes into static imports/dynamic includes
This implements the new include/import syntax for Ansible 2.4:
* include_{tasks,role,variables} = dynamic
* import_{playbook,tasks,role} = static
The old bare `include` will be considered deprecated, as will any use of the `static: {yes|no}` option.
This also adds docs for import/include and reorganizing the "Playbook Reuse" section of the documentation.
* New facts module for AWS VPC Peering
* Update documentation and region catch for boto3
* Update ec2_vpc_peering_facts for python3 and flake8
Update version to 2.3
Update for python3 exception handling
Use ansible_dict_to_boto3_filter_list rather than duplicating
implementation
Use camel_dict_to_snake_dict on results for ansible standard results
Tidy up flake8 compliance
* Support check_mode for ec2_vpc_peering_facts
Add supports_check_mode to the module declaration
* Fix latest Ansible standards
Update version to 2.4
Add ANSIBLE_METADATA
Move imports
* Fix boto3 tags to remove; unable to remove a list of strings, need list of {'Key': key}
* pep8 fix
* cannot bugfix due to differences in AWS APIs - just document
* add more info to guidelines for using compare_aws_tags
* Add net_user platform agnostic module
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
* Integration test for net_user
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
* modify eos_user module to support name param as alias to username
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
* Test collection of users
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
When operating on arbitrary return data from modules, it is possible to
hit the recursion limit when cleaning out no_log values from the data.
To fix this, we have to switch from recursion to iteration.
Unittest for remove_values recursion limit
Fixes#24560
* Fix proposal for bug 25151
* Fix proposal for bug 25151 - pip module, pyvenv validation
* Graceful fail when virtualenv_python is defined and virtualenv_command uses the venv module
* Making sure that venv is being used as a modue "-m venv"
* Updating syntax in validations
* Updating syntax in validations - fixing stupid typo "[)"
* Raising an error if virtualenv_command is pyvenv or venv and virtualenv_python is used
* trailing whitespace gone, pyvenv, venv validation and docs update
* cleaning whitespaces from blank lines
* Ultra basic api-gateway module based of lambda.py
* Ultra basic deployment added to api-gateway module
* ApiGateway module Allow creation of APIs, more documentation and better return value
* ApiGateway module incorporate review feedback
* ApiGateway module flake8 cleanup
* APIGateway module - more review fixes.
* slightly better messages in api_gateway module
* AWS api_gateway module - try to improve messages in case of exceptions
* rename api_gateway module to aws_api_gateway as discussed in PR 20230
* aws_api_gateway - Allow delivery of swagger either as text or dictionary.
* aws_api_gateway module - introduce 'unit' tests, improve imports using them and small fixes
* aws_api_gateway module - move path expand_user to avoid early typecheck
* aws_api_gateway - version means version of metadata not module - fix to 1.0
* aws_api_gateway module - Rely on module_utils.ec2 for imports & path type for expanduser / cleanups
* aws_api_gateway module - heavy cleanup and refactor of code + cloud retry functionality.
* api_gateway_module - failing test case for handling more than one deployment in succession and API deletion
* add TooManyRequestsException to AWSRetry exception list - makes API deployment work.
* api_gateway_module - Fixes for various review comments + errors from various linters
* api_gateway_module - Fixes for more review comments + linter error
* api_gateway_module - Major refactor into sensible functions - create_response becomes configure_response
* api_gateway_module - should be working under python3; remove test exclusion
* api_gateway_module - finish off remaining review fixes - use ansible defaults and fix mutually exclusive
* api_gateway_module - attempt to improve handling of botocore errors in python3
* api_gateway_module - implement state=absent / API deletion
Fix 'hostname' module Facts is not defined by updating
'hostname' module to use it.
is_systemd_managed() was previously on the module_utils.facts.Facts
class that no longer exists.
Fixes#25289
* Add 'exists' to win_stat return docs
Fix 25107 by adding documentation for 'exists' return value in win_stat module
* Added missing filename attribute to RETURN
Also made the path and filename sample values consistent.
default inventory plugin order now follows the hardcoded one in previous versions
yaml plugin shoudl run before ini to avoid ini being able to parse some yaml files succesfully.
fixes#25321
* Get AWS access and secret keys from boto config
* matching the elif pattern
* avoid setting credentials as empty strings by checking os.environ.get('cred')
put comments back
* remove None from os.environ.get()
* Support check_mode in ec2_vpc_nacl
Ensure that all API calls that make changes are guarded by
`if not module.check_mode`.
* Update ec2_vpc_nacl_facts to latest pep8 standards