open(path) throws an error when called on a directory or UNIX socket,
and therefore a check to ensure that the path is absent will always
succeed when there is a directory or file located there.
This updates the check to use os.access(path, os.F_OK) instead, which
instead just checks that the path exists instead of trying to open it as
a file, and therefore properly handles directories and sockets.
This causes a slight semantic change in how permissions are handled.
The existing code will fail to work correctly if the user running the
module on the managed host has no read access to the path specified.
The new code will work correctly in that situation.
Both versions fail if the user can't traverse the parent directory.
I've also added a check to the try block to catch OSError. I've seen
this call fail with an OSError on rare occasion in the face of odd
extended permissions (usually MAC configuration) in cases where it
should technically return False. In such cases, the file is functionally
inaccessible to the user making the call, so it's essentially not there,
but it can't be created by them either. I've documented this, as well as
the fact that the bug this change fixes exists, and a rather nasty
inconsistency involving symbloic handling that I stumbled across while
testing this change.
Fixes: #20870
* vmware_host: add reconnect and add_or_reconnect states
Add "reconnect" and "add_or_reconnect" choices for "state".
* reconnect: reconnect an esxi to a vcenter (imply it is present).
* add_or_reconnect: do the same but add the esxi if absent.
Also:
* tag the cluster_name as required (because it is).
* tag esxi_username and esxi_password as not required because
they aren't when the esxi isn't added.
* vmware_host: add + prepare/document integration tests
vmware_host module
Add integration test for the add part of "add_or_reconnect" state.
Prepare and document integration tests for the reconnect part
of "add_or_reconnect" state and "reconnect" and "absent" states.
Currently we can't test those states as ReconnectHost_Task (for
"reconnect") and EnterMaintenanceMode_Task (for "absent") aren't
implemented yet in vcsim (from vmware/govmomi)
* Readded vital return parameters to the ec2_asg that have been spared for no obvious reason
* Fix typo in ec2_asg docs
* Fixing another typo in ec2_asg docs.
* Fixing save so it still works. Adding changed as an option for save_when.
* Updating unit tests.
* Updating description to state that changed was added in 2.5.
* Added new module: Azure RM SQL Servers
* fixed sanity issues
* enabled integration test
* disabling test as Microsoft.Sql namespace not available
* renamed servers -> server
* updates as requested in the review
* udpates to sql server
* renamed module
* replaced has_key by in
* flattened results
* final updates to sql server
* updates as requested in the review
* added more tests
* deleting unexisting instance up front
* more tests
* another round of test changes
* removed uneeded test
* Change cast_list_to_dict to more generic rekey_on_member
cast_list_to_dict was taking an arbitrary data format in and returning
an arbitrary data format out. Rework this to be a more generic function
which creates a dict of dicts based on a member of the dict.
Remove cast_dict_to_list since rekey_on_member handles the use cases we
know about and cast_dict_to_list suffers from the same problems as
cast_list_to_dict. If this is still needed we could think about filters
we could add to do this in a short jinja2 pipeline.
* Fix bare excepts (bare excepts even catch sys.exit())
Previously if a child's group vars section was defined before the
child group itself, an edge case would be hit where the state of the
pending declaration would process as var and therefore drop the
child pending declaration context. This would result in the group
vars defined for the parent group being out of scope for the child
group.
Example:
[web:children]
appnodes
proxies
[web:vars]
deployment_type=prod
[appnodes:vars]
foo_var=true
[appnodes]
appnodes[1:3].example.com
[proxies:vars]
bar_var=true
[proxies]
proxies[1:3].example.com
Previously the deployment_type variable would be out of scope for
both the appnodes and proxies groups. This patch fixes that.
Signed-off-by: Adam Miller <maxamillion@fedoraproject.org>
* allow multiple values per key in name fields in openssl_certificate
* check correct side of comparison
* trigger only on lists
* add subject parameter to openssl_csr
* fix key: value mapping not skipping None elements
* temporary fix for undefined "subject" field
* fix iteration over subject entries
* fix docs
* quote sample string
* allow csr with only subject defined
* fix integration test
* look up NIDs before comparing, add hidden _strict params
* deal with empty issuer/subject fields
* adapt integration tests
* also normalize output from pyopenssl
* fix issue with _sanitize_inputs
* don't convert empty lists
* workaround for pyopenssl limitations
* properly encode the input to the txt2nid function
* another to_bytes fix
* make subject, commonname and subjecAltName completely optional
* don't compare hashes of keys in openssl_csr integration tests
* add integration test for old API in openssl_csr
* compare keys directly in certificate and publickey integration tests
* fix typo
This fix adds following:
* Documentation update
* Add support for DHCP
* Refactor code to use PyVmomi class
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* firewalld: Implement zone operations
Zones are removed or added when no other operations are used in
conjunction with the keywords 'present' or 'absent'.
This leads to a logical and natural syntax of:
- firewalld:
zone: foo
state: present
for adding or removing zones.
Signed-off-by: Felix Kaechele <felix@kaechele.ca>
* firewalld: zone ops: addressed review concerns
- Added more documentation on the peculiarities of the zone operations
- Output meaningful error messages when trying to use zones incorrectly
Signed-off-by: Felix Kaechele <felix@kaechele.ca>
* ACI Encap Pool: Add new module to support VLAN, VXLAN, and VSAN Pools
* update logic for allocation_mode
* update docstring and tests
* Update filter_target since url method has been updated
This fix removes a deprecated Postgresql User role attribute
called 'CREATEUSER' and 'NOCREATEUSER'. Also, updated documentation
for deprecation.
Fixes: #24928
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
On Fedora Atomic Host, there is no yum or dnf, but the module ot use to
install package should be atomic_container. We verify that this is
a Fedora Atomic Host with rpm-ostree, not atomic since atomic
can be used on a regular non ostree distribution.
* Fix _clean_result for debug callback with 1 char var names
The check in _clean_results was removing any keys that happened
to be one of the chars in ('invocation') instead of the string
'invocation'. This was meant to be a tuple but there was no comma
so the for iterated the string instead of the tuple.
Introduced in 9dba580204
Update unit test to catch this.
Fixes#33723
* Use .pop() to remove invocation from results dict
In base callback _clean_results, simplify the way the
'invocation' item is removed.
Add some more unit tests.
* Deprecate Entity, EntityCollection and use subspec in network modules
* As per proposal https://github.com/ansible/proposals/issues/76
deprecate use of Entity, EntityCollection, ComplexDict, ComplexList
and use subspec instead.
* Refactor ios modules
* Refactor eos modules
* Refactor vyos modules
* Refactor nxos modules
* Refactor iosxr modules
* Add support for key in suboptions handling
* Fix CI issues
* Refactor cloudscale API code
Move code common to all cloudscale cloud modules into a common base
class.
This is needed as a prepartion of the cloudscale_floating_ip module.
* cloudscale_floating_ip module
New cloud module to manage floating IPs on the cloudscale.ch IaaS
service.
* Update zabbix_host documentation (extend ipmi_-documentation, and update style to be consistent on the rest while we are at it)
* Remove ipmi_parameters being added to the API call when not required
* remove optional parameters from add_host, as well
Fix a bunch of things mentioned in the review.
Delete commented code from module. Add fix for vcsim not returning
uncommitted.
Add integration test.
Add changes suggested
* A first pass at moving libs to new dir structure
The network modules changed their module_utils dir structure.
This first patch establishes mod utils for F5 in this new structure.
Module use will be limited until things are more fleshed out
* Fixing upstream errors
* Fixing more issues
The command module docs were unclear. They talked about ignoring the user's environment which lead people to believe the user's environment variables were not used. In actual fact, the user's environment variables are used. They just are not expanded in the command.
* Bulk pep8 fixes - hand crafted
Fix by hand the remaining issues that autopep8 couldn't
* Next batch of hand crafted pep8 fixes
* Ignore W503
https://github.com/PyCQA/pycodestyle/pull/499
* Revert more of W503
* python3 support for letsencrypt module (fixes#30690)
* initialize result to a dict in some methods to prevent 'NoneType is not iterable' TypeError
* use dict.get() to retrieve values from info dict to prevent KeyError
* convert to/from text/bytes using _text methods for PY3 support
* Fail when attempting to modify unmodifiable target group parameters
As you can't modify Port, Protocol or VPC id for a target group, fail
when this happens rather than pretending to do it.
One could argue that the target group could be recreated rather than
failing, but this has massive knock on implications to other resources
that depend on the TG (all ASGs would need to be updated, the ELB
listener would need to be updated, etc)
* Use `.get()` instead of direct dictionary access
* Added modules to create, delete, and describe EC2 Placement Groups.
* Remove unnecessary print statement
* Update to use boto3.
* De-linting
* Remove facts from this PR
* Update to newer method of handling Boto3 connections and exceptions.
* Futzing around with imports and HAS_BOTO3
* Fix up exception imports.
* Remove redundant default.
* Handle DryRunOperation errors appropriately.
* Remove redundant BOTO3 check.
* Use shorter licence declaration.
* Remove redundant HAS_BOTO3 import.
* Add AWSRetry decorators to API calls.
* Add new 'strategy' parameter to allow for cluster and spread PGs.
`ansible-vault` is the only cli command which knows how to handle the
rekey options `--new-vault-id` and `--new-vault-password-file`. No
point in exposing those rekey options to any of the other ansible
commands.
On a practical level I think this matters most in ensuring that
`--help` doesn't produce any false/unhelpful output.
* fixes guess_os for netconf connections
This change fixes invalid calls to play_context when the network_os is
not set and the connection attempts to guess the network_os. The method
will now check the correct values for ssh key file and allow agent
instead of returning errors.
* fix up pep8 issues
* Zabbix 3.4 support fix.
As of 3.4 Zabbix version application does not have 'updateExisting'.
* added updateExisting in applications for old zabbix support.
* small codestylefix
This fix adds following:
* hosts as argument spec
* cluster_name as argument spec
* refactor to use Pyvmomi class
* API refactor and documentation
Fixes: #18980
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* add acr
* acr
* acr
* fix a minor error
* add tests and fixes as suggested
* use get_mgmt_svc_client to enable bi
* fixes as zim suggested
* code refinement
* get acr instance before update
* fix a bug
* remove Classic sku as it's going to deprecate
* pass sanity test
* fix sanity
* fixes based on comments
* fix broken namespace unregistered error
* fix a bug
* fix a bug
* fix
* add register namespace
* fixes tests
* remove pdb
* add ci azure test
* removed required: false
* renamed acr -> containerregistry
* fixed spelling mistake
* fixed idempotence
* fix for idempotence was wrong
* fixed a few issues
* different log when exception different than ResourceNotFound
* self.fail instead of log
* updated sample return value
* added login server in results
* fixed else
* fixed line too long
* cmp -> __ne__
* fixed trailing whitespace
* output.changed is false when instance updated
* fix for state change
* one more update
* update instance only when location or sku has changed
* fixed syntax error
* fixed acr test
* just removed unnecessary comment to trigger ci
* update return value shape
* flatten `state`
* change credential dictionary state
* add credentials to integration tests
* fixed: win_copy: typo "file file" (double "file")
Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
* Add quotes around filenames/directories
* Fix tests for new quotes
* Fix tests for new quotes
* One more ?
* Another one...
* Added module to describe EC2 Placement Groups.
* Update to newer way of handling Boto3 connections and exceptions.
* Futzing around with imports and HAS_BOTO3
* Fix up exception imports.
* Fix license block
* Correct task indenting in doc
* Added list-filtering example to docs
Without this additional code snippet `ansible-pull` will still accept
the `--vault-id` option. It just won't pass the option along when
invoking `ansible-pull`.
* - Netconf plugin addition for iosxr
- Utilities refactoring to support netconf and cliconf
- iosx_banner refactoring for netconf and cliconf
- Integration testcases changes to accomodate above changes
* Fix sanity failures, shippable errors and review comments
* fix pep8 issue
* changes run_command method to send specific command args
* - Review comment fixes
- iosxr_command changes to remove ComplexDict based command_spec
* - Move namespaces removal method from utils to netconf plugin
* Minor refactoring in utils and change in deprecation message
* rewrite build_xml logic and import changes for new utils dir structure
* - Review comment changes and minor changes to documentation
* * refactor common code and docs updates
In case of workflow delete action, the returned 404 status code
considered as invalid although it's a valid code for not found (deleted)
entity.
Removed verification of the status. Only success should be verified.
Fixes#33524
* Fix typo in net_logging/eos
* This seems to be required to use eos_user in this way
* Fix indentation in net_static_route/eos
* Rework interface check in eos_vrf
This should do the right thing.
This fix make error message easily understable which is provided
by vcenter or ESXi server.
Fixes: #24672
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* Adds a tmsh command fallback
The bigip terminal plugin assumes that the remote shell is tmsh.
This is not always true. The remote shell may be bash sometimes.
This adds a different shell command in the case that bash is the
remote shell
* Fixing upstream errors
This fix adds functionality to configure vmware guest parameter called
'maxMkconnections'. Also, added integration test for this change.
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This fix adds functionality to support memory_reservation and
memory_reservation_lock while managing Virtual Machine.
Fixes: #20407
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This fix adds missing comma in different modules.
This removes implicit string concatenation in given list.
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This fix adds additional check to get details about roles
from pg_roles instead of pg_authid. On AWS RDS instances,
access to pg_authid is restricted for security reasons.
Fixes: #32358
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* Fix azure_rm_acs due to Azure breaking API change
* resolve code review feedbacks
* resolve test failures
* better name
* ignore case for vm size
* reformat code
* resolve code review feedbacks
* new windows module win_audit_policy_system
* removed the backup/restore functionality
adjusted to use run-command rather than running the command directly
adjusted testing appropriately for the above changes
* fixed issue with variable naming in testing
removed .psm1 from requires
fixed copyright
* Updated audit_type to list and added appropriate error handling
Updated testing accordingly
Fixed up documentation
* Refactor common network shared and platform specific code into package (part-1)
As per proposal #76 refactor common network shared and platform specific
code into sub-package.
https://github.com/ansible/proposals/issues/76
* ansible.module_utils.network.common - command shared functions
* ansible.module_utils.network.{{ platform }} - where platform is platform specific shared functions
* Fix review comments
* Fix review comments
* Refactors bigip_node
Includes a number of fixes and enhancements in addition to refactoring
the code to be inline with f5 standards
* Fixes upstream errors
Digital Ocean changed their api to no longer accept an integer as a resource_id. Fix adds changed data type (from integer to string).
Signed-off-by: Anthony Bond <bond.anthony@outlook.com>
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* Adds bigip_policy_rule module
This module is the second component of managing LTM policies on
BIG-IP. This module lets you manage the rules of a policy
* Fixing upstream errors
* Correcting YAML errors
* Fixes and features for bigip_provision
Adds support for dedicated modules. Fixes bug in minimum name.
Adds wrappers around checking for up-ness so that they will contribute
to the watch loop
* Fixes upstream errors
This fixes an issue where the check for an import error would occur
before checking to see if firewalld is in "offline mode" and if it
is, then checking to ensure the version of the firewall python
library was new enough to support offline operations. This patch
will now fail with a correct error message in the scenario that
someone attempts to perform an offline operation but has a version
of the firewall python library that is too old.
Signed-off-by: Adam Miller <maxamillion@fedoraproject.org>
This fix makes name and folder as required together
parameters in vmware_guest_snapshot.
Update integration tests for vmware_guest_snapshot.
Fixes: #22644
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
Fix adds esxi_hostname as Ansible module argument for user
to define ESXi hostname to deploy VMware vSwitch.
Fixes: #24647
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* In order to maintain a single api call across
netconf and cli transport from module code change
signature of commit api to accept genric args.
* Fix doc string
Empty __init__ will allow us to use python namespaces with all of these
files. That may be something we want to take advantage of for allowign
them to be expanded by user dirs. Also might be needed for AnsiballZ or
other wrapper enhancements in the future.
* Add idempotency and import/export support to zabbix_template
Adds idempotency to the template update functions and check mode,
also adds the ability to dump and import json template
configurations.
* Fix issue clearing groups from template
When an empty list is provided for group names, all groups associations
should be cleared from the template. Previous behavior caused the
template to be associated to all existing groups if an empty list
was provided.
* Fix undefined variable references
* Add example importing template from ansible variable
Document a sample template import with bare minimum structure.
No items or graphs are added, only 1 application is added to the
template.
* Added . and / to rule args regexp
Things like pam_echo.so file=/etc/foo.txt weren't being matched and
causing incorrect change counts. Adding / and . fixed that.
Fixes#33351
* pamd: test argument with value
Relates #33351
Fixes#33406Fixes#33405
* Fix typo in network_cli for sendonly
* Send `abort` to remote device in case configuration fails
* Fix indentation issue in eos_static_route integration test
* Revert network_cli change
All the values currently documented as return values are returned inside a 'result' key.
So if you registered the output of the task as 'output', then you would need to do 'output.result.zone_id' instead of 'output.zone_id'.
This commit fixes that so that you can do 'output.zone_id'.
This fix adds support for hardware parameter 'numCoresPerSocket'
in vmware_guest module. Also, adds integration tests for this change.
Fixes: #20406
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
'true' needs to be quoted as a string, otherwise it is stored as boolean and ends up getting capitalized to 'True' when presented to debconf
Subsequent install of oracle-java8-installer fails with "oracle-license-v1-1 license could not be presented"
ansible version: 2.3.1.0
Actual: value: true
debconf-show oracle-java8-installer
* shared/accepted-oracle-license-v1-1: True
Expected: value: 'true'
debconf-show oracle-java8-installer
* shared/accepted-oracle-license-v1-1: true
Various fixes to correct the BIG-IQ sdk args, and remove common
bigip stuff if requested in bigiq modules. Will move this to
separate module includes at a later time.
* Adding module enos_config and its UT files
* Removing trailing line
* Removing trailing lines
* Editing enos_module.py to fix build errors
* Removing blank lines in end
* Updating enos_config.py based on review comments
* Adding one more blank line
* Removing training white space
* Removing test_enos_config_force method from UT
* Updating documentation
* Comments by John, Remove version_added: "2.5"
* Refactor VyOS to use cliconf
* Use show configuration commands on get_config
* Remove debug statement
* Construct command/answer/prompt if needed and fix commit comments
* Convert command/prompt/answer to bytes
Set hw_guest_ha_state as None if `vm.summary.runtime.dasVmProtection` isn't printable/json-able. So if vm.summary.runtime.dasVmProtection is defined, return
vm.summary.runtime.dasVmProtection.dasProtected.
* check if need update for internal port
* validate port ip
* os_router modified in local
* my_os_router.py tested upto port not found
* tested need update
* default port attached with subnet getting deleted
* update happened with subnet and port id but rerun update=true?
* update working with portid converted subnetid for match checking
* tested and worked
* extra debug commnets cleaned up
* os_router with port ip tested fine
* deleted test files used wq for my development
* interface type changed for backward compatibility
* check if need update for internal port
* validate port ip
* os_router modified in local
* my_os_router.py tested upto port not found
* tested need update
* default port attached with subnet getting deleted
* update happened with subnet and port id but rerun update=true?
* update working with portid converted subnetid for match checking
* tested and worked
* extra debug commnets cleaned up
* os_router with port ip tested fine
* deleted test files used wq for my development
* check if need update for internal port
* validate port ip
* os_router modified in local
* my_os_router.py tested upto port not found
* tested need update
* default port attached with subnet getting deleted
* update happened with subnet and port id but rerun update=true?
* update working with portid converted subnetid for match checking
* tested and worked
* extra debug commnets cleaned up
* os_router with port ip tested fine
* deleted test files used wq for my development
* interface type changed for backward compatibility
* interface type changed for backward compatibility
* restoring requirement.txt which was deleted accidentally
* isinstance instead of type and white space removal
* trailing spaces removal
* multiple space after keyword 379,441
* fail.json interface type and deug msg changes
* test for membership should be 'not in'
* reorder interfaces handling for force=no, making sure it works when no interfaces are specified in the module parameters
when no interfaces are specified on update, use existing interfaces obtained from API.
check whether visible_name is set in check_all_properties; if not set as module parameter, no comparison is necessary.
Check if description is set as module parameter before comparing as well
* link_templates need the same treatment
* add inventory update checks and simplify update procedure
* make specifying proxy optional on update (keeping it as is when not specified), as well
* pep8 fixes
* add tls_*-checks for updates and make tls_*-options actually optional
* Add netscaler_nitro_request module
* Make changes as requested.
* Fix whitepsace in EXAMPLES block.
* Set module changed status according to operation performed.
* Added support to Datacenter resources in HPE OneView
* Adjusting comments in oneview_datacenter_facts
* Adding no_log on the documentation
* Using Pytest to Oneview DatacenterFactsModule tests
This fix adds debugging details for 'no folder found' error.
This will allow to debug the user's setup easily.
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
Currently the check() method for idempotence only assumes the public
key is under the form of a PEM file when its not always the case.
The module openssl_publickey allows one to generate OpenSSH format
publickey. This leads to idempotence not being detected.
Removing 'md5' checksum checking as simply comparing current and desired publickey does the expected job.
Signed-off-by: Satyajit Bulage <sbulage@redhat.com>
* Warn on tests used as filters
* Update docs, add aliases for tests that fit more gramatically with test syntax
* Fix rst formatting
* Add successful filter, alias of success
* Remove renamed_deprecation, it was overkill
* Make directory alias for is_dir
* Update tests to use proper jinja test syntax
* Update additional documentation, living outside of YAML files, to reflect proper jinja test syntax
* Add conversion script, porting guide updates, and changelog updates
* Update newly added uses of tests as filters
* No underscore variable
* Convert recent tests as filter changes to win_stat
* Fix some changes related to rebasing a few integration tests
* Make tests_as_filters_warning explicitly accept the name of the test, instead of inferring the name
* Add test for tests_as_filters_warning
* Update tests as filters in newly added/modified tests
* Address recent changes to several integration tests
* Address recent changes in cs_vpc
locale.setlocale() call removed in 6b5291d68f
is actually needed by time.strptime(). AnsibleModule() changes both: environment
variables and python level locale settings so both need to be reset.
All crypto modules uses file common arguments to specify generated file
permissions. This commits aims to add the extends_documentation_fragment
in the doc so it is automatically stated.