Skip to content

Commit

Permalink
Fix loading current value for nexus user passwords
Browse files Browse the repository at this point in the history
There's two issues solved by this commit:

- The API calls to check if the new password works always failed;
- The new password was given as the old password value when the
  call failed, making it impossible to update the password.
  • Loading branch information
jlundqvist-criteo committed Jun 24, 2024
1 parent 860c06c commit fa0e687
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions resources/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
# Check if we need to change the password.
if self.class.properties[:password].is_set?(desired)
begin
::Nexus3::Api.new(api_client.endpoint, username, desired.password).request(:get, '/service/metrics/ping')
password 'Supercalifragilisticexpialidocious-that-does-not-exist-so-maybe-the-resource-will-need-to-converge'
rescue ::Nexus3::ApiError
::Nexus3::Api.new(api_client.endpoint, username, desired.password).request(:get, '/service/rapture/session')
password desired.password
rescue ::Nexus3::ApiError
password 'Supercalifragilisticexpialidocious-that-does-not-exist-so-maybe-the-resource-will-need-to-converge'
end
end
rescue LoadError, ::Nexus3::ApiError => e
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/resources/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
user_response('user_with_role'),
user_response('user_with_role'))

stub_request(:get, 'http://localhost:8081/service/metrics/ping')
stub_request(:get, 'http://localhost:8081/service/rapture/session')
.to_return(api_response(200))
end

Expand Down

0 comments on commit fa0e687

Please sign in to comment.