Login
Log in using an SSO provider:
Fedora Account System
Red Hat Associate
Red Hat Customer
Login using a Red Hat Bugzilla account
Forgot Password
Create an Account
Red Hat Bugzilla – Attachment 385621 Details for
Bug 556719
Need to add a new xmlrpc API: hwcert.getPartnerInfo
Home
New
Search
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh90 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
[?]
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Patch improves:
a.patch (text/plain), 5.55 KB, created by
XINSUN
on 2010-01-20 08:45:21 UTC
(
hide
)
Description:
Patch improves:
Filename:
MIME Type:
Creator:
XINSUN
Created:
2010-01-20 08:45:21 UTC
Size:
5.55 KB
patch
obsolete
>Index: webservice.pl >=================================================================== >--- webservice.pl (revision 210) >+++ webservice.pl (working copy) >@@ -33,8 +33,13 @@ > use base qq(Bugzilla::WebService); > import SOAP::Data qq(type); > >-# function to return all certs information >-# $call = $rpc->call( 'hwcert.getCertList', >+ >+# Name: getCertList >+# >+# Function: Return certs' information filtered by parameter. >+# >+# Usage: >+# $call = $rpc->call( 'hwcert.getCertList', > # { vendor => ['hp', 'dell'], > # make => ['poweredge'], > # model => ['x2451'], >@@ -45,11 +50,19 @@ > # return_field => ["vendor", "make", "model", "spec_url", "bug_id", "category", "product", "version", > # "platform", "passthrough"] > # }); >+# Parameter: >+# A hash with keys: vendor(filter field), make(filter field), model(filter field), category(filter field), product(filter field), platform(filter field), passthrough(filter field), return_field(optional return field). All keys are optional. >+# >+# Return: >+# It will return an Array whose element is a cert_info hash whose key is defined by $parameter{return_field}. >+# If $parameter{return_field} is not provided, it will return all predefine field: >+# [vendor, make, model, category, product, platform, passthrough] >+# If $parameter is not provided, it will return all certs' information in our hwcert. > > sub getCertList { > my ($self, $params) = @_; > >- $logger->debug("Starting: hwcert-getCertList"); >+ $logger->debug("Starting: hwcert-xmlrpc-getCertList"); > > #my @legal_fields = ("vendor", "make", "model", "spec_url", "bug_id", "category", "product", "version", "platform", "passthrough"); > my %legal_field_map = ( >@@ -180,6 +193,8 @@ > > my $dbh = Bugzilla->dbh; > my $query = "SELECT $sql_fields FROM $sql_join_table WHERE $sql_cond"; >+ $logger->debug("hwcert-xmlrpc-getCertList: Sql execute: $query"); >+ > my $sth = $dbh->prepare($query); > $sth->execute(); > >@@ -194,46 +209,35 @@ > push(@certlist, \%cert_info); > } > >- $logger->debug("Ending: hwcert-getCertList"); >+ $logger->debug("Ending: hwcert-xmlrpc-getCertList"); > > return \@certlist; > } > >-# function to return all partners information >-# $call = $rpc->call( 'hwcert.getPartnerInfo', >-# { vendor => ['hp', 'dell'], >-# return_field => ["vendor", "make"] >+ >+# Name: getPartnerInfo >+# >+# Function: Return partner's information by paramter:vendor. >+# >+# Usage: >+# $call = $rpc->call( 'hwcert.getPartnerInfo', >+# { vendor => ['hp', 'dell'] > # }); >+# >+# Parameter: >+# A hash with a key name "vendor" and an array or string for vendor names as value. >+# If no parameter is provided, it will return all partner's information. >+# >+# Return: >+# A hash with keys which are partner name and an arrary for make name of this partner as value. > > sub getPartnerInfo { > my ($self, $params) = @_; > >- $logger->debug("Starting: hwcert-getPartnerInfo"); >+ $logger->debug("Starting: hwcert-xmlrpc-getPartnerInfo"); > >- my %legal_field_map = ( >- 'vendor' => 'cf_partner.value', >- 'make' => 'rh_hwcert_make.name' >- ); >- #Parse retrun_field for sql_field. >- my @return_fields; >- if (defined $params->{return_field}) { >- @return_fields = ref($params->{return_field}) =~ /ARRAY/ ? @{$params->{return_field}} : ($params->{return_field}); >- } else { >- @return_fields = keys %legal_field_map; >- } >- >- my @inner_fields; >- my @valid_return_field; >- foreach my $field_name (@return_fields) { >- if (defined($legal_field_map{$field_name})) { >- push(@valid_return_field, $field_name); >- push(@inner_fields, $legal_field_map{$field_name}); >- } >- } >- >- my $sql_fields = join(',', @inner_fields); >- my $sql_join_table = "rh_hwcert_make, cf_partner"; >- >+ my $sql_fields = "cf_partner.value, rh_hwcert_make.name"; >+ my $sql_join_table = "rh_hwcert_make, cf_partner"; > my $sql_cond = " rh_hwcert_make.cf_partner_id = cf_partner.id > AND cf_partner.isactive = 1"; > >@@ -252,22 +256,25 @@ > > my $dbh = Bugzilla->dbh; > my $query = "SELECT $sql_fields FROM $sql_join_table WHERE $sql_cond"; >+ $logger->debug("hwcert-xmlrpc-getPartnerInfo : Sql execute: $query"); >+ > my $sth = $dbh->prepare($query); > $sth->execute(); > >- my @partnerlist; >+ my %partner_info_list; > while ( my @row = $sth->fetchrow_array() ) { >- my %partner_info; >- foreach my $field_name (@valid_return_field) { >- if (scalar(@row) > 0) { >- $partner_info{$field_name} = shift(@row); >- } >+ if (scalar(@row) > 0) { >+ my $partner_name = shift(@row); >+ my $make_name = shift(@row); >+ >+ $partner_info_list{$partner_name} = [] unless (exists $partner_info_list{$partner_name}); >+ push(@{$partner_info_list{$partner_name}}, $make_name); > } >- push(@partnerlist, \%partner_info); > } > >- $logger->debug("Ending: hwcert-getPartnerInfo"); >- return \@partnerlist; >+ $logger->debug("Ending: hwcert-xmrpc-getPartnerInfo"); >+ >+ return \%partner_info_list; > > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 556719
:
385331
|
385621
|
386766