<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Thu, Jul 30, 2015 at 3:36 AM Sebastien Badia <<a href="mailto:sbadia@redhat.com">sbadia@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, Jul 27, 2015 at 09:43:28PM (+0000), Andrew Woodward wrote:<br>
> Sorry, I forgot to finish this up and send it out.<br>
><br>
> #--SNIP--<br>
> def absent_default(<br>
>   $value,<br>
>   $default,<br>
>   $unset_when_default = true,<br>
> ){<br>
>   if ( $value == $default ) and $unset_when_default {<br>
>     # I cant think of a way to deal with this in a define so lets pretend<br>
>     # we can re-use this with multiple providers like we could if this was<br>
>     # in the actual provider.<br>
><br>
>     keystone_config {$name: ensure => absent,}<br>
>   } else {<br>
>     keystone_config {$name: value = $value,}<br>
>   }<br>
> }<br>
><br>
> # Usage:<br>
> absent_default{'DEFAULT/foo': default => 'bar', value => $foo }<br>
<br>
Hi,<br>
<br>
Hum, but you want to add this definition in all our modules, or directly in<br>
openstacklib?<br></blockquote><div><br></div><div>I only mocked it up in a puppet define, because its easier for me (my ruby is terrible) It should be done by adding these kinds of extra providers to the inifile provider override that Yanis proposed.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
In case of openstacklib, in which manner do you define the <component>_config<br>
resource? (eg, generic def, but specialized resource).<br>
<br>
> #--SNIP--<br>
><br>
> (I threw this together and haven't tried to run it yet, so It might not run<br>
> verbatim, I will create a test project with it to show it working)<br>
><br>
> So In the long-term we should be able to add some new functionality to the<br>
> inifile provider to simply just do this for us. We can add the 'default'<br>
> and 'unset_when_default' parameter so that we can use them straight w/o a<br>
> wrapping function (but the warping function could be used too). This would<br>
> give us the defaults (I have an idea on that too that I will try to put<br>
> into the prototype) that should allow us to have something that looks quite<br>
> clean, but is highly functional<br>
><br>
> > Keystone_config{unset_when_default => true} #probably flatly enabled in<br>
> our inifile provider for the module<br>
> > keystone_config {'DEFAULT/foo': value => 'bar', default => 'bar'}<br>
<br>
<br>
I'm not sure to see the difference with the Yanis solution here¹, and not sure<br>
to see the link between the define resource and the type/provider resource.<br></blockquote><div><br></div><div>This adds on to Yanis' solution so that we can authoritatively understand what the default value is, and how it should be treated (instead of hoping some magic word doesn't conflict)</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Seb<br>
<br>
¹<a href="https://review.openstack.org/#/c/202574/" rel="noreferrer" target="_blank">https://review.openstack.org/#/c/202574/</a><br>
--<br>
Sebastien Badia<br>
__________________________________________________________________________<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" target="_blank">OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
</blockquote></div></div><div dir="ltr">-- <br></div><div dir="ltr"><p dir="ltr">--</p><p dir="ltr"><span style="font-size:13.1999998092651px">Andrew Woodward</span></p><p dir="ltr"><span style="font-size:13.1999998092651px">Mirantis</span></p><p dir="ltr"><span style="font-size:13.1999998092651px">Fuel Community Ambassador</span></p><p dir="ltr"><span style="font-size:13.1999998092651px">Ceph Community</span></p>
</div>