Bug 823491 - rhnpush fails with NameError: global name 'h' is not defined
Summary: rhnpush fails with NameError: global name 'h' is not defined
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Spacewalk
Classification: Community
Component: Server
Version: 1.7
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jan Pazdziora (Red Hat)
QA Contact: Red Hat Satellite QA List
URL:
Whiteboard:
Depends On:
Blocks: space18
TreeView+ depends on / blocked
 
Reported: 2012-05-21 11:38 UTC by James Hogarth
Modified: 2012-11-01 16:19 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
: 824777 (view as bug list)
Environment:
Last Closed: 2012-11-01 16:19:47 UTC
Embargoed:


Attachments (Terms of Use)
Patch that appears to fix the issue (468 bytes, text/plain)
2012-05-21 11:38 UTC, James Hogarth
no flags Details

Description James Hogarth 2012-05-21 11:38:17 UTC
Created attachment 585789 [details]
Patch that appears to fix the issue

Description of problem:
rhnpush fails with a global name h not defined error - line 506 of /usr/share/rhn/rhnpush/uploadLib.py

Version-Release number of selected component (if applicable):
spacewalk 1.7 
rhnpush-5.5.42-1.el6.noarch

How reproducible:
Everytime

Steps to Reproduce:
1. Obtain RPM from somewhere
2. rhnpush to the spacewalk server
3. observe error
  
Actual results:
Get the error: global name h not defined 

Expected results:
RPM package uploaded

Additional info:
I could have sworn this worked a couple of weeks ago - but I may be imagining it....

Locally editing /usr/share/rhn/rhnpush/uploadLib.py seems then to allow stuff to work (the channel page still has arch so I assume this change works...) - patch attached.

Comment 1 Jan Pazdziora (Red Hat) 2012-05-21 11:43:43 UTC
The issue is caused by 4ed2374ccbc7f7dedb8fe6eaf7322700f06a4ca7 when the

h = get_header(None, f.fileno(), source)

was replaced with

a_pkg = package_from_filename(filename)

I assume the proper fix is

diff --git a/client/tools/rhnpush/uploadLib.py b/client/tools/rhnpush/uploadLib.py
index 2d0ed35..aae1604 100644
--- a/client/tools/rhnpush/uploadLib.py
+++ b/client/tools/rhnpush/uploadLib.py
@@ -503,7 +503,7 @@ class UploadClass:
         if source:
             lh.append('src')
         else:
-            lh.append(h['arch'])
+            lh.append(a_pkg.header['arch'])
 
         # Build the header hash to be sent
         hash = { 'header' : Binary(a_pkg.header.unload()),

Comment 2 James Hogarth 2012-05-21 11:47:25 UTC
Thanks for the correction Jan - that works on my testing here.

Comment 3 Jan Pazdziora (Red Hat) 2012-05-21 11:50:07 UTC
Fixed in Spacewalk master, 03a1c48d59401856b2ffb4b2a96c4d51375b2cf4.

Comment 4 Jan Pazdziora (Red Hat) 2012-10-30 19:24:27 UTC
Moving ON_QA. Packages that address this bugzilla should now be available in yum repos at http://yum.spacewalkproject.org/nightly/

Comment 5 Jan Pazdziora (Red Hat) 2012-11-01 16:19:47 UTC
Spacewalk 1.8 has been released: https://fedorahosted.org/spacewalk/wiki/ReleaseNotes18


Note You need to log in before you can comment on or make changes to this bug.