From bf4fe406aa20f6b0987d13d6492179bf7e86b30a Mon Sep 17 00:00:00 2001 From: Simon Sellar Date: Thu, 13 Jun 2013 00:38:07 +0000 Subject: [PATCH] Check if auth_admin_prefix is defined Check if auth_admin_prefix is defined (passed as a parameter to api.pp) before trying to access it in the settings data structure. Change-Id: I61a3ae41dca2a5e5bd9e635b0a2ab9eb05b0326a Fixes: bug #1190481 --- lib/puppet/provider/glance.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/puppet/provider/glance.rb b/lib/puppet/provider/glance.rb index f8fec10b..fc676931 100644 --- a/lib/puppet/provider/glance.rb +++ b/lib/puppet/provider/glance.rb @@ -21,10 +21,13 @@ class Puppet::Provider::Glance < Puppet::Provider g['auth_host'] = glance_file['keystone_authtoken']['auth_host'].strip g['auth_port'] = glance_file['keystone_authtoken']['auth_port'].strip g['auth_protocol'] = glance_file['keystone_authtoken']['auth_protocol'].strip - g['auth_admin_prefix'] = glance_file['keystone_authtoken'].fetch('auth_admin_prefix', '').strip g['admin_tenant_name'] = glance_file['keystone_authtoken']['admin_tenant_name'].strip g['admin_user'] = glance_file['keystone_authtoken']['admin_user'].strip g['admin_password'] = glance_file['keystone_authtoken']['admin_password'].strip + + # auth_admin_prefix not required to be set. + g['auth_admin_prefix'] = (glance_file['keystone_authtoken']['auth_admin_prefix'] || '').strip + return g else raise(Puppet::Error, 'File: /etc/glance/glance-api.conf does not contain all required sections.')