Bug 1309468 - UnboundLocalError: local variable 'primif' referenced before assignment
UnboundLocalError: local variable 'primif' referenced before assignment
Status: CLOSED CURRENTRELEASE
Product: Spacewalk
Classification: Community
Component: Server (Show other bugs)
2.4
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Tomáš Kašpárek
Red Hat Satellite QA List
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-02-17 17:05 EST by W. Andrew Denton
Modified: 2016-06-16 03:52 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-06-16 03:52:43 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description W. Andrew Denton 2016-02-17 17:05:03 EST
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 07:57:58 EST
spacewalk.git(master):
2ac5a69c7f3a5c3034223f7bdf7914557846b082
Comment 2 Tomáš Kašpárek 2016-06-16 03:52:43 EDT
Spacewalk 2.5 was released.

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