Browse Source

Merge "nova_flavor: Accept array format about access_project_ids" into stable/wallaby

stable/wallaby
Zuul 2 weeks ago
committed by Gerrit Code Review
parent
commit
091ee8c231
1 changed files with 8 additions and 2 deletions
  1. +8
    -2
      lib/puppet/provider/nova_flavor/openstack.rb

+ 8
- 2
lib/puppet/provider/nova_flavor/openstack.rb View File

@ -89,11 +89,17 @@ Puppet::Type.type(:nova_flavor).provide(
def self.instances
request('flavor', 'list', ['--long', '--all']).collect do |attrs|
project = request('flavor', 'show', [attrs[:id], '-c', 'access_project_ids'])
access_project_ids = project[:access_project_ids]
# Client can return None and this should be considered as ''
if project[:access_project_ids].downcase.chomp == 'none'
if access_project_ids.downcase.chomp == 'none'
project_value = ''
# If the ids are formatted as Array, surrounding [] should be removed
elsif access_project_ids.start_with?('[') and access_project_ids.end_with?(']')
# TODO(tkajinam): We'd need to consider multiple projects can be returned
project_value = access_project_ids[1..-2]
else
project_value = project[:access_project_ids]
project_value = access_project_ids
end
properties = Hash[attrs[:properties].scan(/(\S+)='([^']*)'/)] rescue nil
new(


Loading…
Cancel
Save