[openstack-dev] [puppet] Parameters possible default value
Sebastien Badia
sbadia at redhat.com
Thu Jul 30 10:31:33 UTC 2015
On Mon, Jul 27, 2015 at 09:43:28PM (+0000), Andrew Woodward wrote:
> Sorry, I forgot to finish this up and send it out.
>
> #--SNIP--
> def absent_default(
> $value,
> $default,
> $unset_when_default = true,
> ){
> if ( $value == $default ) and $unset_when_default {
> # I cant think of a way to deal with this in a define so lets pretend
> # we can re-use this with multiple providers like we could if this was
> # in the actual provider.
>
> keystone_config {$name: ensure => absent,}
> } else {
> keystone_config {$name: value = $value,}
> }
> }
>
> # Usage:
> absent_default{'DEFAULT/foo': default => 'bar', value => $foo }
Hi,
Hum, but you want to add this definition in all our modules, or directly in
openstacklib?
In case of openstacklib, in which manner do you define the <component>_config
resource? (eg, generic def, but specialized resource).
> #--SNIP--
>
> (I threw this together and haven't tried to run it yet, so It might not run
> verbatim, I will create a test project with it to show it working)
>
> So In the long-term we should be able to add some new functionality to the
> inifile provider to simply just do this for us. We can add the 'default'
> and 'unset_when_default' parameter so that we can use them straight w/o a
> wrapping function (but the warping function could be used too). This would
> give us the defaults (I have an idea on that too that I will try to put
> into the prototype) that should allow us to have something that looks quite
> clean, but is highly functional
>
> > Keystone_config{unset_when_default => true} #probably flatly enabled in
> our inifile provider for the module
> > keystone_config {'DEFAULT/foo': value => 'bar', default => 'bar'}
I'm not sure to see the difference with the Yanis solution here¹, and not sure
to see the link between the define resource and the type/provider resource.
Seb
¹https://review.openstack.org/#/c/202574/
--
Sebastien Badia
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20150730/81e796c4/attachment.pgp>
More information about the OpenStack-dev
mailing list