From c1b27658eae65b11d66a45fce0432d12b23bed2c Mon Sep 17 00:00:00 2001 From: Clayton O'Neill Date: Wed, 28 Sep 2016 01:56:00 +0000 Subject: [PATCH] Fix load paths for nova base provider This adds the $LOAD_PATH manipulation needed to find openstacklib from the nova base provider code. When compiling a static catalog (puppet master --compile), the puppet master doesn't populate the plugin directory before hand. That means that either openstacklib won't be found at all, or may be an old mismatched version. This code is copied from the keystone module which has similar needs. Change-Id: I60f9389a571362191180442ffbad9a92bd9c0c78 --- lib/puppet/provider/nova.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/puppet/provider/nova.rb b/lib/puppet/provider/nova.rb index e79d85523..c05a378a1 100644 --- a/lib/puppet/provider/nova.rb +++ b/lib/puppet/provider/nova.rb @@ -1,5 +1,9 @@ # Run test ie with: rspec spec/unit/provider/nova_spec.rb +# Add openstacklib code to $LOAD_PATH so that we can load this during +# standalone compiles without error. +File.expand_path('../../../../openstacklib/lib', File.dirname(__FILE__)).tap { |dir| $LOAD_PATH.unshift(dir) unless $LOAD_PATH.include?(dir) } + require 'puppet/util/inifile' require 'puppet/provider/openstack' require 'puppet/provider/openstack/auth'