RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1547763 - redhat-support-tool: UnboundLocalError: local variable 'timer' referenced before assignment
Summary: redhat-support-tool: UnboundLocalError: local variable 'timer' referenced bef...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: redhat-support-tool
Version: 7.4
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: A.P. Rajshekhar
QA Contact: Miroslav Hradílek
URL:
Whiteboard:
Depends On:
Blocks: 1722515 1882771
TreeView+ depends on / blocked
 
Reported: 2018-02-21 21:23 UTC by Ryan Blakley
Modified: 2023-03-24 13:59 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1882771 (view as bug list)
Environment:
Last Closed: 2020-03-31 20:05:42 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:1134 0 None None None 2020-03-31 20:05:46 UTC

Description Ryan Blakley 2018-02-21 21:23:38 UTC
Description of problem:redhat-support-tool: UnboundLocalError: local variable 'timer' referenced before assignment.


Version-Release number of selected component (if applicable): redhat-support-tool-0.9.9-3.el7


Steps to Reproduce:
1. For me to reproduce the issue, I had to bring down my networking.
2. Then run # redhat-support-tool addattachment -c 0XXXXXX -f -z /path/to/file


Actual results:
redhat_support_tool.helpers.launchhelper - ERROR - local variable 'timer' referenced before assignment
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/redhat_support_tool/helpers/launchhelper.py", line 106, in run
    return cls.non_interactive_action()
  File "/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/add_attachment.py", line 437, in non_interactive_action
    useFtp=self.use_ftp)
  File "/usr/lib/python2.7/site-packages/redhat_support_lib/infrastructure/brokers.py", line 612, in add
    amnt = FtpHelper.ftp_attachment(fileName, caseNumber, fileChunk)
  File "/usr/lib/python2.7/site-packages/redhat_support_lib/utils/ftphelper.py", line 135, in ftp_attachment
    timer.stop()
UnboundLocalError: local variable 'timer' referenced before assignment


Expected results: Upload the file to the dropbox.


Additional info: I threw together the below patch, and the customer confirmed after making the changes in the patch, that the issue was resolved and the file uploaded.


# diff -up /usr/lib/python2.7/site-packages/redhat_support_lib/utils/ftphelper.py.old /usr/lib/python2.7/site-packages/redhat_support_lib/utils/ftphelper.py
--- /usr/lib/python2.7/site-packages/redhat_support_lib/utils/ftphelper.py.old	2018-02-19 10:54:15.342719682 -0500
+++ /usr/lib/python2.7/site-packages/redhat_support_lib/utils/ftphelper.py	2018-02-19 10:54:22.409917659 -0500
@@ -56,6 +56,7 @@ def ftp_attachment(fileName=None, caseNu
     conn = None
     ftp = None
     fh = None
+    timer = None
     # add http to host because if it is not prefixed it defaults to https
     try:
         if config.proxy_url != None:
@@ -132,7 +133,7 @@ def ftp_attachment(fileName=None, caseNu
             if _ftp_error_return_code(resp):
                 raise Exception(resp)
     finally:
-	timer.stop()
+        if timer: timer.stop()
         if fh: fh.close()
         if config.proxy_url != None:
             if conn: conn.close()

Comment 2 Bishop Clark 2018-07-26 16:27:52 UTC
Can confirm:  the above patch changes the behaviour and allows the tool to run.  THANKS, RYAN!!

Comment 10 errata-xmlrpc 2020-03-31 20:05:42 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.

https://access.redhat.com/errata/RHBA-2020:1134


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