Bug 887935

Summary: updateinfo xml generated via yum ignores the updated date
Product: Red Hat Enterprise Linux 6 Reporter: Pradeep Kilambi <pkilambi>
Component: yumAssignee: James Antill <jantill>
Status: CLOSED ERRATA QA Contact: Karel Srot <ksrot>
Severity: high Docs Contact:
Priority: medium    
Version: 6.4CC: james.antill, jzeleny, ksrot, pkis, tlavigne, tsanders, zpavlas
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: yum-3.2.29-40.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 10:13:15 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:
Embargoed:
Bug Depends On:    
Bug Blocks: 895654    

Description Pradeep Kilambi 2012-12-17 16:08:42 UTC
Description of problem:

When updateinfo xml is generated via yum api's specifically update_md.UpdateNotice's xml method, it only accounts for issued date and ignored the updated date.

Version-Release number of selected component (if applicable):
yum-3.2.29-22.el6.noarch

How reproducible:
always

Steps to Reproduce:
1. run the xml method in UpdateNotice with updated date passed in.

  
Actual results:
<updates>
<update from="security" status="final" type="bugfix" version="1">
  <id>RHBA-2012:0145</id>
  <title>python-psycopg2 bug fix and enhancement update</title>
  <release></release>
  <issued date="2012-02-17 00:00:00"/>
  <description>The python-psycopg2 package provides a PostgreSQL database adapter for the
Python programming language.
...

<updates>

Expected results:
<updates>
<update from="security" status="final" type="bugfix" version="1">
  <id>RHBA-2012:0145</id>
  <title>python-psycopg2 bug fix and enhancement update</title>
  <release></release>
  <issued date="2012-02-17 00:00:00"/>
  <description>The python-psycopg2 package provides a PostgreSQL database adapter for the
Python programming language.
...
  <updated date="2012-05-17 00:00:00"/>

<updates>

Additional info:

Patch sent upstream

---
 yum/update_md.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/yum/update_md.py b/yum/update_md.py
index e71f9ef..0f31c31 100644
--- a/yum/update_md.py
+++ b/yum/update_md.py
@@ -330,7 +330,9 @@ class UpdateNotice(object):
                 to_xml(self._md['title']), to_xml(self._md['release']),
                 to_xml(self._md['issued'], attrib=True),
                 to_xml(self._md['description']))
-
+        if self._md['updated']:
+            # include the updated date in the generated xml
+            msg += """ <updated date="%s"\n""" % (to_xml(self._md['updated'], attrib=True))
         if self._md['summary']:
             msg += """  <summary>%s</summary>\n""" % (to_xml(self._md['summary']))
         if self._md['solution']:
-- 
1.7.11.7

Comment 1 James Antill 2012-12-17 16:11:19 UTC
Simple fix, should be trivial to test.

Comment 5 Zdeněk Pavlas 2012-12-18 15:13:51 UTC
Just nitpicking, but neither the patch, nor the original code respects DTD order.  The parser does not care, but I'd at least try to keep "issued" and "updated" close.

            <!ELEMENT update (id, synopsis?, issued, updated,
                              references, description, rights?,
                              severity?, summary?, solution?, pkglist)>

Comment 6 Karel Srot 2012-12-19 07:54:56 UTC
Just a note to a proposed patch:

+msg += """ <updated date="%s"\n""" % (to_xml(self._md['updated'], attrib=True))

element in the code above is not closed, it is missing ">".

Comment 13 errata-xmlrpc 2013-02-21 10:13:15 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/RHBA-2013-0406.html