Fix sanity errors for collections

This commit is contained in:
beeankha
2021-07-29 16:36:29 -04:00
parent d89719c740
commit e88e81928c
5 changed files with 14 additions and 11 deletions

View File

@@ -169,7 +169,7 @@ class LookupModule(LookupBase):
try:
rrule_kwargs['dtstart'] = LookupModule.parse_date_time(kwargs['start_date'])
except Exception as e:
raise AnsibleError('Parameter start_date must be in the format YYYY-MM-DD [HH:MM:SS]') from e
raise_from(AnsibleError('Parameter start_date must be in the format YYYY-MM-DD [HH:MM:SS]'), e)
# If we are a none frequency we don't need anything else
if frequency == 'none':
@@ -184,7 +184,7 @@ class LookupModule(LookupBase):
try:
rrule_kwargs['until'] = LookupModule.parse_date_time(end_on)
except Exception as e:
raise AnsibleError('Parameter end_on must either be an integer or in the format YYYY-MM-DD [HH:MM:SS]') from e
raise_from(AnsibleError('Parameter end_on must either be an integer or in the format YYYY-MM-DD [HH:MM:SS]'), e)
# A week-based frequency can also take the on_days parameter
if frequency == 'week' and 'on_days' in kwargs:
@@ -208,7 +208,7 @@ class LookupModule(LookupBase):
if my_month_day < 1 or my_month_day > 31:
raise Exception()
except Exception as e:
raise AnsibleError('month_day_number must be between 1 and 31') from e
raise_from(AnsibleError('month_day_number must be between 1 and 31'), e)
rrule_kwargs['bymonthday'] = my_month_day
@@ -216,7 +216,7 @@ class LookupModule(LookupBase):
try:
(occurance, weekday) = kwargs['on_the'].split(' ')
except Exception as e:
raise AnsibleError('on_the parameter must be two words separated by a space') from e
raise_from(AnsibleError('on_the parameter must be two words separated by a space'), e)
if weekday not in LookupModule.weekdays:
raise AnsibleError('Weekday portion of on_the parameter is not valid')