[PR #9186/a863b628 backport][stable-8] fixing broken check mode in the github_key (#9203)

fixing broken check mode in the github_key (#9186)

* fixing datetime.strftime()

* added changelog fragment

* Update changelogs/fragments/9186-fix-broken-check-mode-in-github-key.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit a863b62859)

Co-authored-by: tomcperry <99128358+tomcperry@users.noreply.github.com>
pull/9244/head
patchback[bot] 2024-11-28 20:06:18 +01:00 committed by GitHub
parent f35d238f25
commit b1d21aaad8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View File

@ -0,0 +1,2 @@
bugfixes:
- github_key - in check mode, a faulty call to ```datetime.strftime(...)``` was being made which generated an exception (https://github.com/ansible-collections/community.general/issues/9185).

View File

@ -162,7 +162,7 @@ def create_key(session, name, pubkey, check_mode):
'key': pubkey,
'title': name,
'url': 'http://example.com/CHECK_MODE_GITHUB_KEY',
'created_at': datetime.strftime(now_t, '%Y-%m-%dT%H:%M:%SZ'),
'created_at': datetime.datetime.strftime(now_t, '%Y-%m-%dT%H:%M:%SZ'),
'read_only': False,
'verified': False
}