Bug 1328265

Summary: parent tenant name changes are not reflected via the api
Product: Red Hat CloudForms Management Engine Reporter: Colin Arnott <carnott>
Component: APIAssignee: Šimon Lukašík <slukasik>
Status: CLOSED CURRENTRELEASE QA Contact: Martin Kourim <mkourim>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.5.0CC: benglish, jhardy, jprause, obarenbo, psavage, simaishi, slukasik
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.7.0   
Hardware: x86_64   
OS: Linux   
Whiteboard: rest:tenant
Fixed In Version: 5.7.0.0 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1340072 (view as bug list) Environment:
Last Closed: 2017-01-11 19:51:34 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:
Attachments:
Description Flags
webUI for cfme tenants none

Description Colin Arnott 2016-04-18 20:29:13 UTC
Created attachment 1148279 [details]
webUI for cfme tenants

Description of problem:
when you change the main parent tenant's name that change is not reflected in api calls

Version-Release number of selected component (if applicable):
cfme-5.5.3.4-1.el7cf.x86_64

How reproducible:
very

Steps to Reproduce:
0. rename the default parent tenant
1. $ curl https://example.com/api/tenants/1000000000001

Actual results:
{"href":"https://example.com/api/tenants/1000000000001","id":1000000000001,"name":"My Company","divisible":true,"description":"Tenant for My Company","use_config_for_attributes":true,"default_miq_group_id":1000000000001,"actions":[{"name":"edit","method":"post","href":"https://example.com/api/tenants/1000000000001"},{"name":"delete","method":"post","href":"https://example.com/api/tenants/1000000000001"},{"name":"delete","method":"delete","href":"https://example.com/api/tenants/1000000000001"}]}

Expected results:
{"href":"https://example.com/api/tenants/1000000000001","id":1000000000001,"name":"Red Hat Support","divisible":true,"description":"Tenant for My Company","use_config_for_attributes":true,"default_miq_group_id":1000000000001,"actions":[{"name":"edit","method":"post","href":"https://example.com/api/tenants/1000000000001"},{"name":"delete","method":"post","href":"https://example.com/api/tenants/1000000000001"},{"name":"delete","method":"delete","href":"https://example.com/api/tenants/1000000000001"}]}

Additional info:
the attached screenshot displays the information that can be seen through the webUI

it is assumed that this is due to the inability to rename a tenant after creation, however this could be inaccurate.

Comment 3 Šimon Lukašík 2016-04-26 14:30:45 UTC
For the record, this is related to bug 1265221.

Comment 4 CFME Bot 2016-05-23 23:00:57 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/4a92b0f458bc0f8ef04e44fdce716547bf3e6025

commit 4a92b0f458bc0f8ef04e44fdce716547bf3e6025
Author:     Šimon Lukašík <isimluk>
AuthorDate: Tue Apr 26 12:29:27 2016 +0200
Commit:     Šimon Lukašík <isimluk>
CommitDate: Tue Apr 26 12:29:27 2016 +0200

    Respect local overrides when serializing ActiveRecord to json
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1328265
    
    Some models override default accessors like Tenant#name does. When
    serializing these models to json, we should respect the overrides. That
    way we ensure that webui and api present consistent data.

 app/controllers/api_controller/normalizer.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comment 6 Martin Kourim 2016-10-06 17:06:26 UTC
Verified by changing main parent tenant's name in user Configuration -> Access Control -> Tenants -> My Company, selected Configuration -> "Edit this item", set "Use Configuration Settings" to No, changed Name, saved, and verified using "GET /api/tenants/1" request that the change was reflected via the api.