Validating the version of python-dateutil

This commit is contained in:
John Westcott IV 2020-05-20 14:41:43 -04:00
parent cc037cb4b5
commit a4ec6f6763

View File

@ -10,7 +10,7 @@ DOCUMENTATION = """
short_description: Generate an rrule string which can be used for Tower Schedules
requirements:
- pytz
- python.dateutil
- python.dateutil >= 2.8.1
description:
- Returns a string based on criteria which represent an rule
options:
@ -101,6 +101,13 @@ try:
except ImportError:
missing_modules.append('python.dateutil')
# Validate the version of python.dateutil
try:
import dateutil
dateutil.__version__
except Exception:
missing_modules.append('python.dateutil>=2.8.1')
if len(missing_modules) > 0:
raise AnsibleError('You are missing the modules {0}'.format(', '.join(missing_modules)))