mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-20 03:40:22 -07:00
parent
1b8e6bc95b
commit
524d5883b8
19 changed files with 142 additions and 64 deletions
|
@ -151,6 +151,10 @@ import json
|
|||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.urls import fetch_url
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.datetime import (
|
||||
now,
|
||||
)
|
||||
|
||||
|
||||
class PagerDutyRequest(object):
|
||||
def __init__(self, module, name, user, token):
|
||||
|
@ -206,9 +210,9 @@ class PagerDutyRequest(object):
|
|||
return [{'id': service, 'type': 'service_reference'}]
|
||||
|
||||
def _compute_start_end_time(self, hours, minutes):
|
||||
now = datetime.datetime.utcnow()
|
||||
later = now + datetime.timedelta(hours=int(hours), minutes=int(minutes))
|
||||
start = now.strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||
now_t = now()
|
||||
later = now_t + datetime.timedelta(hours=int(hours), minutes=int(minutes))
|
||||
start = now_t.strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||
end = later.strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||
return start, end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue