Bug 1309468 - UnboundLocalError: local variable 'primif' referenced before assignment
Summary: UnboundLocalError: local variable 'primif' referenced before assignment
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Spacewalk
Classification: Community
Component: Server
Version: 2.4
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Tomáš Kašpárek
QA Contact: Red Hat Satellite QA List
URL:
Whiteboard:
Depends On:
Blocks: space27
TreeView+ depends on / blocked
 
Reported: 2016-02-17 22:05 UTC by W. Andrew Denton
Modified: 2017-09-28 18:11 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-06-16 07:52:43 UTC
Embargoed:


Attachments (Terms of Use)

Description W. Andrew Denton 2016-02-17 22:05:03 UTC
Description of problem:
Registering a certain system causes 500 Internal Server error. This appears to be due to an interface on the client system that has no IP address.

Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/spacewalk/server/apacheRequest.py", line 129, in call_function
    response = func(*params)
  File "/usr/share/rhn/server/handlers/xmlrpc/registration.py", line 1030, in add_hw_profile
    if primif:
UnboundLocalError: local variable 'primif' referenced before assignment


Version-Release number of selected component (if applicable):
spacewalk-backend-xmlrpc-2.4.23-1.el6.noarch


How reproducible:
Always

This change fixes the problem for me:

--- /usr/share/rhn/server/handlers/xmlrpc/registration.py.orig	2016-02-17 14:02:46.742891028 -0800
+++ /usr/share/rhn/server/handlers/xmlrpc/registration.py	2016-02-17 13:40:28.343527458 -0800
@@ -1011,6 +1011,7 @@
         if row:
             ipaddr=row['ipaddr']
             ip6addr=row['ip6addr']
+            primif = None
             if ipaddr:
                 h = rhnSQL.prepare("""
                     select interface_id from rhnServerNetAddress4 where address = :address

Comment 1 Tomáš Kašpárek 2016-03-10 12:57:58 UTC
spacewalk.git(master):
2ac5a69c7f3a5c3034223f7bdf7914557846b082

Comment 2 Tomáš Kašpárek 2016-06-16 07:52:43 UTC
Spacewalk 2.5 was released.

Comment 3 Eric Herget 2017-09-28 18:11:14 UTC
This BZ closed some time during 2.5, 2.6 or 2.7.  Adding to 2.7 tracking bug.


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