Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent count of templates reported when executing listTemplates under RootAdmin and DomainAdmin #9083

Open
phsm opened this issue May 15, 2024 · 1 comment

Comments

@phsm
Copy link
Contributor

phsm commented May 15, 2024

ISSUE TYPE
  • Bug Report
COMPONENT NAME
API
CLOUDSTACK VERSION
4.18.1.1
CONFIGURATION

N/A

OS / ENVIRONMENT

N/A

SUMMARY
STEPS TO REPRODUCE
1. Make sure your ROOT domain has a DomainAdmin account.
2. Pick one of the VM templates on a running Cloudstack platform to test the API call on
3. Run the following command under the RootAdmin: `cmk list templates templatefilter=executable filter=id,name keyword=<some part of the template name>`
4. Run the same command under the DomainAdmin.
EXPECTED RESULTS

When running the command under RootAdmin, the result template entries match the "count" JSON field:

cmk list templates templatefilter=executable filter=id,name keyword=MyTemplate
{
  "count": 5,
  "template": [
    {
      "id": "19c1af19-ca5a-4f1d-aece-d253f3e961c2",
      "name": "MyTemplate 1"
    },
    {
      "id": "804558dd-cc80-4e13-a67d-0db607930fc4",
      "name": "MyTemplate 2"
    },
    {
      "id": "7fc10cc1-34e6-46b2-b699-8369b4cc031b",
      "name": "MyTemplate 3"
    },
    {
      "id": "7f6504f5-b5ae-437f-99a5-4ca814e41157",
     "name": "MyTemplate 4"
    },
    {
      "id": "bf338572-85df-46aa-b4d6-678edd865c5e",
      "name": "MyTemplate 5"
    }
  ]
}
ACTUAL RESULTS

When running the command under DomainAdmin, the result template entries do not match the "count" JSON field:

cmk list templates templatefilter=executable filter=id,name keyword=MyTemplate
{
  "count": 20,
  "template": [
    {
      "id": "19c1af19-ca5a-4f1d-aece-d253f3e961c2",
      "name": "MyTemplate 1"
    },
    {
      "id": "804558dd-cc80-4e13-a67d-0db607930fc4",
      "name": "MyTemplate 2"
    },
    {
      "id": "7fc10cc1-34e6-46b2-b699-8369b4cc031b",
      "name": "MyTemplate 3"
    },
    {
      "id": "7f6504f5-b5ae-437f-99a5-4ca814e41157",
     "name": "MyTemplate 4"
    },
    {
      "id": "bf338572-85df-46aa-b4d6-678edd865c5e",
      "name": "MyTemplate 5"
    }
  ]
}
@shwstppr
Copy link
Contributor

@phsm I tried to reproduce this in a 4.19 env and I'm not able to.

> set profile localcloud
Loaded server profile: localcloud
Url:         http://10.1.35.161:8080/client/api
Username:    admin
Domain:      /
API Key:     LIN6rqXuaJwMPfGYFh13qDwYz5VNNz1J2J6qIOWcd3oLQOq0WtD4CwRundBL6rzXToa3lQOC_vKjI3nkHtiD8Q
Total APIs:  759

(localcloud) 🐱 > list templates templatefilter=executable filter=id,name keyword=test
{
  "count": 7,
  "template": [
    {
      "id": "901f4f32-3899-43b3-ba37-18161346d3e8",
      "name": "test"
    },
    {
      "id": "c221de63-bb41-4dae-8819-93255377befb",
      "name": "test 1"
    },
    {
      "id": "e1b614e7-1067-4a42-b6de-f818d29c4348",
      "name": "test 1"
    },
    {
      "id": "73831e3a-e1be-4a7e-b3a8-64651865e322",
      "name": "test 2"
    },
    {
      "id": "b6dfbfdb-f253-4b37-b2fe-c8be31fa6e52",
      "name": "test 3"
    },
    {
      "id": "b6544a1c-bac4-4514-a202-2a194c318547",
      "name": "test 4"
    },
    {
      "id": "9103ab25-de64-4b00-8838-321bc2181269",
      "name": "test 5"
    }
  ]
}
(localcloud) 🐱 > set profile domainadmin
Loaded server profile: domainadmin
Url:         http://localhost:8080/client/api
Username:    dadmin
Domain:      /
API Key:     
Total APIs:  372

(domainadmin) 🐱 > list templates templatefilter=executable filter=id,name keyword=test
{
  "count": 6,
  "template": [
    {
      "id": "c221de63-bb41-4dae-8819-93255377befb",
      "name": "test 1"
    },
    {
      "id": "e1b614e7-1067-4a42-b6de-f818d29c4348",
      "name": "test 1"
    },
    {
      "id": "73831e3a-e1be-4a7e-b3a8-64651865e322",
      "name": "test 2"
    },
    {
      "id": "b6dfbfdb-f253-4b37-b2fe-c8be31fa6e52",
      "name": "test 3"
    },
    {
      "id": "b6544a1c-bac4-4514-a202-2a194c318547",
      "name": "test 4"
    },
    {
      "id": "9103ab25-de64-4b00-8838-321bc2181269",
      "name": "test 5"
    }
  ]
}

Would it be possible for you to test with a 4.19.0 env?

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

No branches or pull requests

3 participants