-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from pillarsdotnet/master
Add types for parameter validation.
- Loading branch information
Showing
28 changed files
with
159 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<% | Array[String] $users | %> | ||
<% | Array[Cron::User] $users | %> | ||
|
||
# Managed by Puppet | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Valid $date (day of month) parameter to Cron::Job. | ||
type Cron::Date = Variant[ | ||
Integer[1,31], | ||
Pattern[/\A(([1-9]|[1-2][0-9]|3[0-1])|(\*|(([1-9]|[1-2][0-9]|3[0-1])-([1-9]|[1-2][0-9]|3[0-1])))(\/([1-9]|[1-2][0-9]|3[0-1]))?)\z/] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Valid .deb version string. | ||
# See https://www.debian.org/doc/debian-policy/#s-f-version | ||
type Cron::Deb_version = Pattern[/(?i:\A(((0|[1-9][0-9]*):)?[0-9]([a-z0-9.+-~]*|[a-z0-9.+~]*-[a-z0-9+.~]+))\z)/] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Valid $environment parameter to Cron::Job. | ||
type Cron::Environment = Array[Pattern[/(?i:\A[a-z_][a-z0-9_]*=[^\0]*\z)/]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Valid $hour parameter to Cron::Job. | ||
type Cron::Hour = Variant[ | ||
Integer[0,23], | ||
Pattern[/\A(([0-9]|1[0-9]|2[0-3])|(\*|(([0-9]|1[0-9]|2[0-3])-([0-9]|1[0-9]|2[0-3])))(\/([1-9]|1[0-9]|2[0-3]))?)\z/] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Valid $ensure parameter to Cron::Job. | ||
type Cron::Job_ensure = Enum['absent', 'present'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Valid $title parameter to Cron::Job. | ||
# This is the name of the /etc/cron.d/ file. | ||
# The Ubuntu run-parts manpage specifies (^[a-zA-Z0-9_-]+$). | ||
# For Cronie, the documentation is (unfortunately) in the code: | ||
# - Ignore files starting with "." or "#" | ||
# - Ignore the CRON_HOSTNAME file (default ".cron.hostname"). | ||
# - Ignore files whose length is zero or greater than NAME_MAX (default 255). | ||
# - Ignore files whose name ends in "~". | ||
# - Ignore files whose name ends in ".rpmsave", ".rpmorig", or ".rpmnew". | ||
# We will use the most restrictive combination. | ||
# See http://manpages.ubuntu.com/manpages/zesty/en/man8/run-parts.8.html | ||
# See https://github.com/cronie-crond/cronie/blob/master/src/database.c#L625 | ||
type Cron::Jobname = Pattern[/(?i:\A[a-z0-9_-]{1,255}\z)/] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Valid $minute parameter to Cron::Job. | ||
type Cron::Minute = Variant[ | ||
Integer[0,59], | ||
Pattern[/\A(([0-9]|[1-5][0-9])|(\*|(([0-9]|[1-5][0-9])-([0-9]|[1-5][0-9])))(\/([1-9]|[1-5][0-9]))?)\z/] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Valid $mode parameter to Cron::Job. | ||
type Cron::Mode = Pattern[/\A[0-7]{4}\z/] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Valid $month parameter to Cron::Job. | ||
type Cron::Month = Variant[ | ||
Cron::Monthname, | ||
Integer[1,12], | ||
Pattern[/\A(([1-9]|1[0-2])|(\*|(([1-9]|1[0-2])-([1-9]|1[0-2])))(\/([1-9]|1[0-2]))?)\z/] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Short-names for each month. | ||
type Cron::Monthname = Enum['Jan','Feb','Mar','Apr','May','Jun', | ||
'Jul','Aug','Sep','Oct','Nov','Dec'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Valid $service_ensure parameter to Cron. | ||
type Cron::Package_ensure = Variant[Cron::Package_state,Cron::Deb_version,Cron::Rpm_version] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Valid $ensure parameter to Package resource. Excludes version numbers. | ||
type Cron::Package_state = Enum['absent', 'installed', 'held', 'latest', 'present', 'purged'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Valid .rpm version string. | ||
# See http://www.perlmonks.org/?node_id=237724 | ||
type Cron::Rpm_version = Pattern[/\A[^-]+(-[^-])?\z/] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Valid $second parameter to Cron::Job. | ||
type Cron::Second = Cron::Minute |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Valid $service_enable parameter to Cron. | ||
type Cron::Service_Enable = Variant[ | ||
Boolean, | ||
Enum['manual','mask'] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Valid $service_ensure parameter to Cron. | ||
type Cron::Service_ensure = Variant[ | ||
Boolean, | ||
Enum['running','stopped'] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Valid $special parameter to Cron::Job. | ||
type Cron::Special = Optional[ | ||
Enum['@annually', | ||
'@daily', | ||
'@hourly', | ||
'@midnight', | ||
'@monthly', | ||
'@reboot', | ||
'@weekly', | ||
'@yearly', | ||
] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Valid $user parameter to Cron::Job. | ||
type Cron::User = Pattern[/(?i:\A\w[a-z0-9_-]{0,30}[a-z0-9_$-]\z)/] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Valid $weekday parameter to Cron::Job. | ||
type Cron::Weekday = Variant[ | ||
Cron::Weekdayname, | ||
Integer[0,7], | ||
Pattern[/\A([0-7]|(\*|([0-7]-[0-7]))(\/[1-7])?)\z/] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Short names for each day of the week. | ||
type Cron::Weekdayname = Enum['Sun','Mon','Tue','Wed', | ||
'Thu','Fri','Sat'] |