Use common function to parse python dict/list
Depends-on: https://review.opendev.org/931749 Change-Id: I507061571d7fd0081fd8308cc70bb8a663d4907c
This commit is contained in:
parent
31862093eb
commit
a09db1dceb
@ -19,7 +19,7 @@ class Puppet::Provider::Neutron < Puppet::Provider::Openstack
|
||||
end
|
||||
|
||||
def self.parse_subnet_id(value)
|
||||
fixed_ips = JSON.parse(value.gsub(/\\"/,'"').gsub('\'','"'))
|
||||
fixed_ips = parse_python_list(value)
|
||||
subnet_ids = []
|
||||
fixed_ips.each do |fixed_ip|
|
||||
subnet_ids << fixed_ip['subnet_id']
|
||||
|
@ -176,7 +176,7 @@ Puppet::Type.type(:neutron_port).provide(
|
||||
end
|
||||
|
||||
def self.parse_ip_address(value)
|
||||
fixed_ips = JSON.parse(value.gsub('\'','"'))
|
||||
fixed_ips = parse_python_list(value)
|
||||
ips = []
|
||||
fixed_ips.each do |fixed_ip|
|
||||
ips << fixed_ip['ip_address']
|
||||
@ -187,7 +187,7 @@ Puppet::Type.type(:neutron_port).provide(
|
||||
end
|
||||
|
||||
def self.parse_binding_profile_interface_name(value)
|
||||
profile = JSON.parse(value.gsub('\'','"'))
|
||||
profile = parse_python_dict(value)
|
||||
profile['interface_name']
|
||||
end
|
||||
|
||||
|
@ -70,7 +70,7 @@ Puppet::Type.type(:neutron_subnet).provide(
|
||||
|
||||
def self.parse_allocation_pool(values)
|
||||
allocation_pools = []
|
||||
JSON.parse(values.gsub("'", '"')).each do |pool|
|
||||
parse_python_list(values).each do |pool|
|
||||
start_ip = pool['start']
|
||||
end_ip = pool['end']
|
||||
allocation_pools << "start=#{start_ip},end=#{end_ip}"
|
||||
@ -80,7 +80,7 @@ Puppet::Type.type(:neutron_subnet).provide(
|
||||
|
||||
def self.parse_host_routes(values)
|
||||
host_routes = []
|
||||
JSON.parse(values.gsub("'", '"')).each do |route|
|
||||
parse_python_list(values).each do |route|
|
||||
nexthop = route['nexthop']
|
||||
destination = route['destination']
|
||||
host_routes << "destination=#{destination},nexthop=#{nexthop}"
|
||||
@ -89,7 +89,7 @@ Puppet::Type.type(:neutron_subnet).provide(
|
||||
end
|
||||
|
||||
def self.parse_dns_nameservers(values)
|
||||
return JSON.parse(values.gsub("'", '"'))
|
||||
return parse_python_list(values)
|
||||
end
|
||||
|
||||
def exists?
|
||||
|
Loading…
Reference in New Issue
Block a user