Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 315671 Details for
Bug 446593
FEAT: HwCert catalog should reject results from testing versions of HTS
[?]
New
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.rh83 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 Improve:
hts_version.patch (text/plain), 14.16 KB, created by
XINSUN
on 2008-09-03 18:02:32 UTC
(
hide
)
Description:
Patch Improve:
Filename:
MIME Type:
Creator:
XINSUN
Created:
2008-09-03 18:02:32 UTC
Size:
14.16 KB
patch
obsolete
>Index: attachment.cgi >=================================================================== >RCS file: /cvs/qa/hwcert/attachment.cgi,v >retrieving revision 1.18 >diff -u -r1.18 attachment.cgi >--- attachment.cgi 18 Aug 2008 07:32:56 -0000 1.18 >+++ attachment.cgi 3 Sep 2008 17:57:24 -0000 >@@ -148,6 +148,7 @@ > validateContentType() unless $::FORM{'ispatch'}; > validateObsolete() if $::FORM{'obsolete'}; > validateMd5sumOverride() if $::FORM{'md5sumOverride'}; >+ validateHtsNvrOverride() if $::FORM{'hts_nvr_override'}; > insert($data); > } > elsif ($action eq "edit") >@@ -402,6 +403,17 @@ > ThrowUserError("md5sum_override_permission_deny"); > } > >+sub validateHtsNvrOverride >+{ >+ # Verify that the $hts_nvr_override is legal either way and that the user >+ # has permissions to set it , since the UI uses >+ # an HTML checkbox to represent this flag, and unchecked HTML checkboxes >+ # do not get sent in HTML requests. >+ $::FORM{'hts_nvr_override'} = $::FORM{'hts_nvr_override'} ? 1 : 0; >+ UserInGroup('hwcert_edit') || >+ ThrowUserError("hts_nvr_override_permission_deny"); >+} >+ > sub validateData > { > my $maxsize = $::FORM{'ispatch'} ? Param('maxpatchsize') : Param('maxattachmentsize'); >@@ -942,6 +954,7 @@ > $vars->{'bugassignee_id'} = $assignee_id; > $vars->{'bugsummary'} = $bugsummary; > $vars->{'GetBugLink'} = \&GetBugLink; >+ $vars->{'valid_hts_nvr_list'} = GetValidHtsVersions(); > > print Bugzilla->cgi->header(); > >@@ -956,7 +969,8 @@ > my ($data) = shift @_; > my $isprivate = $::FORM{'isprivate'} ? 1 : 0; > my $md5sum = GenMd5File($filename, $data); >- my $md5sumoverride = $::FORM{'md5sumoverride'} ? 1 : 0; >+ my $md5sumoverride = $::FORM{'md5sumoverride'} ? 1 : 0; >+ my $hts_nvr_override = $::FORM{'hts_nvr_override'} ? 1 : 0; > my $duplicatepackagecomment = ""; > > SendSQL2("SELECT cert_rpms.attach_id, cert_records.bug_id FROM cert_records, cert_rpms " . >@@ -1019,7 +1033,7 @@ > # Support hwcert results package parsing when mimetype is right and checkbox "attachasresult" is checked. > if ( $contenttype =~ /redhat-package-manager|x-rpm|octet-stream|x-pn-realaudio/ && $attachasresult eq "true") > { >- $comment.= processResultsRpm($::FORM{'bugid'}, $filename, $md5sum, $attachid, $attachasresult, $data ); >+ $comment.= processResultsRpm($::FORM{'bugid'}, $filename, $md5sum, $attachid, $attachasresult, $hts_nvr_override, $data ); > } > > use Text::Wrap; >Index: enter.cgi >=================================================================== >RCS file: /cvs/qa/hwcert/enter.cgi,v >retrieving revision 1.4 >diff -u -r1.4 enter.cgi >--- enter.cgi 14 May 2008 13:29:30 -0000 1.4 >+++ enter.cgi 3 Sep 2008 17:57:24 -0000 >@@ -40,6 +40,7 @@ > use Bugzilla; > use Bugzilla::Constants; > require "CGI.pl"; >+require "hwcert.pl"; > > use vars qw( > $unconfirmedstate >@@ -393,6 +394,7 @@ > $default{category} = "Server"; > > $vars->{'default'} = \%default; >+$vars->{'valid_hts_nvr_list'} = GetValidHtsVersions(); > > my $format = > GetFormat("bug/create/create", scalar $cgi->param('format'), >Index: hwcert.pl >=================================================================== >RCS file: /cvs/qa/hwcert/hwcert.pl,v >retrieving revision 1.58 >diff -u -r1.58 hwcert.pl >--- hwcert.pl 3 Sep 2008 05:11:04 -0000 1.58 >+++ hwcert.pl 3 Sep 2008 17:57:25 -0000 >@@ -965,6 +965,113 @@ > } > } > >+sub GetHtsVersion{ >+ my ($scratchlocation, $tmpfilename) = @_; >+ my $version; >+ my $release; >+ >+ foreach my $i (0..500) { >+ my $info_run = "$scratchlocation/var/log/rhr/$tmpfilename/var/log/rhr/runs/$i/INFO/output.log"; >+ if (! -e $info_run) { >+ $info_run = "$scratchlocation/var/log/hts/$tmpfilename/var/log/hts/runs/$i/INFO/output.log"; >+ } >+ >+ open (INFO_RUN, "<$info_run") || next; >+ my @info_rundata = <INFO_RUN>; >+ close (INFO_RUN); >+ >+ foreach my $line (@info_rundata) { >+ if ($line =~ /HTS version (.+), release (\d+)/) { >+ $version = $1; >+ $release = $2; >+ last; >+ } >+ } >+ last if ($version && $release); >+ } >+ if (!$version || !$release) { >+ return undef; >+ } else { >+ my $hts_nvr = "hts-$version-$release"; >+ return $hts_nvr; >+ } >+} >+ >+sub ValidateHtsVersion { >+ my ($nvr_from_rpm) = @_; >+ >+ my $query = "SELECT supported, release_date >+ FROM hts_version >+ WHERE NVR = " . SqlQuote($nvr_from_rpm); >+ SendSQL2($query); >+ >+ if (MoreSQLData2()) { >+ my ($supported, $release_date) = FetchSQLData2(); >+ if ($supported == 1) { >+ $query = "SELECT release_date >+ FROM hts_version >+ WHERE supported = 1 >+ AND release_date > " . SqlQuote($release_date) >+ . "ORDER BY release_date LIMIT 1"; >+ SendSQL2($query); >+ >+ if (MoreSQLData2()) { >+ my $transition_period = 92; >+ my $next_release_date = FetchOneColumn2(); >+ $query = "SELECT (TO_DAYS(NOW()) - TO_DAYS(" . SqlQuote($next_release_date) . ")) > $transition_period"; >+ SendSQL($query); >+ >+ if (FetchOneColumn2() == 1) { >+ return "expired_hts_version"; >+ } else { >+ return "valid_hts_version"; >+ } >+ } else { >+ return "valid_hts_version"; >+ } >+ } else { >+ return "expired_hts_version"; >+ } >+ } else { >+ return "unknown_hts_version"; >+ } >+} >+ >+sub GetValidHtsVersions { >+ my $query = "SELECT NVR, release_date >+ FROM hts_version >+ WHERE supported = 1 >+ ORDER BY release_date DESC"; >+ SendSQL2($query); >+ >+ my @valid_vnr_list; >+ my $transition_period = 92; >+ my $next_release_date = 0; >+ >+ while (MoreSQLData2()) { >+ my ($nvr_from_db,$release_date) = FetchSQLData2(); >+ push(@valid_vnr_list, $nvr_from_db); >+ >+ if ($next_release_date) { >+ my $dbh = Bugzilla->dbh2; >+ $query = "SELECT (TO_DAYS(NOW()) - TO_DAYS(" . SqlQuote($next_release_date) . ")) > $transition_period"; >+ my $sth = $dbh->prepare($query); >+ $sth->execute(); >+ my ($exceeded) = $sth->fetchrow_array(); >+ >+ if ($exceeded) { >+ $query = "UPDATE hts_version SET supported = 0 WHERE NVR = " . SqlQuote($nvr_from_db) . " AND supported = 1"; >+ $dbh->do($query); >+ pop(@valid_vnr_list); >+ } >+ >+ } >+ $next_release_date = $release_date; >+ } >+ >+ return \@valid_vnr_list; >+} >+ > sub CheckRequiredTests { > my ($kickstart, $tests_ran_ref) = @_; > my @tests_ran = @{$tests_ran_ref}; >@@ -1007,7 +1114,8 @@ > my $filename = shift @_; > my $md5sum = shift@_; > my $attachid = shift @_; >- my $attachasresult =shift @_; >+ my $attachasresult = shift @_; >+ my $hts_nvr_override = shift @_; > my ($data) = @_; > > # Create a local package >@@ -1049,6 +1157,24 @@ > my ($name,$version) = NameVerRel($rpmlocation); > my $tmpfilename = "$name-$version"; > >+ # Get the hts nvr >+ my $hts_nvr = GetHtsVersion($scratchlocation, $tmpfilename); >+ >+ my $validate_result = ValidateHtsVersion($hts_nvr); >+ >+ if ($validate_result ne "valid_hts_version" && !$hts_nvr_override) { >+ #Clean up before throw user error >+ UnlinkPath($scratchlocation); >+ UnlinkPath($rpmlocation); >+ if ($validate_result eq "expired_hts_version") { >+ my $valid_hts_nvr_list = GetValidHtsVersions(); >+ my $current_hts_nvr = shift @$valid_hts_nvr_list; >+ ThrowUserError("invalid_hts_version_expired",{hts_nvr=> "$hts_nvr", filename=> "$filename", current_hts_nvr=> "$current_hts_nvr"}); >+ } else { >+ ThrowUserError("invalid_hts_version_unknown",{hts_nvr=> "$hts_nvr"}); >+ } >+ } >+ > # Use GetTestInfo to grab each of the hardware and output.log files from the scratch dir > my ($testsref, $listref, $kernelver); > ($testsref, $listref, $kernelver) = GetTestInfo($scratchlocation, $tmpfilename); >Index: post.cgi >=================================================================== >RCS file: /cvs/qa/hwcert/post.cgi,v >retrieving revision 1.63 >diff -u -r1.63 post.cgi >--- post.cgi 3 Sep 2008 03:02:04 -0000 1.63 >+++ post.cgi 3 Sep 2008 17:57:26 -0000 >@@ -236,6 +236,32 @@ > > if ($cgi->param('md5') || $cgi->upload('data')) { > >+ my $hts_nvr_override = $cgi->param('hts_nvr_override') ? 1 : 0; >+ # Valide the hts_nvr_override permission >+ if ($hts_nvr_override && !UserInGroup('hwcert_edit')) { >+ UnlinkPath($scratchlocation); >+ UnlinkPath($rpmlocation); >+ ThrowUserError("hts_nvr_override_permission_deny"); >+ } >+ >+ # Get the hts nvr >+ my $hts_nvr = GetHtsVersion($scratchlocation, $tmpfilename); >+ >+ my $validate_result = ValidateHtsVersion($hts_nvr); >+ >+ if ($validate_result ne "valid_hts_version" && !$hts_nvr_override) { >+ # Clean up before throw user error >+ UnlinkPath($scratchlocation); >+ UnlinkPath($rpmlocation); >+ if ($validate_result eq "expired_hts_version") { >+ my $valid_hts_nvr_list = GetValidHtsVersions(); >+ my $current_hts_nvr = shift @$valid_hts_nvr_list; >+ ThrowUserError("invalid_hts_version_expired",{hts_nvr=> "$hts_nvr", filename=> "$filename", current_hts_nvr=> "$current_hts_nvr"}); >+ } else { >+ ThrowUserError("invalid_hts_version_unknown",{hts_nvr=> "$hts_nvr"}); >+ } >+ } >+ > # Use GetTestInfo to grab each of the hardware and output.log files from the scratch dir > my ($testsref, $listref); > ($testsref, $listref, $kernelver, $platform) = GetTestInfo($scratchlocation, $tmpfilename); >Index: process.cgi >=================================================================== >RCS file: /cvs/qa/hwcert/process.cgi,v >retrieving revision 1.37 >diff -u -r1.37 process.cgi >--- process.cgi 3 Sep 2008 05:07:42 -0000 1.37 >+++ process.cgi 3 Sep 2008 17:57:27 -0000 >@@ -2723,6 +2723,7 @@ > } > $vars->{'cert_types'} = \@::test_types; > $vars->{'current_tab'} = $cgi->param('current_tab'); >+ $vars->{'valid_hts_nvr_list'} = GetValidHtsVersions(); > > $template->process("bug/process/next.html.tmpl", $vars) > || ThrowTemplateError($template->error()); >Index: show.cgi >=================================================================== >RCS file: /cvs/qa/hwcert/show.cgi,v >retrieving revision 1.16 >diff -u -r1.16 show.cgi >--- show.cgi 24 Jul 2008 13:07:42 -0000 1.16 >+++ show.cgi 3 Sep 2008 17:57:28 -0000 >@@ -221,6 +221,7 @@ > } > > $vars->{'cert_types'} = \@::test_types; >+$vars->{'valid_hts_nvr_list'} = GetValidHtsVersions(); > > print $cgi->header($format->{'ctype'}); > >Index: template/en/default/bug/upload_packages.html.tmpl >=================================================================== >RCS file: /cvs/qa/hwcert/template/en/default/bug/upload_packages.html.tmpl,v >retrieving revision 1.5 >diff -u -r1.5 upload_packages.html.tmpl >--- template/en/default/bug/upload_packages.html.tmpl 30 Jul 2008 16:31:34 -0000 1.5 >+++ template/en/default/bug/upload_packages.html.tmpl 3 Sep 2008 17:57:28 -0000 >@@ -66,11 +66,13 @@ > <tr> > <th>Options:</th> > <td> >- <input type="checkbox" name="attachasresult" id="attachasresult" value="true" checked>Attach as result >+ <input type="checkbox" name="attachasresult" id="attachasresult" value="true" checked>Attach as result</input> > [% IF UserInGroup('hwcert_edit') %] > <br> >- <input type="checkbox" name="md5sumoverride" value="false">Override md5sum check >+ <input type="checkbox" name="md5sumoverride" value="false">Override md5sum check</input> > [% END %] >+ <br> >+ [% PROCESS bug/hts_version.html.tmpl valid_hts_nvr_list = valid_hts_nvr_list %] > </td> > </tr> > </table> >Index: template/en/default/bug/create/create.html.tmpl >=================================================================== >RCS file: /cvs/qa/hwcert/template/en/default/bug/create/create.html.tmpl,v >retrieving revision 1.14 >diff -u -r1.14 create.html.tmpl >--- template/en/default/bug/create/create.html.tmpl 21 Jul 2008 06:11:05 -0000 1.14 >+++ template/en/default/bug/create/create.html.tmpl 3 Sep 2008 17:57:30 -0000 >@@ -179,7 +179,15 @@ > <td> > <input type=text" name="description" size="50"> > </td> >- <table> >+ </tr> >+ <tr> >+ <th> >+ [% IF UserInGroup('hwcert_edit') %] Options [% END %] >+ </th> >+ <td> >+ [% PROCESS bug/hts_version.html.tmpl valid_hts_nvr_list = valid_hts_nvr_list %] >+ </td> >+ </table> > </p> > <br /> > >Index: template/en/default/global/user-error.html.tmpl >=================================================================== >RCS file: /cvs/qa/hwcert/template/en/default/global/user-error.html.tmpl,v >retrieving revision 1.21 >diff -u -r1.21 user-error.html.tmpl >--- template/en/default/global/user-error.html.tmpl 3 Sep 2008 05:07:43 -0000 1.21 >+++ template/en/default/global/user-error.html.tmpl 3 Sep 2008 17:57:31 -0000 >@@ -392,6 +392,14 @@ > [% END %] > ). > >+ [% ELSIF error == "invalid_hts_version_expired" %] >+ [% title = "Invalid HTS version (expired)" %] >+ [% hts_nvr FILTER html %] used in package [% filename FILTER html %] has been replaced by [% current_hts_nvr FILTER html %] and is no longer accepted. Please use <a href=https://rhn.redhat.com>[% current_hts_nvr FILTER html %]</a> for submitting official test results. >+ >+ [% ELSIF error == "invalid_hts_version_unknown" %] >+ [% title = "Invalid HTS version (unknown)" %] >+ [% hts_nvr FILTER html %] is not an official release and can not be used for official certifications. >+ > [% ELSIF error == "invalid_maxrows" %] > [% title = "Invalid Max Rows" %] > The maximum number of rows, '[% maxrows FILTER html %]', must be >@@ -448,6 +456,11 @@ > [% title = "HTS Package Required" %] > Test results not found: Data can only be parsed from hts test result packages. > >+ [% ELSIF error == "hts_nvr_override_permission_deny"%] >+ [% title = "HTS version Override Permission Deny" %] >+ You are not authorized to override the HTS version check. >+ >+ > [% ELSIF error == "hwcert_group_access_denied" %] > [% title = "Permission Denied" %] > You do not have permission to [% action FILTER html %].
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 446593
:
315671
|
315672
|
315825
|
315833
|
315834
|
316167
|
316168