Merge pull request #95 from derekhiggins/endpoint-list-change
Allow for a possible extra column to be returned by endpoint-list
This commit is contained in:
@@ -68,10 +68,12 @@ class Puppet::Provider::Keystone < Puppet::Provider
|
||||
def self.list_keystone_objects(type, number_columns, *args)
|
||||
# this assumes that all returned objects are of the form
|
||||
# id, name, enabled_state, OTHER
|
||||
# number_columns can be a Fixnum or an Array of possible values that can be returned
|
||||
list = (auth_keystone("#{type}-list", args).split("\n")[3..-2] || []).collect do |line|
|
||||
row = line.split(/\|/)[1..-1]
|
||||
row = row.map {|x| x.strip }
|
||||
if row.size != number_columns
|
||||
# if both checks fail then we have a mismatch between what was expected and what was received
|
||||
if (number_columns.class == Array and !number_columns.include? row.size) or (number_columns.class == Fixnum and row.size != number_columns)
|
||||
raise(Puppet::Error, "Expected #{number_columns} columns for #{type} row, found #{row.size}. Line #{line}")
|
||||
end
|
||||
row
|
||||
|
||||
@@ -111,7 +111,7 @@ Puppet::Type.type(:keystone_endpoint).provide(
|
||||
|
||||
def self.build_endpoint_hash
|
||||
hash = {}
|
||||
list_keystone_objects('endpoint', 5).each do |endpoint|
|
||||
list_keystone_objects('endpoint', [5,6]).each do |endpoint|
|
||||
service_id = get_service_id(endpoint[0])
|
||||
service_name = get_keystone_object('service', service_id, 'name')
|
||||
hash["#{endpoint[1]}/#{service_name}"] = {
|
||||
|
||||
Reference in New Issue
Block a user