[openstack-dev] [puppet] including openstacklib::openstackclient

Cody Herriges cody at herriges.org
Tue Dec 8 18:29:22 UTC 2015


Matt Fischer wrote:
> I found this bug in the liberty branch [1] over the weekend in the
> handling of openstack client between glance & keystone. As a part of
> fixing that I've discussed with Clayton and Michael Chapman just what
> the right way is to include the openstackclient.
> 
> Keystone does it by conditionally including the class in client.pp [2].
> Glance does it with an ensure_resources call in the main class [3].
> 
> Michael Chapman was of the opinion we should just include the
> openstacklib::openstackclient unconditionally and let hiera figure it
> out (hope I'm paraphrasing his opinion). That is cleaner but perhaps
> less flexible.
> 
> Whatever solution we pick, I want to be consistent and back-portable.
> 
> Thoughts?
> 
> 
> [1] - https://bugs.launchpad.net/puppet-openstacklib/+bug/1523643 
> [2]- https://github.com/openstack/puppet-keystone/blob/master/manifests/client.pp#L20-L26

This way is "ok."

> [3]- https://github.com/openstack/puppet-glance/blob/master/manifests/init.pp#L33

The glance way seems bad since it maintaining its own private
implementation for a thing that intended to be shared.


The best is probably to just unconditionally including
Class[openstacklib::openstackclient] using the include function across
all modules and removing the option for each module to override the
package_ensure parameter for Class[openstacklib::openstackclient].
This'll leave you open to resource conflicts based on manifest parse
order though.  For example, if I want to set
Class[openstacklib::openstackclient]'s package_ensure parameter to
latest I need to declare a class resource;

class { '::openstacklib::openstackclient':
  package_ensure => $ensure,
}

This is all fine and good if I do this at the top of the manifest in my
composite class then cross my fingers that all subsequent declarations
of the class are using the include function.  If this happens the other
way around Puppet will throw a duplicate resource definition error.

To ease into the API and manifest change you could basically combine the
glance and keystone example and use the ensure_resource function to
ensure a class resource type with the name
::openstacklib::openstackclient exists.  That just puts you in the
situation where the first puppet-* module class to declare it with a
certain set of parameters will win.


-- 
Cody

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 931 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20151208/cb842f3a/attachment.pgp>


More information about the OpenStack-dev mailing list