From be4aad7589bc63f90b98b7d5692701a8368f8b04 Mon Sep 17 00:00:00 2001 From: Al Bailey Date: Mon, 11 Mar 2019 07:55:54 -0500 Subject: [PATCH 1/3] Roll up TIS patches --- lib/puppet/provider/openstack.rb | 1 + lib/puppet/provider/openstack/auth.rb | 16 ++++++++++++++-- lib/puppet/provider/openstack/credentials.rb | 2 -- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/puppet/provider/openstack.rb b/lib/puppet/provider/openstack.rb index 0240ce4..8b8e564 100644 --- a/lib/puppet/provider/openstack.rb +++ b/lib/puppet/provider/openstack.rb @@ -45,6 +45,7 @@ class Puppet::Provider::Openstack < Puppet::Provider begin action = args[1] Timeout.timeout(command_timeout(action)) do + args.unshift('--os-interface', 'internal') openstack_command *args end rescue Timeout::Error diff --git a/lib/puppet/provider/openstack/auth.rb b/lib/puppet/provider/openstack/auth.rb index 743071d..4026aec 100644 --- a/lib/puppet/provider/openstack/auth.rb +++ b/lib/puppet/provider/openstack/auth.rb @@ -1,9 +1,19 @@ #require 'puppet/provider/openstack/credentials' require File.join(File.dirname(__FILE__), '..','..','..', 'puppet/provider/openstack/credentials') +require 'hiera_puppet' module Puppet::Provider::Openstack::Auth - RCFILENAME = "#{ENV['HOME']}/openrc" + RCFILENAME = "/etc/platform/openrc" + + def lookup_hiera(key) + HieraPuppet.lookup(key, :undef, self, nil, :priority) + end + + def get_admin_password + value=lookup_hiera('keystone::admin_password') + return value + end def get_os_vars_from_env env = {} @@ -17,7 +27,7 @@ module Puppet::Provider::Openstack::Auth unless rcfile.nil? File.open(rcfile).readlines.delete_if{|l| l=~ /^#|^$/ }.each do |line| # we only care about the OS_ vars from the file LP#1699950 - if line =~ /OS_/ + if line =~ /OS_/ and line.include?('=') key, value = line.split('=') key = key.split(' ').last value = value.chomp.gsub(/'/, '') @@ -38,6 +48,8 @@ module Puppet::Provider::Openstack::Auth unless @credentials.set? @credentials.unset set_credentials(@credentials, get_os_vars_from_rcfile(rc_filename)) + # retrieves the password from hiera data since keyring is not yet available + @credentials.password = get_admin_password end unless @credentials.set? raise(Puppet::Error::OpenstackAuthInputError, 'Insufficient credentials to authenticate') diff --git a/lib/puppet/provider/openstack/credentials.rb b/lib/puppet/provider/openstack/credentials.rb index 2765b2b..9c831e3 100644 --- a/lib/puppet/provider/openstack/credentials.rb +++ b/lib/puppet/provider/openstack/credentials.rb @@ -70,11 +70,9 @@ class Puppet::Provider::Openstack::CredentialsV3 < Puppet::Provider::Openstack:: :domain_id, :domain_name, :key, - :project_domain_id, :project_domain_name, :project_id, :trust_id, - :user_domain_id, :user_domain_name, :user_id ] -- 1.8.3.1