Bug 798786

Summary: JSON returns incorrect URLs from _attrs
Product: [Retired] CloudForms Cloud Engine Reporter: Brad P. Crochet <brad>
Component: iwhdAssignee: Jim Meyering <meyering>
Status: CLOSED ERRATA QA Contact: Brad P. Crochet <brad>
Severity: high Docs Contact:
Priority: unspecified    
Version: 1.0.0CC: akarol, deltacloud-maint, jrd, mkoci, ssachdev, whayutin
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-05-15 20:05:58 UTC Type: ---
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
Remove attr_ from JSON template none

Description Brad P. Crochet 2012-02-29 20:53:58 UTC
Description of problem:
Asking for _attrs on an object returns the wrong URL. attr_ is prepended to the attr name. The XML correctly does not include attr_

Version-Release number of selected component (if applicable):
iwhd-1.2-3.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1. curl -H 'Accept: */json' http://localhost:9090/images/cdb4d9cb-f9f9-469c-b88c-649af9eaea8b/_attrs
2.
3.
  
Actual results:
{
	"object_body": "http://localhost:9090/images/cdb4d9cb-f9f9-469c-b88c-649af9eaea8b",
	"object_attr_list": "http://localhost:9090/images/cdb4d9cb-f9f9-469c-b88c-649af9eaea8b/_attrs",
	"attr_latest_build": "http://localhost:9090/images/cdb4d9cb-f9f9-469c-b88c-649af9eaea8b/attr_latest_build",
	"attr_latest_unpushed": "http://localhost:9090/images/cdb4d9cb-f9f9-469c-b88c-649af9eaea8b/attr_latest_unpushed",
	"attr_object_type": "http://localhost:9090/images/cdb4d9cb-f9f9-469c-b88c-649af9eaea8b/attr_object_type",
	"attr_template": "http://localhost:9090/images/cdb4d9cb-f9f9-469c-b88c-649af9eaea8b/attr_template",
	"attr_uuid": "http://localhost:9090/images/cdb4d9cb-f9f9-469c-b88c-649af9eaea8b/attr_uuid"
}


Expected results:
{
	"object_body": "http://localhost:9090/images/cdb4d9cb-f9f9-469c-b88c-649af9eaea8b",
	"object_attr_list": "http://localhost:9090/images/cdb4d9cb-f9f9-469c-b88c-649af9eaea8b/_attrs",
	"attr_latest_build": "http://localhost:9090/images/cdb4d9cb-f9f9-469c-b88c-649af9eaea8b/latest_build",
	"attr_latest_unpushed": "http://localhost:9090/images/cdb4d9cb-f9f9-469c-b88c-649af9eaea8b/latest_unpushed",
	"attr_object_type": "http://localhost:9090/images/cdb4d9cb-f9f9-469c-b88c-649af9eaea8b/object_type",
	"attr_template": "http://localhost:9090/images/cdb4d9cb-f9f9-469c-b88c-649af9eaea8b/template",
	"attr_uuid": "http://localhost:9090/images/cdb4d9cb-f9f9-469c-b88c-649af9eaea8b/uuid"
}


Additional info:

Comment 2 Brad P. Crochet 2012-02-29 21:02:09 UTC
Factory uses the XML version. If conductor does as well, this is not a high priority for 1.0. If any other part of Aeolus uses json, this needs to be a blocker and fixed for 1.0.

Comment 3 Brad P. Crochet 2012-02-29 21:51:10 UTC
Created attachment 566656 [details]
Remove attr_ from JSON template

Comment 4 Jim Meyering 2012-03-02 20:34:06 UTC
Thanks for the report.
Here's a patch:

  http://thread.gmane.org/gmane.comp.lib.iwhd.devel/1094

Comment 6 wes hayutin 2012-04-13 21:46:29 UTC
json looks cleaned up


[root@apollo aeolus-conductor]# curl -H 'Accept: */json' http://localhost:9090/images/005ed09e-8402-11e1-afcd-0015172f2b30/_attrs
{
	"object_body": "http://localhost:9090/images/005ed09e-8402-11e1-afcd-0015172f2b30",
	"object_attr_list": "http://localhost:9090/images/005ed09e-8402-11e1-afcd-0015172f2b30/_attrs",
	"environment": "http://localhost:9090/images/005ed09e-8402-11e1-afcd-0015172f2b30/environment",
	"latest_build": "http://localhost:9090/images/005ed09e-8402-11e1-afcd-0015172f2b30/latest_build",
	"latest_unpushed": "http://localhost:9090/images/005ed09e-8402-11e1-afcd-0015172f2b30/latest_unpushed",
	"object_type": "http://localhost:9090/images/005ed09e-8402-11e1-afcd-0015172f2b30/object_type",
	"template": "http://localhost:9090/images/005ed09e-8402-11e1-afcd-0015172f2b30/template",
	"uuid": "http://localhost:9090/images/005ed09e-8402-11e1-afcd-0015172f2b30/uuid"
}
[root@apollo aeolus-conductor]# curl -H 'Accept: */xml' http://localhost:9090/images/15b837ae-85a2-11e1-9aec-0015172f2b30/_attrs
<object>
	<object_body path="http://localhost:9090/images/15b837ae-85a2-11e1-9aec-0015172f2b30"/>
	<object_attr_list path="http://localhost:9090/images/15b837ae-85a2-11e1-9aec-0015172f2b30/_attrs"/>
	<object_attr name="environment" path="http://localhost:9090/images/15b837ae-85a2-11e1-9aec-0015172f2b30/environment"/>
	<object_attr name="latest_unpushed" path="http://localhost:9090/images/15b837ae-85a2-11e1-9aec-0015172f2b30/latest_unpushed"/>
	<object_attr name="object_type" path="http://localhost:9090/images/15b837ae-85a2-11e1-9aec-0015172f2b30/object_type"/>
	<object_attr name="template" path="http://localhost:9090/images/15b837ae-85a2-11e1-9aec-0015172f2b30/template"/>
	<object_attr name="uuid" path="http://localhost:9090/images/15b837ae-85a2-11e1-9aec-0015172f2b30/uuid"/>
</object>
[root@apollo aeolus-conductor]# 

[root@apollo aeolus-conductor]# rpm -qa | grep iwhd
iwhd-1.5-2.el6.x86_64
[root@apollo aeolus-conductor]# rpm -qa | grep aeolus
rubygem-aeolus-cli-0.3.1-1.el6.noarch
rubygem-aeolus-image-0.3.0-12.el6.noarch
aeolus-conductor-0.8.7-1.el6.noarch
aeolus-conductor-daemons-0.8.7-1.el6.noarch
aeolus-conductor-doc-0.8.7-1.el6.noarch
aeolus-configure-2.5.2-1.el6.noarch
aeolus-all-0.8.7-1.el6.noarch

Comment 7 Jim Meyering 2012-04-17 13:35:07 UTC
As implied by comment#4 above, this fix is in iwhd-1.4.

Comment 9 errata-xmlrpc 2012-05-15 20:05:58 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.

http://rhn.redhat.com/errata/RHEA-2012-0589.html