Class: Puppet::Provider::Neutron
- Inherits:
-
Openstack
- Object
- Openstack
- Puppet::Provider::Neutron
- Extended by:
- Openstack::Auth
- Defined in:
- lib/puppet/provider/neutron.rb
Class Method Summary collapse
- .get_network_name(id) ⇒ Object
- .get_subnet_name(id) ⇒ Object
- .parse_availability_zone_hint(value) ⇒ Object
- .parse_subnet_id(value) ⇒ Object
Class Method Details
.get_network_name(id) ⇒ Object
11 12 13 14 |
# File 'lib/puppet/provider/neutron.rb', line 11 def self.get_network_name(id) network = self.request('network', 'show', [id]) return network[:name] end |
.get_subnet_name(id) ⇒ Object
16 17 18 19 |
# File 'lib/puppet/provider/neutron.rb', line 16 def self.get_subnet_name(id) subnet = self.request('subnet', 'show', [id]) return subnet[:name] end |
.parse_availability_zone_hint(value) ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/puppet/provider/neutron.rb', line 35 def self.parse_availability_zone_hint(value) hints = JSON.parse(value.gsub(/\\"/,'"').gsub('\'','"')) if hints.length > 1 hints else hints.first end end |
.parse_subnet_id(value) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/puppet/provider/neutron.rb', line 21 def self.parse_subnet_id(value) fixed_ips = JSON.parse(value.gsub(/\\"/,'"').gsub('\'','"')) subnet_ids = [] fixed_ips.each do |fixed_ip| subnet_ids << fixed_ip['subnet_id'] end if subnet_ids.length > 1 subnet_ids else subnet_ids.first end end |