Bug 1460559

Summary: AttributeError: MetaDataGenerator instance has no attribute 'oldData'
Product: Red Hat Enterprise Linux 6 Reporter: Ashfaqur Rahaman <arahaman>
Component: createrepoAssignee: Valentina Mukhamedzhanova <vmukhame>
Status: CLOSED DUPLICATE QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.9CC: james.antill
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-06-12 09:16:57 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:

Description Ashfaqur Rahaman 2017-06-12 02:17:07 UTC
Description of problem:

Createrepo gives the error if there is no new package added in the repository. 

Version-Release number of selected component (if applicable):

# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.9 (Santiago)

# rpm -qa|grep createrepo
createrepo-0.9.9-26.el6.noarch


How reproducible:
100%


Steps to Reproduce:
1. create a repository with createrepo 
# createrepo /repo 

2. Update the repository without adding any new package : 
# createrepo -C --update /repo 

Actual results:
------------------
# createrepo -C --update /repo
Traceback (most recent call last):
  File "/usr/share/createrepo/genpkgmetadata.py", line 307, in <module>
    main(sys.argv[1:])
  File "/usr/share/createrepo/genpkgmetadata.py", line 296, in main
    mdgen.cleanup()
  File "/usr/lib/python2.6/site-packages/createrepo/__init__.py", line 1208, in cleanup
    self._cleanup_update_tmp_dir()
  File "/usr/lib/python2.6/site-packages/createrepo/__init__.py", line 1213, in _cleanup_update_tmp_dir
    self.oldData.cleanup()
AttributeError: MetaDataGenerator instance has no attribute 'oldData'
-----------------

Expected results:
Should not give any error. 

Additional info:

Customer reported also that Lines 294-296 of /usr/share/createrepo/genpkgmetadata.py should be deleted. The traceback happens because self.oldData is not initialised when the code exits in line 261 when there are no new packages.

~~~
#    finally:
#         if mdgen:
#             mdgen.cleanup()
~~~

Comment 2 Ashfaqur Rahaman 2017-06-12 09:16:57 UTC

*** This bug has been marked as a duplicate of bug 1434369 ***