X Tutup
The Wayback Machine - https://web.archive.org/web/20200708013152/https://github.com/cloudtools/troposphere/issues/1139
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScheduleExpression validator doesn't validate examples provided by AWS #1139

Open
flou opened this issue Sep 4, 2018 · 3 comments
Open

ScheduleExpression validator doesn't validate examples provided by AWS #1139

flou opened this issue Sep 4, 2018 · 3 comments

Comments

@flou
Copy link
Contributor

@flou flou commented Sep 4, 2018

The following schedule expressions should pass validation (taken from AWS docs) 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 "<stdin>", line 1, in <module>
  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 "<stdin>", line 1, in <module>
  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 "<stdin>", line 1, in <module>
  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 *)"
@jonikarppinen
Copy link

@jonikarppinen jonikarppinen commented Sep 5, 2018

Yes. This got broken in 2.3.2 and this change is the culprit: #1114

As quick fix, use troposphere 2.3.1 instead of the latest version.

@markpeek
Copy link
Member

@markpeek markpeek commented Sep 5, 2018

I looked into fixing the regex's last night but the changes were pretty large and would need more scrutiny/testing. I just backed out #1114 and released troposphere 2.3.3.

@ChristopherHackett
Copy link
Contributor

@ChristopherHackett ChristopherHackett commented Sep 6, 2018

The approach I used in #1114 was mostly regex driven but maybe instead the cron string should just get tokenised by regex and each field of the cron handled individually. Tests can be updated to have the right use of - , , and / and (or alternately just reflect the documented examples).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.
X Tutup