Project

General

Profile

Actions

Bug #20785

closed

Kickstart repository assigned in UI to hostgroup difficult to set using Hammer

Added by Ondřej Pražák about 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
High
Category:
-
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Assigning kickstart repository to hostgroup works in UI. Synced Content dropdown makes sure that only kickstart repos from lifecycle env and content view (previously selected in the form) can be selected as a synced content.
Using hammer/API, there are no checks. Any existing repository id can be passed as --kickstart-repository-id and it is accepted. We should not allow repositories that are not in associated content view to be set.

More importantly, there are multiple records with the same repo name, but user is always presented only with one record representing the repo. This makes it impossible to assign the same repo via hammer as I did using UI, because I cannot list all the repo records and find out the id for kickstart repo in a lifecycle environment.

Steps to reproduce:

1) create kickstart repo, sync, add to content view, publish

Mine looks like this, notice the kickstart repo ids:

[root@foreman ~]# hammer content-view info --id 2
ID:                     2
Name:                   RHEL 7 SOE
Label:                  RHEL_7_SOE
Composite:              false
Description:            Standard Operating Environment for RHEL7
Content Host Count:     0
Organization:           Default Organization
Yum Repositories:       
 1) ID:    1
    Name:  Red Hat Enterprise Linux 7 Server Kickstart x86_64 7.4
    Label: Red_Hat_Enterprise_Linux_7_Server_Kickstart_x86_64_7_4
 2) ID:    2
    Name:  Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server
    Label: Red_Hat_Enterprise_Linux_7_Server_RPMs_x86_64_7Server
 3) ID:    3
    Name:  Tools
    Label: Tools
Docker Repositories:    

OSTree Repositories:    

Puppet Modules:         

Lifecycle Environments: 
 1) ID:   1
    Name: Library
Versions:               
 1) ID:        2
    Version:   1.0
    Published: 2017/08/29 06:40:41
Components:             

Activation Keys:        
 1) ak-rhel-7

[root@foreman ~]# hammer content-view version info --environment Library --content-view-id 2
ID:                     2
Name:                   RHEL 7 SOE 1.0
Version:                1.0
Description:            
Content View ID:        2
Content View Name:      RHEL 7 SOE
Content View Label:     RHEL_7_SOE
Lifecycle Environments: 
 1) ID:    1
    Name:  Library
    Label: Library
Repositories:           
 1) ID:    8
    Name:  Tools
    Label: Tools
 2) ID:    6
    Name:  Red Hat Enterprise Linux 7 Server RPMs x86_64 7Server
    Label: Red_Hat_Enterprise_Linux_7_Server_RPMs_x86_64_7Server
 3) ID:    4
    Name:  Red Hat Enterprise Linux 7 Server Kickstart x86_64 7.4
    Label: Red_Hat_Enterprise_Linux_7_Server_Kickstart_x86_64_7_4

2) go to the UI, create a hostgroup with content view from step 1) and appropriate lifecycle env (Library in my case), select kickstart repo and save
3) find out the id of kickstart repo assigned to hostgroup, use curl because hammer does not support this:

[root@foreman ~]# curl -H "Accept: application/json" -H "Content-Type: application/json" -k -X GET -u admin:changeme https://$(hostname)/api/v2/hostgroups/3 | json_reformat
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1586    0  1586    0     0   9598      0 --:--:-- --:--:-- --:--:--  9612
{
    "content_source_id": 1,
    "content_source_name": "cisco-c240m3-01.rhts.eng.bos.redhat.com",
    "content_view_id": 2,
    "content_view_name": "RHEL 7 SOE",
    "lifecycle_environment_id": 1,
    "lifecycle_environment_name": "Library",
    "kickstart_repository_id": 5,
    "subnet_id": 1,
    "subnet_name": "192.168.73.0/24",
    "operatingsystem_id": 1,
    "operatingsystem_name": "RHEL Server 7.4",
    "domain_id": 2,
    "domain_name": "example.com",
    "environment_id": 1,
...

4) Both 'content-view info' and 'content-view version info' show the kickstart repos, but they have ids 1 and 4, not 5. There is no way to get the id of the repo that was assigned in UI, because it is never listed.

Maybe we could add kickstart_repository_name and handle the association of correct record because we know lifecycle env and content view.


Related issues 3 (0 open3 closed)

Related to Katello - Bug #21146: show kickstart repository name in hammer ClosedPartha Aji09/27/2017Actions
Related to Katello - Bug #21147: show kickstart repository name in content facet jsonClosedPartha Aji09/27/2017Actions
Related to Katello - Bug #21196: Support kickstart repository name parameter for host and hostgroupClosedPartha Aji10/04/2017Actions
Actions

Also available in: Atom PDF