CredentialsV3: Ensure all attributes are cleared by unset
Currently the unset method only clears attributes defined in the base Crednetial class and ones specific to CredentialV3 are left set. This change ensures the method clears all attributes. Closes-Bug: #1942145 Change-Id: I4bddbf9bb3c6251aa8b68a8bc2ef8799f3c8065e
This commit is contained in:
parent
495701901e
commit
d1eb834a20
|
@ -45,10 +45,10 @@ class Puppet::Provider::Openstack::Credentials
|
|||
end
|
||||
|
||||
def unset
|
||||
KEYS.each do |key|
|
||||
if key != :identity_api_version &&
|
||||
self.instance_variable_defined?("@#{key}")
|
||||
set(key, '')
|
||||
self.instance_variables.each do |var|
|
||||
if var.to_s != '@identity_api_version' &&
|
||||
self.instance_variable_defined?(var.to_s)
|
||||
set(var.to_s.sub(/^@/,''), '')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -86,6 +86,7 @@ describe Puppet::Provider::Openstack::Credentials do
|
|||
creds.auth_url = 'auth_url'
|
||||
creds.password = 'password'
|
||||
creds.project_name = 'project_name'
|
||||
creds.domain_name = 'domain_name'
|
||||
creds.username = 'username'
|
||||
creds.token = 'token'
|
||||
creds.endpoint = 'endpoint'
|
||||
|
@ -94,6 +95,7 @@ describe Puppet::Provider::Openstack::Credentials do
|
|||
expect(creds.auth_url).to eq('')
|
||||
expect(creds.password).to eq('')
|
||||
expect(creds.project_name).to eq('')
|
||||
expect(creds.domain_name).to eq('')
|
||||
expect(creds.username).to eq('')
|
||||
expect(creds.token).to eq('')
|
||||
expect(creds.endpoint).to eq('')
|
||||
|
|
Loading…
Reference in New Issue