Skip to content

Fix NPE if on port 8096 getUserKeys - #14104

Draft
resmo wants to merge 1 commit into
apache:mainfrom
resmo:fix/npe-port-8096-getUserKeys-admin
Draft

Fix NPE if on port 8096 getUserKeys#14104
resmo wants to merge 1 commit into
apache:mainfrom
resmo:fix/npe-port-8096-getUserKeys-admin

Conversation

@resmo

@resmo resmo commented Sep 9, 2026

Copy link
Copy Markdown
Member

Description

We used to use port 8096 to access admin api keys in a cloudstack simulator testing setup for ansible. But this stopped working with an NPE since 4.22. I think. I am not sure if this is the correct fix but leaving it for testing and feedback. it's kind of an edge case.

This is what we do:

Install cs cloudstack cli client

$ pip install cs

configure dummy login, 8096 does not need a real secret/key but the cli want one

$ export CLOUDSTACK_ENDPOINT=http://127.0.0.1:8096
$ export CLOUDSTACK_SECRET=dummy
$ export CLOUDSTACK_KEY=dummy

query user id of admin account

$ admin_id="$(cs listUsers account=admin | jq '.user[0].id')"
$ echo $admin_id 
"3988a617-a622-11f1-a89d-ee147cfcbd84"

try to get api keys of admin user using its user id

$ cs getUserKeys id=$admin_id 
CloudStack error: HTTP 530 response from CloudStack
{
  "getuserkeysresponse": {
    "cserrorcode": 9999,
    "errorcode": 530,
    "errortext": "Cannot invoke \"org.apache.cloudstack.acl.apikeypair.ApiKeyPair.getUserId()\" because \"accessingKeyPair\" is null",
    "uuidList": []
  }
}

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

Preparing for testing.

@codecov

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 19.79%. Comparing base (036493f) to head (9d7148e).

Files with missing lines Patch % Lines
...c/main/java/com/cloud/user/AccountManagerImpl.java 0.00% 11 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #14104      +/-   ##
============================================
- Coverage     19.79%   19.79%   -0.01%     
+ Complexity    20015    20014       -1     
============================================
  Files          6371     6371              
  Lines        575954   575960       +6     
  Branches      70521    70525       +4     
============================================
+ Hits         113997   113998       +1     
+ Misses       449530   449528       -2     
- Partials      12427    12434       +7     
Flag Coverage Δ
uitests 3.52% <ø> (ø)
unittests 21.06% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant