Bug 454238

Summary: bugzilla.getBug and Bug.get don't work as expected
Product: [Community] Bugzilla Reporter: Noura El hawary <nelhawar>
Component: WebServiceAssignee: Noura El hawary <nelhawar>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: 3.2   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-07-22 20:11:17 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 406071    
Attachments:
Description Flags
v1 fix for functions bugzilla.getBug and Bug.get
dkl: review-
v2 fix functions bugzilla.getBug and Bug.get dkl: review+

Description Noura El hawary 2008-07-07 06:25:10 UTC
running the selenium/xmlrpc testsuite getBug and getBugSimple do not work as
expected, they don't return the right output.

Comment 1 Noura El hawary 2008-07-08 05:33:41 UTC
Created attachment 311227 [details]
v1 fix for functions bugzilla.getBug and Bug.get

Basically the function getBugSimple is fine ,, the problem was in
bugzilla.getBug and Bug.get,, the problem was coming from the external bugzilla
extension , as the extension was adding external_bugs object to the actual bug
object as the following:
'external_bugs' => bless( {
			   '_bug_obj' => $VAR1->{'log'},
			   'bugs' => [
				      {
					'is_bz' => undef,
					'url' => 'http://gmome.bugzilla.org',
					'bug_id' => '256',
					'id' => '2',
					'description' => 'kde blah',
					'full_url' => undef
				       }
				    ]
			}, 'extensions::external_bugs::lib::ExternalBugs' ),


and this failing the bug object to be returned in xml, looking in 2.18 in
bugzilla.getBug we only return what is in {external_bugs}{bugs} from the above
so i filtered that in the bug object and it was working fine after. 

the attached patch include:

1- fix for Bug.get as described above.

2- fix for bugzilla.getBug includes the above + returns all missing bug object
info + deleting custom filed names with cf_* as we return it without the cf_*

3- deleted the get_activity function and its pod as it is replaced with
get_history now.

Please review when you can.

Noura

Comment 2 David Lawrence 2008-07-08 18:03:57 UTC
Comment on attachment 311227 [details]
v1 fix for functions bugzilla.getBug and Bug.get

>Index: Bugzilla/WebService/Bug.pm
>===================================================================
>+        $bug->{external_bugs} = $bug->{external_bugs}{bugs};

Please do not access the object as hash unless necessary. So instead do:

	$bug->{external_bugs} = $bug->external_bugs->{bugs};

The fields() sub in Bug.pm should add external_bugs as a valid class accessor
so the above should work.

>Index: extensions/compat_xmlrpc/code/webservice.pl
>===================================================================

>+    $bug->{external_bugs} = $bug->{external_bugs}{bugs};

Same as above.

Comment 3 Noura El hawary 2008-07-09 09:53:41 UTC
Created attachment 311358 [details]
v2 fix functions bugzilla.getBug and Bug.get

Thanks for the review Dave , here is another patch with the fix

Noura

Comment 4 David Lawrence 2008-07-09 15:44:30 UTC
Comment on attachment 311358 [details]
v2 fix functions bugzilla.getBug and Bug.get

Looks good Noura. Assuming it tests ok then feel free to commit.

Dave

Comment 5 Noura El hawary 2008-07-09 21:31:31 UTC
Thanks for the review Dave, all committed to cvs now.

Comment 6 David Lawrence 2008-07-22 20:11:17 UTC
The changes have been pushed to partner-bugzilla.redhat.com and/or have been
recorded in the Bugzilla migration pages on the Bugzilla 3 upgrade Wiki.

Closing as NEXTRELEASE.
Dave