Merge "Remove handling of 'u' prefix"

This commit is contained in:
Zuul
2022-05-23 17:31:14 +00:00
committed by Gerrit Code Review
2 changed files with 3 additions and 3 deletions

View File

@@ -125,7 +125,7 @@ Puppet::Type.type(:nova_aggregate).provide(
end
def self.pythondict2hash(input)
return JSON.parse(input.gsub(/u'([^']*)'/, '"\1"').gsub(/'/, '"'))
return JSON.parse(input.gsub(/'/, '"'))
end
def self.parsestring(input)

View File

@@ -96,7 +96,7 @@ hosts="[u\'example\']"
describe '#pythondict2hash' do
it 'should return a hash with key-value when provided with a unicode python dict' do
s = "{u'key': 'value', u'key2': 'value2'}"
s = "{'key': 'value', 'key2': 'value2'}"
expect(described_class.pythondict2hash(s)).to eq({"key"=>"value", "key2"=>"value2"})
end
@@ -113,7 +113,7 @@ hosts="[u\'example\']"
end
it 'should call pythondict2hash when provided with a hash' do
s = "{u'key': 'value', u'key2': 'value2'}"
s = "{'key': 'value', 'key2': 'value2'}"
expect(described_class.parsestring(s)).to eq({"key"=>"value", "key2"=>"value2"})
end
end