Bug 1436123 - Removing Architecture and OS from hostgroup in UI doesn't remove OS
Summary: Removing Architecture and OS from hostgroup in UI doesn't remove OS
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Host Group
Version: 6.2.8
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: 6.4.0
Assignee: Liza
QA Contact: Jameer Pathan
URL:
Whiteboard:
Depends On:
Blocks: 1353215
TreeView+ depends on / blocked
 
Reported: 2017-03-27 08:57 UTC by Kenny Tordeurs
Modified: 2023-03-24 13:47 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-16 19:36:02 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 20347 0 None None None 2017-07-19 12:25:02 UTC

Description Kenny Tordeurs 2017-03-27 08:57:23 UTC
Description of problem:
API/Hammer show different results then Webui

Version-Release number of selected component (if applicable):
Satellite 6.2.8

How reproducible:
100%

Steps to Reproduce:
1) Create a new hostgroup without specifying architecture or OS:
# hammer hostgroup create --name "AXE"  --organizations "Default Organization"

2) Check it via API:
# curl -X GET -s -k -u user:pass "https://localhost:443/api/v2/hostgroups/" | python -mjson.tool
~~~
{
    "page": 1,
    "per_page": 200,
    "results": [
        {
            "ancestry": null,
            "architecture_id": null,
            "architecture_name": null,
            "compute_profile_id": null,
            "compute_profile_name": null,
            "created_at": "2017-03-27 07:28:51 UTC",
            "domain_id": null,
            "domain_name": null,
            "environment_id": null,
            "environment_name": null,
            "id": 1,
            "medium_id": null,
            "medium_name": null,
            "name": "AXE",
            "operatingsystem_id": null,
            "operatingsystem_name": null,
            "parent_id": null,
            "parent_name": null,
            "ptable_id": null,
            "ptable_name": null,
            "puppet_ca_proxy_id": null,
            "puppet_proxy_id": null,
            "realm_id": null,
            "realm_name": null,
            "subnet_id": null,
            "subnet_name": null,
            "title": "AXE",
            "updated_at": "2017-03-27 07:28:51 UTC"
        }
    ],
    "search": null,
    "sort": {
        "by": null,
        "order": null
    },
    "subtotal": 1,
    "total": 1
}
~~~

Specify an arch / OS / Media / partition via webui and save it, this is the output from API:

# curl -X GET -s -k -u user:pass "https://localhost:443/api/v2/hostgroups/" | python -mjson.tool
~~~
{
    "page": 1,
    "per_page": 200,
    "results": [
        {
            "ancestry": null,
            "architecture_id": 1,
            "architecture_name": "x86_64",
            "compute_profile_id": null,
            "compute_profile_name": null,
            "created_at": "2017-03-27 07:43:16 UTC",
            "domain_id": null,
            "domain_name": null,
            "environment_id": null,
            "environment_name": null,
            "id": 2,
            "medium_id": 11,
            "medium_name": "pipopopo/Library/Red_Hat_Server/Red_Hat_Enterprise_Linux_7_Server_Kickstart_x86_64_7_2",
            "name": "AXE",
            "operatingsystem_id": 1,
            "operatingsystem_name": "RedHat 7.2",
            "parent_id": null,
            "parent_name": null,
            "ptable_id": 72,
            "ptable_name": "CoreOS default fake",
            "puppet_ca_proxy_id": null,
            "puppet_proxy_id": null,
            "realm_id": null,
            "realm_name": null,
            "subnet_id": null,
            "subnet_name": null,
            "title": "AXE",
            "updated_at": "2017-03-27 07:45:05 UTC"
        }
    ],
    "search": null,
    "sort": {
        "by": null,
        "order": null
    },
    "subtotal": 1,
    "total": 1
}
~~~

3) Reverting the action by removing the OS/Arch/Partition/Media via Webui

Do API call to watch the results:

# curl -X GET -s -k -u virt-who:virt-who "https://localhost:443/api/v2/hostgroups/" | python -mjson.tool
~~~
{
    "page": 1,
    "per_page": 200,
    "results": [
        {
            "ancestry": null,
            "architecture_id": null,
            "architecture_name": null,
            "compute_profile_id": null,
            "compute_profile_name": null,
            "created_at": "2017-03-27 07:43:16 UTC",
            "domain_id": null,
            "domain_name": null,
            "environment_id": null,
            "environment_name": null,
            "id": 2,
            "medium_id": null,
            "medium_name": null,
            "name": "AXE",
            "operatingsystem_id": 1,
            "operatingsystem_name": "RedHat 7.2",
            "parent_id": null,
            "parent_name": null,
            "ptable_id": null,
            "ptable_name": null,
            "puppet_ca_proxy_id": null,
            "puppet_proxy_id": null,
            "realm_id": null,
            "realm_name": null,
            "subnet_id": null,
            "subnet_name": null,
            "title": "AXE",
            "updated_at": "2017-03-27 08:32:04 UTC"
        }
    ],
    "search": null,
    "sort": {
        "by": null,
        "order": null
    },
    "subtotal": 1,
    "total": 1
}
~~~

To confirm I checked it also via hammer:

# hammer hostgroup info --id 2
~~~
[Foreman] Password for admin: 
Id:                     2
Name:                   AXE
Title:                  AXE
Operating System:       RedHat 7.2
Puppet CA Proxy Id:     
Puppet Master Proxy Id: 
Puppetclasses:          

Parameters:             

Organizations:          
    pipopopo
Parent Id:
~~~



Actual results:
It seems that all the fields were reverted to null except for the Operating System.

~~~
"operatingsystem_id": 1,
"operatingsystem_name": "RedHat 7.2",
~~~

Expected results:
everything back to null as also shown in the Webui

Additional info:
This creates a discrepancy between hammer/API and what's seen in the webui.

Comment 3 Tomer Brisker 2017-07-19 12:24:38 UTC
Updated title, the issue is that when removing the architecture, the OS field becomes disabled and thus not sent, leading to the previous value being preserved. It isn't seen in the UI since if the architecture is blank the OS field is disabled on following views, but in the DB the hostgroup still has an OS defined. I have also noticed this behaviour for medium and partition table fields. Increasing severity and priority as this isn't just a cosmetic issue and may lead to unexpected results.

Comment 4 Tomer Brisker 2017-07-19 12:24:59 UTC
Created redmine issue http://projects.theforeman.org/issues/20347 from this bug

Comment 10 Satellite Program 2018-01-11 17:29:31 UTC
Upstream bug assigned to egilman

Comment 11 Satellite Program 2018-01-11 17:29:40 UTC
Upstream bug assigned to egilman

Comment 12 Satellite Program 2018-01-22 15:27:28 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/20347 has been resolved.

Comment 16 Jameer Pathan 2018-08-08 11:40:36 UTC
Verified:

@satellite 6.4.0 snap16

steps:

1) # hammer hostgroup create --name "AXE"  --organizations "Default Organization"

2) # curl -X GET -s -k -u user:pass "https://localhost:443/api/v2/hostgroups/" | python -mjson.tool

3) Specified an arch / OS / Media / partition via Webui

4) curl -X GET -s -k -u user:pass "https://localhost:443/api/v2/hostgroups/" | python -mjson.tool

5) Reverted the action by removing the OS/Arch/Partition/Media via Webui

6) curl -X GET -s -k -u user:pass "https://localhost:443/api/v2/hostgroups/" | python -mjson.tool

7) hammer hostgroup info --id 2


Observation:

- everything back to null as shown in the Webui (for both api/hammer)

- API/Hammer shows same result as Webui

Comment 17 Bryan Kearney 2018-10-16 19:36:02 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:2927


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