-
-
Notifications
You must be signed in to change notification settings - Fork 152
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
Use data types instead of validate functions #163
Conversation
manifests/lvs/real_server.pp
Outdated
String[1] $virtual_server, | ||
Stdlib::IP::Address $ip_address, | ||
Stdlib::Port $port, | ||
Hash $options = {}, |
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.
Looking at https://github.com/voxpupuli/puppet-keepalived/blob/master/templates/_format_options.erb it looks like we can have a defined type type Keepalived::Options = Hash[String, Variant[Hash, String, Boolean]]
. Technically the latter Hash is a Keepalived::Options
but I don't know if Puppet supports recursive types.
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.
I think it'd need to be
Keepalived::Options = Hash[String, Variant[Hash, String, Boolean, Integer]]
'weight' => 1, |
Not sure it's worth it.
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.
Hash[String, Any]
then?
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.
Sure, ok. I'd imagine 90% of the times where we're currently using Hash
we could use this instead. It's probably quite rare to use anything other than a string as the hash key.
The primary aim of this PR was just to get rid of the validate functions. There are a few classes that still have no types at all.
Stdlib::Filemode $config_dir_mode = $keepalived::params::config_dir_mode, | ||
Stdlib::Filemode $config_file_mode = $keepalived::params::config_file_mode, | ||
|
||
String[1] $config_group = $keepalived::params::config_group, |
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.
Why not Variant[String[1], Integer]
? This will permit to use GID also .
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.
It might be very rare anyone wants to do this and GID as a string does already work. Dunno if it just complicates the type with no real benefit.
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.
I am thinking about this because with root i always use 0.
But i am fine also with KIS.
9d6539d
to
79a878e
Compare
I'll merge #162 first (after it goes green), then rebase this. |
79a878e
to
5ce7c9e
Compare
This is a breaking change as several parameters now only accept integers instead of strings. Fixes voxpupuli#159
This is a breaking change as several parameters now only accept integers
instead of strings.
Fixes #159