Remove handling of 'u' prefix
... because the prefix is no longer printed in Python 3. In python 2 >>> print({u'foo': u'baa'}) {u'foo': u'baa'} >>> print([u'foo', 'baa']) [u'foo', 'baa'] In python 3 >>> print({u'foo': u'baa'}) {'foo': 'baa'} >>> print([u'foo', 'baa']) ['foo', 'baa'] Change-Id: I8dc8f83b3be836f201b1df4bfaaa781a77d08557
This commit is contained in:
parent
e046811edb
commit
5c6045d05e
@ -115,7 +115,7 @@ class Puppet::Provider::Neutron < Puppet::Provider::Openstack
|
||||
end
|
||||
|
||||
def self.parse_subnet_id(value)
|
||||
fixed_ips = JSON.parse(value.gsub(/\\"/,'"').gsub('u\'', '"').gsub('\'','"'))
|
||||
fixed_ips = JSON.parse(value.gsub(/\\"/,'"').gsub('\'','"'))
|
||||
subnet_ids = []
|
||||
fixed_ips.each do |fixed_ip|
|
||||
subnet_ids << fixed_ip['subnet_id']
|
||||
@ -129,7 +129,7 @@ class Puppet::Provider::Neutron < Puppet::Provider::Openstack
|
||||
end
|
||||
|
||||
def self.parse_availability_zone_hint(value)
|
||||
hints = JSON.parse(value.gsub(/\\"/,'"').gsub('u\'', '"').gsub('\'','"'))
|
||||
hints = JSON.parse(value.gsub(/\\"/,'"').gsub('\'','"'))
|
||||
if hints.length > 1
|
||||
hints
|
||||
else
|
||||
|
@ -182,7 +182,7 @@ Puppet::Type.type(:neutron_port).provide(
|
||||
end
|
||||
|
||||
def self.parse_ip_address(value)
|
||||
fixed_ips = JSON.parse(value.gsub(/\\"/,'"').gsub('u\'', '"').gsub('\'','"'))
|
||||
fixed_ips = JSON.parse(value.gsub(/\\"/,'"').gsub('\'','"'))
|
||||
ips = []
|
||||
fixed_ips.each do |fixed_ip|
|
||||
ips << fixed_ip['ip_address']
|
||||
@ -196,7 +196,7 @@ Puppet::Type.type(:neutron_port).provide(
|
||||
end
|
||||
|
||||
def self.parse_binding_profile_interface_name(value)
|
||||
profile = JSON.parse(value.gsub(/\\"/,'"').gsub('u\'', '"').gsub('\'','"'))
|
||||
profile = JSON.parse(value.gsub(/\\"/,'"').gsub('\'','"'))
|
||||
profile['interface_name']
|
||||
end
|
||||
|
||||
|
@ -74,8 +74,7 @@ Puppet::Type.type(:neutron_subnet).provide(
|
||||
return [] if values.empty? or values == '[]'
|
||||
values = values.gsub('[', '').gsub(']', '')
|
||||
for value in Array(values)
|
||||
allocation_pool = JSON.parse(value.gsub(/\\"/,'"').gsub('u\'', '"')
|
||||
.gsub('\'','"'))
|
||||
allocation_pool = JSON.parse(value.gsub(/\\"/,'"').gsub('\'','"'))
|
||||
start_ip = allocation_pool['start']
|
||||
end_ip = allocation_pool['end']
|
||||
allocation_pools << "start=#{start_ip},end=#{end_ip}"
|
||||
@ -88,8 +87,7 @@ Puppet::Type.type(:neutron_subnet).provide(
|
||||
return [] if values.empty? or values == '[]'
|
||||
values = values.gsub('[', '').gsub(']', '')
|
||||
for value in Array(values)
|
||||
host_route = JSON.parse(value.gsub(/\\"/,'"').gsub('u\'', '"')
|
||||
.gsub('\'','"'))
|
||||
host_route = JSON.parse(value.gsub(/\\"/,'"').gsub('\'','"'))
|
||||
nexthop = host_route['nexthop']
|
||||
destination = host_route['destination']
|
||||
host_routes << "destination=#{destination},nexthop=#{nexthop}"
|
||||
@ -99,8 +97,8 @@ Puppet::Type.type(:neutron_subnet).provide(
|
||||
|
||||
def self.parse_dns_nameservers(values)
|
||||
if values.is_a? String
|
||||
values = values.gsub('u\'', '').gsub('\'','').gsub('[', '')
|
||||
.gsub(']', '').gsub(',', '').split(' ')
|
||||
values = values.gsub('\'','').gsub('[', '').gsub(']', '')
|
||||
.gsub(',', '').split(' ')
|
||||
end
|
||||
# just enforce that this is actually an array
|
||||
return Array(values)
|
||||
|
Loading…
Reference in New Issue
Block a user