Drop usage of str2list in provider as it is unused

Change-Id: I70134d3184dc977af0e50197546d80eac9108f57
This commit is contained in:
Mohammed Naser
2017-09-18 19:08:02 -04:00
parent 04a47ab6f1
commit 1be941438c
2 changed files with 0 additions and 61 deletions

View File

@@ -172,39 +172,4 @@ class Puppet::Provider::Nova < Puppet::Provider::Openstack
return s.gsub(/'/, "")
end
end
# deprecated: string to list for nova cli
def self.str2list(s)
#parse string
if s.include? ","
if s.include? "="
new = {}
else
new = []
end
if s =~ /^'.+'$/
s.split("', '").each do |el|
ret = str2hash(el.strip())
if s.include? "="
new.update(ret)
else
new.push(ret)
end
end
else
s.split(",").each do |el|
ret = str2hash(el.strip())
if s.include? "="
new.update(ret)
else
new.push(ret)
end
end
end
return new
else
return str2hash(s.strip())
end
end
end

View File

@@ -118,31 +118,5 @@ describe Puppet::Provider::Nova do
res = klass.str2hash("a b = c d")
expect(res).to eq({"a b "=>" c d"})
end
it 'should return the same string' do
res = klass.str2list("zone1")
expect(res).to eq("zone1")
end
it 'should return a list of strings' do
res = klass.str2list("zone1, zone2")
expect(res).to eq(["zone1", "zone2"])
end
it 'should return a list of strings' do
res = klass.str2list("zo n e1, zone2 ")
expect(res).to eq(["zo n e1", "zone2"])
end
it 'should return a hash with multiple keys' do
res = klass.str2list("a=b, c=d")
expect(res).to eq({"a"=>"b", "c"=>"d"})
end
it 'should return a single hash' do
res = klass.str2list("a=b")
expect(res).to eq({"a"=>"b"})
end
end
end