-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
Type aliases for all the things #94
base: master
Are you sure you want to change the base?
Conversation
81df1fb
to
e9ef7f8
Compare
* Introduces type aliases for (most) variables to do some error checking. * Fix examples given by the unit test helper to match expected values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks gorgeous!
What about tests for the types? |
Good idea, I'll write up a couple tomorrow. |
String $service_name = $bareos::client_service_name, | ||
String $service_ensure = $bareos::service_ensure, | ||
Boolean $service_enable = $bareos::service_enable, | ||
String $config_dir = "${bareos::config_dir}/bareos-fd.d" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably want Stdlib::Absolutepath
if this will also be an absolute path.
Boolean $manage_package = $bareos::manage_package, | ||
Variant[String, Array[String]] $package_name = $bareos::client_package_name, | ||
String $package_ensure = $bareos::package_ensure, | ||
String $service_name = $bareos::client_service_name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably want String[1]
unless the code specifically is meant to handle empty strings ''
# @summary Size definition | ||
# @author Tobias @towo Wolter <[email protected]> | ||
# @see https://docs.bareos.org/Configuration/CustomizingTheConfiguration.html#datatypesize | ||
type Bareos::Size = Pattern[/(?i:^(\d+(\.\d+)?)\W*(k|kb|m|mb|g|gb)$)/] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These regular expressions should have comments that explain what they are attempting to match.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And for this you can borrow some tests in the bacula module 😉 :
https://github.com/xaque208/puppet-bacula/blob/master/spec/type_aliases/size_spec.rb
@towo can you please rebase? |
Pull Request (PR) description
Introduces type aliases for all the classes.
Will remove type checking from the provider.
This Pull Request (PR) fixes the following issues
n/a