Fix tempest_*_id_setter to query the RAL and cache
The tempest_glance_id_setter previously would query the catalog for the id of a glance_image resource with a given name. This doesn't work on a split-node openstack where tempest is not on the glance host. It would also fail horribly if glance-api.conf didn't exist. The tempest_neutron_id_setter previously would query the instances of neutron network IDs from the RAL once for every line in the tempest.conf file if the network did not exist (because the cache would be nil). Now they both query the RAL directly from the system, similar to how tempest_neutron_id_setter did it but using Puppet::Resource.indirection, but don't continue requerying for every line in the tempest.conf when the given resource title doesn't yet exist, and tempest_glance_id_setter raises a helpful error if the glance-api.conf file does not exist. Change-Id: Icdca2c1a5f449b3fcda68d43a34452cd119303cb
This commit is contained in:
parent
0bdf6b88e1
commit
5ef9dc94b4
|
@ -13,7 +13,8 @@ Puppet::Type.type(:tempest_glance_id_setter).provide(:ruby) do
|
|||
end
|
||||
|
||||
def get_image_id
|
||||
@image_id ||= model.catalog.resource("Glance_image[#{resource[:image_name]}]").provider.id
|
||||
@image_id ||= Puppet::Resource.indirection.find("Glance_image/#{resource[:image_name]}")[:id]
|
||||
@image_id if @image_id != :absent
|
||||
end
|
||||
|
||||
def should_line
|
||||
|
|
|
@ -12,17 +12,9 @@ Puppet::Type.type(:tempest_neutron_net_id_setter).provide(:ruby) do
|
|||
handle_create_with_match
|
||||
end
|
||||
|
||||
def self.get_network_id(network_name)
|
||||
network = Puppet::Type.type('neutron_network').instances.find do |i|
|
||||
i.provider.name == network_name
|
||||
end
|
||||
if network
|
||||
return network.provider.id
|
||||
end
|
||||
end
|
||||
|
||||
def get_network_id
|
||||
@network_id ||= self.class.get_network_id(@resource[:network_name])
|
||||
@network_id ||= Puppet::Resource.indirection.find("Neutron_network/#{@resource[:network_name]}")[:id]
|
||||
@network_id if @network_id != :absent
|
||||
end
|
||||
|
||||
def should_line
|
||||
|
|
Loading…
Reference in New Issue