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

cron - implement all features for special period #38448

Closed
wants to merge 2 commits into from
Closed

cron - implement all features for special period #38448

wants to merge 2 commits into from

Conversation

samuelallan72
Copy link

What does this PR do?

As reported in #38425, previously when the 'special' keyword was used in
states, or 'cron.set_special' module used. This commit merges code for set_job
and set_special behind the scenes, thus implementing all features that were
previously available with setting a job with minute, hour, etc. when 'special'
is used.

The api remains unchanged.

What issues does this PR fix or reference?

ref #38425

Previous Behavior

Use of 'special' keyword disabled use of identifier lines and other useful features that were available when not using 'special'.

New Behavior

Features implemented for when using 'special' keyboard as well.

Tests written?

Please let me know if/what tests should be written.

@samuelallan72
Copy link
Author

This is going to need a lot of testing before considering merging I believe... I have a feeling that something isn't working correctly. I haven't managed to find a case that breaks it yet, but be warned. :)

@cachedout
Copy link
Contributor

@swalladge OK. Keep us posted. :]

@samuelallan72
Copy link
Author

Update: I've started work on a crontab module from scratch, and still deciding what the api should be exactly. The current cron module has some options and such that don't make sense and could be simpler. How open would the saltstack team be to a new crontab module with a new api?

I'm also trying to find advice on how it should behave in cases. (For example how to handle/match jobs where the time is only partially specified, or what to do with existing jobs, etc.)

Keen to hear any feedback or ideas, or even who I could contact about it. :)

@cachedout
Copy link
Contributor

@swalladge I can't say I'm all that excited about changing the API for something like the crontab module without an extremely compelling reason. Could you expound on your reasoning for this?

cc: @gtmanfred @terminalmage @thatch45 @rallytime

@thatch45
Copy link
Member

thatch45 commented Feb 7, 2017

I am going to back up @cachedout here, we should not change the cron module api, I am open to a new module, but we should keep the api

@terminalmage
Copy link
Contributor

Replacing it completely is not something I'm excited to do.

@thatch45
Copy link
Member

thatch45 commented Feb 7, 2017

I should agree with @terminalmage that while I am open to a new module that preserves the api, I would not like to see a complete rewrite.

@cachedout
Copy link
Contributor

Go Go Jenkins!

1 similar comment
@cachedout
Copy link
Contributor

Go Go Jenkins!

@cachedout
Copy link
Contributor

@swalladge Apologies for the extreme delay here. This has some automated tests for the cron state that fail as a result of these changes. Could you take a look? https://jenkins.saltstack.com/job/PR/job/salt-pr-linode-ubuntu14-n/8666/

@cachedout
Copy link
Contributor

Bump @swalladge. Were you able to check the test failures?

@samuelallan72
Copy link
Author

@cachedout sorry I haven't really had the time to look into this. I think the reason tests are failing is because the special time entries now have the identifier comment above them (where they didn't before).

@cachedout
Copy link
Contributor

@rallytime Do you have a minute to peek at this?

@rallytime
Copy link
Contributor

@cachedout Probably not for a couple of days, but I will add it to the list. :)

@rallytime rallytime self-assigned this Mar 22, 2017
@rallytime
Copy link
Contributor

Go Go Jenkins!

@rallytime
Copy link
Contributor

@swalladge Would you be willing to rebase this against the current HEAD of develop? I want to be sure that the failures we're seeing here aren't residual failures from the state of the develop branch back in December, or tests that we need to address in regards to this change. That way I can assess the state of your changes more thoroughly to make sure no test failures sneak in that I thought were not related.

After that, I'd be happy to take a look at the cron test failures, and anything else that might be related so we can get this in. :)

Samuel Walladge and others added 2 commits March 25, 2017 10:09
As reported in #38425, previously when the 'special' keyword was used in
states, or 'cron.set_special' module used. This commit merges code for set_job
and set_special behind the scenes, thus implementing all features that were
previously available with setting a job with minute, hour, etc. when 'special'
is used.

The api remains unchanged.
@samuelallan72
Copy link
Author

Done. The tests I can see failing for unit.states.test_cron are because it no longer uses a 'special' list in the crons dictionary (everything is merged into lst['crons']). I'm not sure what's happening with the unit.modules.test_cron test, but I suspect that's also at least partly due to the 'special' key.

@rallytime
Copy link
Contributor

@swalladge After reviewing these test failures, I think they are actually pointing out a legitimate bug with this change. I don't see anywhere in this change where the special key is being set in the list_tab function as a default, which explains the KeyErrors. Setting the (cron['special'], special) line in _check_cron function to something like (cron.get('special'), special).

Note that this change will cause some other problems with the tests because there are places where the expected default has been changed. For example, the comment return has been changed to None instead of an empty string.

@samuelallan72
Copy link
Author

By the way, I'd forgotten about this... I don't use the crontab module any more because I don't trust it, but rather the files modules to put cron files under /etc/cron.d. Sorry to say I no longer have any motivation to work on this now.

Someone please feel free to close this pr or merge any changes that may be useful. :)

@rallytime
Copy link
Contributor

Thanks for updating this @swalladge - we can always re-open this if you or someone else has time to come back to this.

@rallytime rallytime closed this Mar 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants