* Only change expiration date if it is different
Modify user_info() method to also return the password expiration.
Compare current and desired expiration times and only change if they are different.
* Improve formatting on user tests
* Add integration test for expiration
* Add changelog fragment
* Improve integration test
Skip macOS and use getent module for validating expiration date.
* Fix expiration change for FreeBSD
* Don't use datetime since the total_seconds method isn't available on CentOS 6
* Use better name for expiration index field
Use separate tasks for verifying expiration date on BSD
* Use calendar.timegm() rather than time.mktime()
calendar.timegm() is the inverse of time.gmtime() and returns a timestamp in UTC not localtime
Add tests that change the system timezone away from UTC
* Mark tests as destructive and use test for change status
* Fix account expiration for FreeBSD
Use DATE_FORMAT when setting expiration date on FreeBSD. Previously the argument passed to -e was an integer of days since epoch when the account will expire which was inserted directly into master.passwd. This value is interpreted as seconds since epoch by the system, meaning the account expiration was actually set to a few hours past epoch.
Greatly simply comparing desired and current expiration time by using the first three values of the struct_time tuple rather than doing a whole bunch of manipulations of the seconds since epoch.
So it seems on failure the last raised (but handled) exception is being
added to the task failure result, which makes it often unrelated to the
actual failure.
Since we assumed the exception was always related, using the exception
information for the subject is plain wrong (and let me to debug
completely unrelated ghost issues).
Also the exception details are now moved back in the output. Maybe we
should not show it unless there's no other information ? But at least it
should not be the mail's subject.
Since it will be used outside just AWS modules, this commit moves
`camel_dict_to_snake_dict` and `snake_dict_to_camel_dict` functions into
a new module_utils file under common/ to match their wider usage.
Currently if the ansible-galaxy client fetches a role from a galaxy
server, it then fetches the role from Github. This change allows a
galaxy server to provide an alternate source url that points to an
archive that contains the role version.
* refactor firewalld module, add firewalld module_util
This change is meant to enable the addition of advanced feature
specific firewalld modules that will have different module option
patterns than what fits in the current firewalld module, while
keeping as much common code as possible in the module_util
Signed-off-by: Adam Miller <admiller@redhat.com>
Add the 'localhost_warning' configuration option. When set to 'false',
this will prevent Ansible from issuing a warning when the inventory is
empty and it is using an implicit inventory with only 'localhost'.
Closes#17086
For protocol, it should be a list and all
of the values are expected to be lowercase.
An example is also added to show how to add
both Spice and VNC consoles to a VM.
Under a non-utf-8 locale (for instance, LC_ALL=C), passing a non-ascii
filename to many APIs will traceback. Fix that by explicitly converting
to byte strings before passing to external APIs.
May fix#27262
This fix corrects the comparison of system generated guest_id with
user provided guest_id. Module used to report change even if the
guest_ids were same. For example, user provided guest id rhel7_64guest
and VMware returned guest id rhel7_64Guest are logically same but
lexicographically different and due to this module use to report
change even if there is no change applied.
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* Remove unused `find_entity_child_by_path` API
* Remove unused `fetch_file_from_guest` API as this has separate module
vmware_guest_file_operation
* Remove unused `push_file_to_guest` API as this has separate module
vmware_guest_file_operation
* Refactor exception variables
* Change GPL License boilerplate to one-liner
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* modules/net_tools/ldap: Refactor shared options
* modules/net_tools/ldap: Refactor shared code
* modules/net_tools/ldap: Add ldap_passwd module
* modules/net_tools/ldap/ldap_passwd: More robust change check
* In some deployments, using compare_s results in spurious “changed” results,
while bind is more reliable. The downside is that it results in an extra
connection, and the code it more involved.
* ldap_passwd: Rename methods passwd_[cs]
* ldap_passwd: Remove unecessary type=str
* ldap: Factor-out failure cases
* ldap_passwd: Provide more precise error messages
* ldap_passwd: Irrelevant syntax changes
* ldap_passwd: Rename u_con to tmp_con
* ldap_passwd: Keep HAS_LDAP local
* LDAP doc update
* Resolved all copyright related issues
* Resolved self.fail calls
* Update documentation
Signed-off-by: The Fox in the Shell <KellerFuchs@hashbang.sh>
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* [AWS] report boto3/botocore versions during `fail_json_aws`
When modules call `fail_json_aws` and boto3 is installed, gather the
boto3 and botocore versions so that any new AWS module issues will
include the user's boto3 installation info. This will make debugging
issues where features aren't available yet easier.
* PEP8
* Switch to `dict` rather than tuple returns