I'm working a bit in the deep end right now so maybe this will resolve itself.
I'm testing on RHEL 9.3 beta using a freeipa master build and a pki master build.
Running any IPA command spews an error like:
ipa: ERROR: unable to parse cookie header '['ipa_session=MagBearerToken=49wkpsKLo%2fBJbRp7neej1I1%2bxg4p1ljLp5eyZC6lu%2b1Q4cjwGbLV7t5PO8wkNsyNqa%2fYV6ZGXZC9AlXYjR2kfHAQo31rKwiBmQcqDZUiBIk%2bPN%2bcWZuA1VY5PwAhVkjLoi%2bPAjmmg2h9cU2LGqLY5UaiOLVAFieHaYizgfbN1E%2feDD%2fzubkCgpkhP0meG4RyO0c4D%2bmmyxcATH%2bLPed%2bbg%3d%3d;path=/ipa;httponly;secure;']': module 'datetime' has no attribute 'UTC'
$ python3 Python 3.9.18 (main, Sep 7 2023, 00:00:00) [GCC 11.4.1 20230605 (Red Hat 11.4.1-2)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import datetime >>> datetime.UTC Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: module 'datetime' has no attribute 'UTC' >>> datetime.timezone.utc datetime.timezone.utc
$ python3 Python 3.11.5 (main, Aug 28 2023, 00:00:00) [GCC 12.3.1 20230508 (Red Hat 12.3.1-1)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import datetime >>> datetime.UTC datetime.timezone.utc
python3-3.9.18-1.el9_3.x86_64 dogtag-pki-server-11.5.0-0.1.alpha1.20230922074034UTC.02a77e48.el9.noarch ipa-server-4.12.0.dev202309261714+git8ca7d491c-0.el9.x86_64
I replaced datetime.UTC with datetime.timezone.utc in ipapython/cookie.py and ipalib/rpc.py and that resolved the issue. I'm not 100% sure this is the right thing as I don't know why datetime.UTC was added to the python module, not IPA (or when).
datetime.UTC is new in Python 3.11. See https://docs.python.org/3/library/datetime.html#constants
datetime.UTC
I think it is safe to use datetime.timezone.utc instead.
datetime.timezone.utc
The problem is that the old one is going to be retired in Python 3.13. We see a lot of deprecation warnings in Fedora now: https://pagure.io/freeipa/issue/9425
I think we need a wrapper that covers python 3.9/3.12 differences...
So I looked in detail and we have an option, although a bit verbose one.
I submitted https://github.com/freeipa/freeipa/pull/7018 to solve it.
Just to mention, this is the same solution @rjeffman pointed to. Just I was quicker with a PR. ;)
Metadata Update from @abbra: - Issue assigned to abbra
Metadata Update from @abbra: - Issue set to the milestone: FreeIPA 4.11
master:
ipa-4-11:
Metadata Update from @rcritten: - Issue close_status updated to: fixed - Issue status updated to: Closed (was: Open)
ipa-4-10:
Log in to comment on this ticket.