mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 09:27:36 -02:30
Now actually checking the version instead of just getting it
This commit is contained in:
@@ -10,7 +10,7 @@ DOCUMENTATION = """
|
|||||||
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:
|
requirements:
|
||||||
- pytz
|
- pytz
|
||||||
- python.dateutil >= 2.8.1
|
- python.dateutil >= 2.7.0
|
||||||
description:
|
description:
|
||||||
- Returns a string based on criteria which represent an rule
|
- Returns a string based on criteria which represent an rule
|
||||||
options:
|
options:
|
||||||
@@ -89,6 +89,7 @@ from ansible.plugins.lookup import LookupBase
|
|||||||
from ansible.errors import AnsibleError
|
from ansible.errors import AnsibleError
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import re
|
import re
|
||||||
|
from distutils.version import LooseVersion
|
||||||
|
|
||||||
missing_modules = []
|
missing_modules = []
|
||||||
try:
|
try:
|
||||||
@@ -104,9 +105,10 @@ except ImportError:
|
|||||||
# Validate the version of python.dateutil
|
# Validate the version of python.dateutil
|
||||||
try:
|
try:
|
||||||
import dateutil
|
import dateutil
|
||||||
dateutil.__version__
|
if LooseVersion(dateutil.__version__) < LooseVersion("2.7.0"):
|
||||||
|
raise Exception
|
||||||
except Exception:
|
except Exception:
|
||||||
missing_modules.append('python.dateutil>=2.8.1')
|
missing_modules.append('python.dateutil>=2.7.0')
|
||||||
|
|
||||||
if len(missing_modules) > 0:
|
if len(missing_modules) > 0:
|
||||||
raise AnsibleError('You are missing the modules {0}'.format(', '.join(missing_modules)))
|
raise AnsibleError('You are missing the modules {0}'.format(', '.join(missing_modules)))
|
||||||
|
|||||||
Reference in New Issue
Block a user