Project

General

Profile

Bug #20347

Removing Architecture and OS from hostgroup in UI doesn't remove OS

Added by Tomer Brisker over 3 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Host groups
Target version:
-
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1436123

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:
  1. hammer hostgroup create --name "AXE" --organizations "Default Organization"
2) Check it via API:
  1. 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:

  1. 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:

  1. 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:

  1. 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.

Associated revisions

Revision 1cbafac4 (diff)
Added by Liza Gilman almost 3 years ago

Fixes #20347 - remove os in db when removing it from the ui

History

#1 Updated by Liza Gilman almost 3 years ago

  • Assignee set to Liza Gilman

#2 Updated by The Foreman Bot almost 3 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/5097 added

#3 Updated by Walden Raines almost 3 years ago

  • Target version set to 239

#4 Updated by Liza Gilman almost 3 years ago

  • % Done changed from 0 to 100
  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF