freeipa / ansible-freeipa

Ansible roles and modules for FreeIPA
GNU General Public License v3.0
495 stars 233 forks source link

ipauser: Use date string, not datetime object for expiration dates #1268

Closed t-woerner closed 1 week ago

t-woerner commented 3 months ago

So far a datetime object was created for the expiration dates krbpasswordexpiration and krbprincipalexpiration. This resulted in also sending these objects to the API. With this change, the dates are converted into strings using the LDAP_GENERALIZED_TIME_FORMAT defined in ipalib.constants. This way only strings are used with the IPA API.

A new function has been added to ansible_freeipa_module:

This fuction is used on the result of user_show to convert the expiration dates to the gernalized time format string.

The existing function date_format in ansible_freeipa_module has been renamed to convert_date and fixed in the way that it also uses date_string to return a gernalized time format string and not a datetime object. This function was only used in the ipauser module so far.