[openstack-dev] [puppet] Adding "IPv6" bracket handling utilities in openstacklib.

Sofer Athlan-Guyot sathlang at redhat.com
Thu Jan 7 20:50:04 UTC 2016


Emilien Macchi <emilien at redhat.com> writes:

> On 01/07/2016 01:07 PM, Sofer Athlan-Guyot wrote:
>> Hi,
>> 
>> There are a few places where I would like to be able to check for IPv6
>> address and add bracket to the parameters.  I think that would be a nice
>> addition to the puppet-openstacklib/lib/puppet/parser.
>> 
>> Here the interface I have in mind with the puppet-nova module:
>> 
>> class nova::vncproxy::common (
>>   $vncproxy_host     = undef,
>>   $vncproxy_protocol = undef,
>>   $vncproxy_port     = undef,
>>   $vncproxy_path     = undef,
>> ) {
>> 
>>   include ::nova::deps
>> 
>>   $vncproxy_host_real     = pick(
>>     ipv6_add_bracket_maybe($vncproxy_host,
>>                            $::nova::compute::vncproxy_host,
>>                            $::nova::vncproxy::host,
>>                            false)
>> 
>> 
>> This would returns an array with the host decorated with "[]" if the
>> value is an IPv6 address.  Ideally the function could take only one
>> value and return it or take an array and return an array for seamless
>> integration in the code.
>> 
>> WDYT?
>> 
>
> The design looks okay to me, but on long term I would rather see the
> code in puppetlabs/stdlib rather than in our forge.

Well I can will make a proposal for such a patch afterward and will see
what happen.

> In short term, I agree to have this kind of code in openstacklib.

I have proposed such a patch there[0].

> Does it means we'll have to patch all our modules that contain host values?

As user/developer see fits.  The thing is that it is currently very hard
to do it, so people rely on external processes to adjust IPv6 with or
without bracket (like in packstack for instance).  If we give developer
a nice function that does it for them, then:
 - it can be integrated easily on new code;
 - old code can be easily patched when such problem appears.

So this can be a streamlined process, just reacting when bug appears and
try to ensure that new code handle the IPv6 case.

I have created this patch that use this feature there[1].  Comparing to
the proposed interface the difference is the splat operator[2] required
for the pick function.  All in all it should support whatever is thrown
at it, a bit like a filter.

[0] https://review.openstack.org/264927
[1] https://review.openstack.org/264951
[2] https://docs.puppetlabs.com/puppet/latest/reference/lang_expressions.html#splat

-- 
Sofer Athlan-Guyot



More information about the OpenStack-dev mailing list