Merge "CredentialsV3: Ensure all attributes are cleared by unset"

This commit is contained in:
Zuul 2021-09-20 08:38:03 +00:00 committed by Gerrit Code Review
commit ad47bad388
2 changed files with 6 additions and 4 deletions

View File

@ -45,10 +45,10 @@ class Puppet::Provider::Openstack::Credentials
end end
def unset def unset
KEYS.each do |key| self.instance_variables.each do |var|
if key != :identity_api_version && if var.to_s != '@identity_api_version' &&
self.instance_variable_defined?("@#{key}") self.instance_variable_defined?(var.to_s)
set(key, '') set(var.to_s.sub(/^@/,''), '')
end end
end end
end end

View File

@ -86,6 +86,7 @@ describe Puppet::Provider::Openstack::Credentials do
creds.auth_url = 'auth_url' creds.auth_url = 'auth_url'
creds.password = 'password' creds.password = 'password'
creds.project_name = 'project_name' creds.project_name = 'project_name'
creds.domain_name = 'domain_name'
creds.username = 'username' creds.username = 'username'
creds.token = 'token' creds.token = 'token'
creds.endpoint = 'endpoint' creds.endpoint = 'endpoint'
@ -94,6 +95,7 @@ describe Puppet::Provider::Openstack::Credentials do
expect(creds.auth_url).to eq('') expect(creds.auth_url).to eq('')
expect(creds.password).to eq('') expect(creds.password).to eq('')
expect(creds.project_name).to eq('') expect(creds.project_name).to eq('')
expect(creds.domain_name).to eq('')
expect(creds.username).to eq('') expect(creds.username).to eq('')
expect(creds.token).to eq('') expect(creds.token).to eq('')
expect(creds.endpoint).to eq('') expect(creds.endpoint).to eq('')