Bug 1614360 - hammer hostgroup create/update --compute-resource fails to query CR
Summary: hammer hostgroup create/update --compute-resource fails to query CR
Keywords:
Status: CLOSED DUPLICATE of bug 1584785
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Host Group
Version: 6.4
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-08-09 13:41 UTC by Lukas Pramuk
Modified: 2018-12-23 09:21 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-08-10 09:17:12 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Lukas Pramuk 2018-08-09 13:41:48 UTC
Description of problem:
hammer hostgroup create/update --compute-resource fails to query CR since it uses wrong api call for the query:

GET /api/compute_resources 
Params: { "name" => "libvirt" }

This call basically returns all compute resources:

Could not create the hostgroup:
  Error: Found more than one compute_resource.


Version-Release number of selected component (if applicable):
6.4.0 (Snap16)

How reproducible:
deterministic

Steps to Reproduce:
1. Have more than 1 CR

# hammer compute-resource list 
---|---------------|---------
ID | NAME          | PROVIDER
---|---------------|---------
1  | docker        | Docker  
2  | libvirt       | Libvirt 
---|---------------|---------

2. Try to create/update a hostgroup querying CR by name

# hammer hostgroup create --name 'libvirt hosts' --compute-resource libvirt
Could not create the hostgroup:
  Error: Found more than one compute_resource.


Actual results:
fails to create/update HG when referring CR by name (by id works)

Expected results:
successful HG creation/update when referring CR also by name

Comment 2 Lukas Pramuk 2018-08-09 14:11:37 UTC
When referring to compute profile by name it also uses wrong api call listing all 3 compute profiles:

# hammer hostgroup create --name 'libvirt hosts' --compute-resource-id 2 --compute-profile 1-Small
Could not create the hostgroup:
  Error: Found more than one compute_profile.

...
[ INFO 2018-08-09T10:05:47 API] GET /api/compute_profiles
[DEBUG 2018-08-09T10:05:47 API] Params: {
    "name" => "1-Small"
}
[DEBUG 2018-08-09T10:05:47 API] Headers: {
    :params => {
        "name" => "1-Small"
    }
}
[DEBUG 2018-08-09T10:05:47 API] Using authenticator: HammerCLIForeman::Api::InteractiveBasicAuth
[DEBUG 2018-08-09T10:05:48 API] Response: {
       "total" => 3,
...

Comment 3 Brad Buckingham 2018-08-09 17:04:17 UTC
Hi Lukas,

Do you know if this is a regression from 6.3? (Thanks!)

Comment 4 Lukas Pramuk 2018-08-10 08:16:08 UTC
With --compute-resource option it can't be regression since the option doesn't exist on 6.3

With --compute-profile option I tested it is broken the same way on 6.3, so no regression too.

Comment 5 Lukas Pramuk 2018-08-10 09:17:12 UTC

*** This bug has been marked as a duplicate of bug 1584785 ***


Note You need to log in before you can comment on or make changes to this bug.