mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00:00
[PR #8222/524d5883 backport][stable-8] Avoid deprecated utcnow() (#8243)
Avoid deprecated utcnow() (#8222)
Avoid deprecated utcnow().
(cherry picked from commit 524d5883b8)
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
@@ -110,7 +110,10 @@ EXAMPLES = '''
|
||||
|
||||
from ansible.module_utils.urls import fetch_url
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from datetime import datetime
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.datetime import (
|
||||
now,
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
@@ -161,8 +164,7 @@ def main():
|
||||
if module.params['environment']:
|
||||
custom_details['environment'] = module.params['environment']
|
||||
|
||||
now = datetime.utcnow()
|
||||
timestamp = now.strftime("%Y-%m-%dT%H:%M:%S.%fZ")
|
||||
timestamp = now().strftime("%Y-%m-%dT%H:%M:%S.%fZ")
|
||||
|
||||
payload = {
|
||||
'summary': module.params['summary'],
|
||||
|
||||
Reference in New Issue
Block a user