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

Add cron day of month parameter #146

Merged
merged 3 commits into from
Nov 26, 2018

Conversation

brigriffin
Copy link
Contributor

Pull Request (PR) description

This PR adds support for specifying one or many day(s) of the month when to run the certbot cron. The default is to run everyday (* in cron syntax) and a user can now specify one or multiple days of the month when to run the certbot cron. For example some people prefer to run it twice per month instead of everyday. This is now possible with this PR.

This Pull Request (PR) fixes the following issues

n/a

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense

@@ -44,6 +44,7 @@
Boolean $suppress_cron_output = false,
Optional[String[1]] $cron_before_command = undef,
Optional[String[1]] $cron_success_command = undef,
Optional[Array] $cron_monthday = ['*'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you provide a default, this can just be Array. Should it also be Array[String[1]]?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, we could omit the Optional and have just an Array instead. If we use Array[String[1]] then one needs to specify the days in the cron_monthday parameter as strings like ['1', '15']. [1, 15] will not work because puppet will complain with expects a String value, got Integer. What do you think is better? Having Array or Array[String[1]] ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a fan of strict data types so perhaps Array[Variant[Integer, String[1]]]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't agree more with you. Shall I submit a new commit to this PR including this change?

@brigriffin
Copy link
Contributor Author

@ekohl have a quick look at 500ecf2 when you have a moment. I have now added strict data typing for the cron_monthday param as discussed above.

Boolean $suppress_cron_output = false,
Optional[String[1]] $cron_before_command = undef,
Optional[String[1]] $cron_success_command = undef,
Array[Variant[Integer, String[1]]] $cron_monthday = ['*'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a known minimal/maximal value for the integer? That can also be enforced with:

Suggested change
Array[Variant[Integer, String[1]]] $cron_monthday = ['*'],
Array[Variant[Integer[0, 60], String[1]]] $cron_monthday = ['*'],

See also: https://puppet.com/docs/puppet/5.4/lang_data_number.html#the-integer-data-type

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well spotted! Based on the man page of crontab the integer value can be between 0-59. I will commit the change to this branch in a few minutes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks. I will merge it after it turned green.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cheers 👍

@bastelfreak bastelfreak added enhancement New feature or request needs-work not ready to merge just yet labels Nov 26, 2018
@bastelfreak bastelfreak merged commit 7da495b into voxpupuli:master Nov 26, 2018
@bastelfreak bastelfreak removed the needs-work not ready to merge just yet label Nov 26, 2018
@Dan33l
Copy link
Member

Dan33l commented Jan 14, 2019

@brigriffin Thank you.
Your PR is now released on the puppet forge.

@brigriffin
Copy link
Contributor Author

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants