Bug 1320459

Summary: Unable to specify location and organization for partition table entity
Product: Red Hat Satellite Reporter: Oleksandr Shtaier <oshtaier>
Component: APIAssignee: Marek Hulan <mhulan>
Status: CLOSED ERRATA QA Contact: jcallaha
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.2.0CC: bbuckingham, ehelms, jcallaha, kbidarka, mhulan
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 11:31:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Oleksandr Shtaier 2016-03-23 09:34:42 UTC
Description of problem:
In 6.2 partition table becomes visible in UI only per specific organization and location, so it is a problem to operate with them for any possible operation for Operating System or Host entities if I create such partition table through API as I am not able to create it for current organization or location:

POST /api/ptables
Create a partition table
Params

ptable
required 	

ptable[name]
required 	

ptable[layout]
required 	

ptable[snippet]
optional , nil allowed 	

ptable[audit_comment]
optional , nil allowed 	

ptable[locked]
optional , nil allowed 	

ptable[os_family]
optional , nil allowed 	

ptable[operatingsystem_ids]
optional , nil allowed 	

ptable[host_ids]
optional , nil allowed 	

ptable[hostgroup_ids]
optional , nil allowed

In overall, we have inconsistency between CLI, API and UI as we can create ptable with organization and location from UI and Hammer correspondingly:
hammer partition-table create --help
Options:
...
 --location-ids LOCATION_IDS               REPLACE locations with given ids
                                           Comma separated list of values.
 --locations LOCATION_NAMES                Comma separated list of values.
...
 --organization-ids ORGANIZATION_IDS       REPLACE organizations with given ids.
                                           Comma separated list of values.
 --organizations ORGANIZATION_NAMES        Comma separated list of values.
...
	

Version-Release number of selected component (if applicable):
6.2 SNAP4

How reproducible:
Always

Steps to Reproduce:
1. Try to create or update partition table entity
2.
3.

Actual results:
It is not possible to specify location or organization for partition table

Expected results:
Partition table entity can be created with location and organization

Additional info:

Comment 1 Oleksandr Shtaier 2016-03-23 09:38:37 UTC
Putting it as a blocker?, because:
1) It is a blocker for test automation scripts
2) Inconsistency between CLI, API and UI
3) Can be a confuse factor for users as it can take time to understand where just created entity is
4) Affects too many other entities and also can be confusing why corresponding select lists for these entities are disabled at all

Comment 3 Oleksandr Shtaier 2016-03-23 11:01:26 UTC
Of course, it is an old thing, but only in 6.2 it becomes a serious thing according description above

Comment 4 Marek Hulan 2016-03-23 15:12:49 UTC
I've checked API v2 and I am able to create a ptable and associate it to organization. The only thing that I was able to find broken is documentation at /apidoc/v2/ptables/create.html which gets fixed after I run

    foreman-rake apipie:cache

I'm removing a blocker flag since I believe it's usable. If you are unable to set organizations and locations through API, please describe how you call it.

Comment 5 Marek Hulan 2016-03-23 15:40:33 UTC
The issue I described in previous comment is caused by having organizations and locations disabled during packaging phase were we generate the documentation. In %postrans we only run rake apipie:cache:index which does not regenerate the documentation but the index for hammer, that's why hammer works.

Comment 8 jcallaha 2016-05-24 19:55:33 UTC
Verified in Satellite 6.2 Beta Snap 12.

It is now possible to specify a location and organization for a partition table upon creation.

POST payload
{
  "layout": "<%#\nkind: ptable\nname: test ptable\n%>",
  "os_family": "Freebsd",
  "name": "test ptable",
  "locations": [{"id": 2}],
  "organizations": [{"id": 1}]
}

Received
{
  "layout": "<%#\nkind: ptable\nname: test ptable\n%>",
  "os_family": "Freebsd",
  "created_at": "2016-05-24 19:54:37 UTC",
  "updated_at": "2016-05-24 19:54:37 UTC",
  "name": "test ptable",
  "id": 110,
  "operatingsystems": [],
  "locations": [
    {
      "id": 2,
      "name": "Default Location",
      "title": "Default Location",
      "description": null
    }
  ],
  "organizations": [
    {
      "id": 1,
      "name": "Default Organization",
      "title": "Default Organization",
      "description": null
    }
  ]
}

Comment 9 Bryan Kearney 2016-07-27 11:31:00 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/RHBA-2016:1501