mirror of
https://github.com/ansible/awx.git
synced 2026-03-29 06:45:09 -02:30
Adding requirements on pytz and python.dateutil for rrule lookup plugin
This commit is contained in:
committed by
beeankha
parent
677ff99eb4
commit
0eb7e22d1f
@@ -8,6 +8,9 @@ DOCUMENTATION = """
|
|||||||
author: John Westcott IV (@john-westcott-iv)
|
author: John Westcott IV (@john-westcott-iv)
|
||||||
version_added: "3.7"
|
version_added: "3.7"
|
||||||
short_description: Generate an rrule string which can be used for Tower Schedules
|
short_description: Generate an rrule string which can be used for Tower Schedules
|
||||||
|
requirements:
|
||||||
|
- pytz
|
||||||
|
- python.dateutil
|
||||||
description:
|
description:
|
||||||
- Returns a string based on criteria which represent an rule
|
- Returns a string based on criteria which represent an rule
|
||||||
options:
|
options:
|
||||||
@@ -85,11 +88,22 @@ _raw:
|
|||||||
|
|
||||||
from ansible.plugins.lookup import LookupBase
|
from ansible.plugins.lookup import LookupBase
|
||||||
from ansible.errors import AnsibleError
|
from ansible.errors import AnsibleError
|
||||||
from dateutil.rrule import rrule, MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY, MO, TU, WE, TH, FR, SA, SU
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import re
|
import re
|
||||||
import pytz
|
|
||||||
|
|
||||||
|
missing_modules = []
|
||||||
|
try:
|
||||||
|
import pytz
|
||||||
|
except ImportError:
|
||||||
|
missing_modules.append('pytz')
|
||||||
|
|
||||||
|
try:
|
||||||
|
from dateutil.rrule import rrule, MONTHLY, WEEKLY, DAILY, HOURLY, MINUTELY, MO, TU, WE, TH, FR, SA, SU
|
||||||
|
except ImportError:
|
||||||
|
missing_modules.append('python.dateutil')
|
||||||
|
|
||||||
|
if len(missing_modules) > 0:
|
||||||
|
raise AnsibleError('You are missing the modules {0}'.format(', '.join(missing_modules)))
|
||||||
|
|
||||||
class LookupModule(LookupBase):
|
class LookupModule(LookupBase):
|
||||||
frequencies = {
|
frequencies = {
|
||||||
|
|||||||
Reference in New Issue
Block a user