cloudtools / cloudtools/troposphere

ScheduleExpression validator doesn't validate examples provided by AWS

Open
#1,139 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
4.9k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

The following schedule expressions should pass validation (taken from [AWS docs](https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html#CronExpressions)) but they raise errors upon validation with `event_schedule_expression`:
```
cron(15 10 ? * 6L 2002-2005)
cron(*/7 5-10 5 * *)
cron(5,35 14 * * ? *)
cron(0 18 ? * MON-FRI *)
cron(0/15 * * * ? *)
cron(0/10 * ? * MON-FRI *)
cron(0/5 8-17 ? * MON-FRI *)
```

```
>>> from troposphere.validators import event_schedule_expression

>>> event_schedule_expression("cron(15 10 ? * 6L 2002-2005)")
Traceback (most recent call last):
File "", line 1, in
File "troposphere/validators.py", line 375, in event_schedule_expression
% expression
ValueError: The following is not a valid expression: "cron(15 10 ? * 6L 2002-2005)"

>>> event_schedule_expression("cron(0/15 * * * ? *)")
Traceback (most recent call last):
File "", line 1, in
File "troposphere/validators.py", line 375, in event_schedule_expression
% expression
ValueError: The following is not a valid expression: "cron(0/15 * * * ? *)"

>>> event_schedule_expression("cron(0/5 8-17 ? * MON-FRI *)")
Traceback (most recent call last):
File "", line 1, in
File "troposphere/validators.py", line 375, in event_schedule_expression
% expression
ValueError: The following is not a valid expression: "cron(0/5 8-17 ? * MON-FRI *)"
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.