Use common function to parse python dict

Depends-on: https://review.opendev.org/931722
Change-Id: I1ea417f17ef6a216bc79ddf9fd1d152c40b511c1
This commit is contained in:
Takashi Kajinami 2024-10-09 23:01:16 +09:00
parent 51fbe71584
commit 059110316d

View File

@ -65,15 +65,11 @@ Puppet::Type.type(:manila_type).provide(
@property_hash[:ensure] == :present
end
def self.parse_specs(specs)
JSON.parse(specs.gsub(/'/, '"'))
end
def self.instances
self.do_not_manage = true
list = request('share type', 'list').collect do |type|
required_extra_specs = self.parse_specs(type[:required_extra_specs])
optional_extra_specs = self.parse_specs(type[:optional_extra_specs])
required_extra_specs = self.parse_python_dict(type[:required_extra_specs])
optional_extra_specs = self.parse_python_dict(type[:optional_extra_specs])
new({
:name => type[:name],