Move dict_merge from azure_rm_resource module to
module_utils.common.dict_transformations and add tests.
Use dict_merge to provide a fairly realistic, reliable
diff output when k8s-based modules are run in check_mode.
Rename unit tests so that they actually run and reflect
the module_utils they're based on.
* win_reboot: fix 2.6 issues and better handle post reboot reboot
* changed winrm _reset to reset
* Add handler to reset calls when .reset() throws an AnsibleError on older hosts
* Moving back to _reset to get the issue fixed
The ssh connection plugin is overzealous in thinking that error code 255
can only come from ssh. Python can return 255 in some circumstances and
error from php does as well.
* __file__ won't work if we want to invoke modules via -m or if we
figure out how to keep modules from hitting the disk with pipelining.
* module.tmpdir is the new way to place a file where it will be cleaned
automatically.
Change format string to not depend on __file__:
* cloud/amazon/ec2_elb_lb.py
* cloud/amazon/elb_classic_lb.py
Use module.tempdir:
* packaging/os/apt.py
* files/unarchive.py
* complete plugin docs
* add missing 'plugin' option
* user and password are now 'correctly' required
* added inventory source example and extension information for user
The OVSDB schema consists of typed columns. The 'key' parameter is
required only for columns with type of a 'map'. This patch makes 'key'
an optional parameter to allow setting values for other column types
like int.
Fixes#42108
* allow user to pass list of resources in to definition parameter
* Add new validator for list|dict|string
* use string_types instead of string
* state/force information is lost after the first item in the list
* Add tests
* Appease ansibot
* ios_facts: Report file system space
Parse total and free space from dir output. For this, add a hash
filesystems_info containing the keys spacetotal_kb and spacefree_kb.
* ios_facts: Add unit test for file system space reporting
* ios_facts: Add integration test for file system space reporting
* Add support for disable_my_meraki parameter
- Meraki added support for the disabling access to Meraki websites on
devices. This module now supports this.
- I haven't tested this as it was developed on an iPad. It will work
before submitting PR.
- Rework of payload generation code is required or at least
recommended.
- Integration tests need to be developed.
* Added support for disableMyMerakiCom parameter
* - Remove proposed functions as it isn't required for updates
- Add integration tests
- Still pending a case response from Meraki since I can't seem to
set disableMyMerakiCom to false after it's true
* Fixed word wrap problem
* Add version_added to disable_my_meraki
* Initial commit of meraki_ssid module
- CRUD functionality for Meraki wireless SSIDs
- Much more testing is needed
- Module is not currently idempotent
* Improve integration tests
- Original integration tests didn't have any assertions in it
- Single bug fix in module found via integration test
* Added idempotency support
- Changes are only made when needed.
- Added integration test to check for idempotency.
- Relies on a forthcoming PR to make idempotency check a single pass.
* Improved documentation
* Initial commit for meraki_mr_l3_firewall module
- CRUD functionality for layer 3 firewall rules on the Meraki MR access points
- Complimentary integration test
- Need to add support for SSID lookup
* Added support for specifying SSID name and improved documentation
* Added examples to documentation
* Removed whitespace
* Enable get_net() to download nets if data isn't provided
- Currently, get_net() requires data to be passed to it
- PR enables get_net() to download all networks if data isn't passed
- Slightly simpler code
- Best practice is to download nets early in execution
* Apply fixes related to get_net()
* Removed extra code from the rebase
* Enabled support for configuration template configuration
- get_nets() now pulls down templates and networks
- A few changes in VLAN and network to operate as a POC
* Ansibot changes
- Fix undefined variable
- Document net_id in meraki_vlan
* Fix indentation
- Before this, it allowed claiming devices into a network only
- Make integration tests a block
- Note, API doesn't allow unclaiming in an organization, only net
- Added an integration test for claiming into an org
- Requires unclaiming manually
- There is a bug in the API which isn't showing claimed devices
* Added full return documentation for normal responses
* Changed returned for responses
- Old responses were saying always returned, should have been success
or something more refined
* docker_container: ensure 'init' is supported
Check docker-py version too.
Move API version check in docker_container module since 'init' module
parameter isn't defined by other docker modules.
docker-py supports 'init' since 2.2.0:
https://github.com/docker/docker-py/blob/2.2.0/docs/change-log.md
* docker_container: fix compat with docker-py<2.2
Exception was:
TypeError: create_host_config() got an unexpected keyword argument 'init'
fatal: [localhost]: FAILED! => {
"changed": false,
"module_stderr": "Traceback (most recent call last):
File ansible_module_docker_container.py, line 2089, in <module>
main()
File ansible_module_docker_container.py, line 2084, in main
cm = ContainerManager(client)
File ansible_module_docker_container.py, line 1704, in __init__
self.present(state)
File ansible_module_docker_container.py, line 1724, in present
new_container = self.container_create(self.parameters.image, self.parameters.create_parameters)
File ansible_module_docker_container.py, line 826, in create_parameters
host_config=self._host_config(),
File ansible_module_docker_container.py, line 932, in _host_config
return self.client.create_host_config(**params)
File lib/python3.6/site-packages/docker/api/container.py, line 157, in create_host_config
return utils.create_host_config(*args, **kwargs)
TypeError: create_host_config() got an unexpected keyword argument 'init'",
"module_stdout": "",
"msg": "MODULE FAILURE",
"rc": 1
}
* Add additional puppet options
Add support for puppet options --debug, --verbose, --summary,
and extend logdest to support logging to stdout and syslog at
the same time.
Fixes issue: #37986
* Fix docs
* Doc fix, add release note
* Fix silly yaml error
* Correct changelog, add C() to params in doc
* Fix tmpdir on non root become
- also avoid exception if tmpdir and remote_tmp are None
- give 'None' on deescalation so tempfile will fallback to it's default behaviour
and use system dirs
- fix issue with bad tempdir (not existing/not createable/not writeable)
i.e nobody and ~/.ansible/tmp
- added tests for blockfile case
* Revert "Temporarily revert c119d54"
This reverts commit 5c614a59a6.
* changes based on PR feedback and changelog fragment
* changes based on the review
* Fix tmpdir when makedirs failed so we just use the system tmp
* Let missing remote_tmp fail
If remote_tmp is missing then there's something more basic wrong in the
communication from the controller to the module-side. It's better to
be alerted in this case than to silently ignore it.
jborean and I have independently checked what happens if the user sets
ansible_remote_tmp to empty string and !!null and both cases work fine.
(null is turned into a default value controller-side. empty string
triggers the warning because it is probably not a directory that the
become user is able to use).
The docker API init parameter is the dependency requiring this bump. It was introduced 2.3.0 release of the docker package as per commit 13b5f785a7ab459960aae82fae00e4245e391387 in github.com/docker/docker-py.
* inventory plugin docs
* added set options
* minor wording and formatting fixes
* changed headers to std as per #35520, also added to main readme
* unified inventory plugin devel, referenced from generic plugin dev
* fixed typos and update as per feedback
NOTE:
1. Use unsafe decorator but not builtin escape wrapper in jinja2
since ansible will try parse ssh password twice, the builtin
escape wrapper will be removed during the first parse.
2. Use class AnsibleUnsafeText but not '!unsafe' syntax since
passwords are not loaded by YAML env, '!unsafe' syntax doesn't
work for them.
* Fix fetching old style facts in junos_facts module
Fixes#42298
* To fetch old style facts from junos device it requires
login credentials in provider, hence while using
connection=nectonf do not delete provider values
as it might not be ignored
* Add `ofacts` as one of the options in `gather_subset`
* Minor update in documentation
* Fix CI failure
* Update eos cliconf plugin methods
* Refactor eos cliconf plugin
* Changes in eos module_utils as per cliconf plugin refactor
* Fix unit test and sanity failures
* Fix review comment
* Always using current draft when referring to ACME v2.
* Adding URL for ACME v1 protocol.
* Improve cross-referencing of acme_* modules.
* General improvements.
* Fixing syntax error.
* aws_eks_cluster: Improve output documentation
This data is already returned by the module, it just wasn't documented. These
fields are required for accessing the created Kubernetes API with e.g. the
k8s_raw module.
* aws_eks_cluster: Add wait functionality
This enables further cluster configuration once it's created and active.
20 minutes was chosen as an arbitrary default, so that if it takes longer than
the documented "usually less than 10 minutes" it's still likely to succeed.
* Correct security group name in aws_eks tests
* Improve teardown of aws_eks tests
Fix minor teardown issues. The `pause` step is a placeholder until
a waiter for `state: absent`
* Add execution_role_arn parameter
* Change ecs_taskdefinition to use AnsibleAWSmodule
Botocore version checking is becomming more common. Changing the ecs_taskdefinition
to use AnsibleAWSmodule allows more easily for this.
* Change launch type check to use botocore_at_least function
* Remove execution_role_arn param from params dict
* Change check to use parameter
* Fix typo
* Add test for old botocore version
* Add test for execution role parameter
* Remove iam_role_facts task
Task was unecessary. The same information could be gathered by registering
the iam_role task.
* add check description update
* Ensure 'Description' is in the role so KeyError isn't caused
* Fix changed when modifying the description with check mode
Fixes#37262Fixes#36284
* Updates options in netconf connection to enable
bastion/jump host setting using configuration/enviornment
varaibles.
* Update troubleshooting docs from using bastion host with netconf
connection
- Module utility now has orgs, nets, org_id, and net_id properties
- get_nets and get_orgs sets nets and orgs properties respectively
- Allows for storage of this data in the module. org_id and net_id aren’t set as I cannot guarantee that’s always desired.
* Check for HTTP status code
- All requests now check returned status code
- Fail if status code isn’t what is expected
* Fix blank line error
* Change HTTP check logic and improve integration tests
- Set HTTP status code check so default path is accept
- Added create and delete network for integration test
- Remove a few comments to clean up code
* Added support for checking HTTP response codes
- All request calls now check for response code before responding
- If the response code isn't what it should be, it fails or returns nothing
- Breaking this into multiple PRs to make backporting easier
- Using status property in Meraki module utility which has the code
* Change logic of HTTP checks so success is default
- Previously all data between both data structures was compared
- Results in situations where updates are done when not needed
- Changes to single pass so only data in payload is compared
[AWS iam_policy] Avoid the _undefined name_ by catching the raised exception into the variable __e__ so it can be reported on the following line.
flake8 testing of https://github.com/ansible/ansible on Python 3.6.3
$ __flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics__
```
./lib/ansible/modules/cloud/amazon/iam_policy.py:305:16: F821 undefined name 'e'
if e.errno == 2:
^
./lib/ansible/modules/cloud/misc/rhevm.py:594:24: F821 undefined name 'e'
setMsg(str(e))
^
./lib/ansible/modules/files/archive.py:391:92: F821 undefined name 'e'
module.fail_json(dest=dest, msg='Error deleting some source files: ' + str(e), files=errors)
^
3 F821 undefined name 'e'
3
```
* Create base class for network-style connections
* clean up some differences
* Move NetworkConnectionBase
* Tweak netconf for tests
* Tweak when network_os is checked to avoid failing tests
* Pull back exec_command
* request() has improved error reporting
- 5xx errors show same as before
- 3xx and 4xx errors show error body
* Print body for errors greater than 300, but less than 500
* Remove trailing whitespace
Avoid the _undefined name_ and mirror lines 389 and 459 by catching the raised exception in the variable __exc__ so it can be reported on the following line.
flake8 testing of https://github.com/ansible/ansible on Python 3.6.3
$ __flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics__
```
./lib/ansible/module_utils/network/iosxr/iosxr.py:414:42: F821 undefined name 'exc'
module.fail_json(msg=to_text(exc))
^
```
* Revert "Account for empty string regexp in lineinfile (#41451)"
This reverts commit 4b5b4a760c.
* Use context managers for interacting with files
* Store line and regexp parameters in a variable
* Add warning when regexp is an empty string
* Remove '=' from error messages
* Update warning message and add changelog
* Add tests
* Improve warning message
Offer an equivalent regexp that won't trigger the warning.
Update tests to match new warning.
* Add porting guide entry for lineinfile change
* pamd: typo fix sufficicent->sufficient
* pamd: is_valid is a property, not a method; return a tuple
* pamd: define is_valid for all PamdLine classes
* pamd: use validate() for verbose errors, define generically
* pamd: PamdRule: rule_control is always str, use _control
Fixes https://github.com/ansible/ansible/issues/41179
* elasticsearch_plugin - Show STDERR on module failures.
I tried to install a ES plugin without
become: yes
and found after debugging the module that the module failed ude to permission issues.
The only error message I got was
Is analysis-icu a valid plugin name?
That was strange considering I followed the example documentation by the letter.
I found out that when this module fails, it hides the real reason for failure.
This patch replaces the generic error with more meaningful diagnostics.
* elasticsearch_plugin - Show STDERR on module failures. Changelog fragment
samdoran commented 2 days ago
This looks good. Please create a changelog fragment to go along with this change. See fragments for examples.
* Fix bug with redundancy templates and add integration tests for redundancy templates.
* vlan_list absent state support and fix for vlans as strings in vlan_list
* Fix junos_config confirm commit issue
Fixes#40626
* Due to issue in ncclient commit() method for Juniper
device (ncclient/ncclient#238)
add a workaround in junos netconf plugin to generate proper
commit-configuration xml and execute it using ncclient
generic `rpc()` method.
* Update junos_config doc
* Add run_commands api for ios and vyos cliconf plugin
* Add run_commands api to ios and vyos cliconf plugin
* Refactor ios and vyos module_utils to check return code
in run_commands
* Fix Ci failures
Certain project functions are not available on the openstack public api. Creating and deleting projects are examples where you must use the admin api.
In most devstack or simple openstack deployments the public, internal and admin apis may live at the IP. However in most production deployments the admin APIs are on a separate network than the public APIs. Therefore for these examples to consistently work, we must specify the admin endpoint_type.
* Issue #39860: Add 'not_contains' method to parsing.py
* Issue #30860 Adds self.negate to Conditional class in lib/ansible/module_utils/network/common/parsing.py
* Issue #39860 Fix singleton-comparison issue per sanity tests
* Issue #39860 'test/integration/targets/nxos_command/tests/cli/not_comparison_operator.yaml' integration test
* Issue #39860 Add unit tests to '../../test/units/module_utils/network/common/test_parsing.py'
* Issue #39860 Fix singleton comparison issue
* Fix E302 expected 2 blank lines, found 1
* Issue #39860 Add license header to unit tests
* Issue #39860 Move integration test to 'test/integration/targets/nxos_command/tests/common/'; remove unnecessary comment from unit test
* Issue #39860 remove unnecessary comment from unit test
* refactor win_group_membership to use SIDs for comparisons instead of name parsing
* carry over previous doc cleanup changes
* remove trailing whitespace from docs
* If we evaluate task.loop/with_items when calculating delegate_to vars, cache the items. Fixes#28231
* Add comments about caching loop items
* Add test for delegate_to+loop+random
* Be more careful about where we update task.loop
* Create splunk.py
This is a new callback for logging to Splunk. It is based on sumologic.py and updated to work with the Splunk HTTP Event Collector.
This has been by our team and others.
It is working with Ansible 2.5.2
* Update splunk.py
Addressed white spaces and formatting issues
* Update splunk.py
* Update splunk.py
* Updated version to match target release
Following code review recommendations. Thanks for the help
* Updated colon impacting documentation
Updated based on code reviews. Thanks the help
* Updated quotes to be consistent
* Add diff capability in vyos edit_config
Fetch onbox diff within edit_config cliconf
plugin and return it in response
* Remove diff returned from ios edit_config
* Fix CI failure
* More CI fixes
* runas + async - get working on older hosts
* fixed up sanity issues
* Moved first task to end of test for CI race issues
* Minor change to async test to be more stable, change to runas become to not touch the disk
* moved async test back to normal spot
* Add productType property as an ansible fact
Suggest to add productType property from win32_operatingsystem CIM instance to differentiate between versions and add new fact.
* update code to display human-readable string
Commit added in response to nizmahone's suggestion to add humane-readable strings to the display. uses switch statement to evaluate and update $ansible_facts hash table with proper information
* remove string conversion, modify switch default
Adjusts line 202 to remove .String() conversion from uInt32.
Adjusts switch test values to integers
Uses switch default clause to handle null values
* formatting
fixed formatting issues, moved product_type into variable.
adjust ansible_fact hash table key to be consistent with the rest of the code.
* Moved product type within distribution
* Use context managers for interacting with files
* Account for empty string as regexp
Rather than explicitly testing for None, also test for an empty string which will evaluate to False. An empty string regexp matches every line, which ends up replacing the incorrect line.
* Store line parameter in a variable
* Add tests
If a line match is found in the file and no regexp is specified, insertbefore would improperly try to add a line if set to BOF.
Add tests for this scenario.
* Use inventory.get_host instead of direct access to inventory.hosts. Fixes#32152
* Prevent potential side effect, by using self._inventory.localhost directly instead of get_host
* Add a module parameter to configure the max fetched AWS CFN stack events
* Add version documentation for new configuration option
* Increase default in order to make sure that enough are fetched by default. This align roughly with the limit of manageable resources in CloudFormation.
This fix adds a new parameter 'dvswitch_name' in networks argument spec.
When there are multiple distributed portgroup with the same name in the given
environment, it is difficult to pick particular dvpg. By specifying dvswitch value
we can pin point exact distributed portgroup to attach virtual machine to.
Fixes: #41781
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
- Comparison was not happening properly as it lacked full data
- Module now creates a full data structure on payload
- Defaults to America/Los_Angeles as that's what Meraki seems to do
* Fix ios and vyos cliconf edit_config return type
Modify cliconf edit_config api to return a json string with
diff and response received from remote host for ios and vyos.
* Doc change
Upon preparing the commands for sending to the device, cliconf converts
the optional prompt to a byte string. However, since there might be
multiple prompts specified, the conversion has to happen for each prompt
individually. Otherwise, wrong regexes will be compiled in
_handle_prompt from network_cli Connection.
* vyos and ios cliconf plugin refactor
* Refactor vyos cliconf plugin
* Change vyos module_utils and vyos_config as per refactor
* Minor changes in ios cliconf plugin
* Fix unit test failure
* Fix sanity issues
* Add get_diff to rpc list
* fix: exclude using wildcards for tar archives
Fixes#37842, #22947
* fix: Remove quote() as it munges the exclude format
* test: Refactor to use single archive structure
A common structure archived by different methods should simplify some of
the feature tests.
* test: Use common archive layout to validate exclude feature
* test: Use the same exclude checks for zip/tar archives
* validate vars_files entries are string_type or list
Fixes#17594
Signed-off-by: Adam Miller <admiller@redhat.com>
* use collections.Sequence to simplify if check
Signed-off-by: Adam Miller <admiller@redhat.com>
* fix minor issues with debug and item labels
- no more `item=None`, we always have a label now
- debug should only show expected information, either msg= or the var in var=
- also fixed method name, deprecated misleading _get_item