
... by the common implementation from puppet-openstacklib. It was overlooked in the previous attempt. Change-Id: I532cb479e05da64bb8d5396748dba0633e68aa54
37 lines
883 B
Ruby
37 lines
883 B
Ruby
require 'puppet/provider/openstack'
|
|
require 'puppet/provider/openstack/auth'
|
|
require 'puppet/provider/openstack/credentials'
|
|
|
|
class Puppet::Provider::Neutron < Puppet::Provider::Openstack
|
|
|
|
extend Puppet::Provider::Openstack::Auth
|
|
|
|
initvars
|
|
|
|
def self.get_network_name(id)
|
|
network = self.request('network', 'show', [id])
|
|
return network[:name]
|
|
end
|
|
|
|
def self.get_subnet_name(id)
|
|
subnet = self.request('subnet', 'show', [id])
|
|
return subnet[:name]
|
|
end
|
|
|
|
def self.parse_subnet_id(value)
|
|
fixed_ips = parse_python_list(value)
|
|
subnet_ids = []
|
|
fixed_ips.each do |fixed_ip|
|
|
subnet_ids << fixed_ip['subnet_id']
|
|
end
|
|
# TODO(tkajinam): Support multiple values
|
|
subnet_ids.first
|
|
end
|
|
|
|
def self.parse_availability_zone_hint(value)
|
|
hints = parse_python_list(value)
|
|
# TODO(tkajinam): Support multiple values
|
|
hints.first
|
|
end
|
|
end
|