Bug 1312057

Summary: python error in rtevalConfig.py
Product: Red Hat Enterprise Linux 7 Reporter: Brian Brock <bbrock>
Component: rtevalAssignee: Clark Williams <williams>
Status: CLOSED ERRATA QA Contact: Jiri Kastner <jkastner>
Severity: high Docs Contact: Maxim Svistunov <msvistun>
Priority: medium    
Version: 7.3CC: bhu, brose, dalongi, daolivei, gnichols, msvistun, williams
Target Milestone: rc   
Target Release: 7.3   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
*python* errors no longer appear when `SUDO_USER` and `USER` variables are not set Previously, when executing in spare environments that do not have `SUDO_USER` or `USER` environment variables set, a number of *python* errors appeared. With this update, undefined `SUDO_USER` and `USER` variables are handled correctly, and the errors no longer appear.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-04 01:34:39 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:
Bug Depends On:    
Bug Blocks: 1274397, 1353018    
Attachments:
Description Flags
patch to handle sparse environment in hwcert test suite
none
local function to return string value when determining user name none

Description Brian Brock 2016-02-25 16:04:47 UTC
Description of problem:
The hwcert realtime test fails with a python traceback:
TypeError: cannot concatenate 'str' and 'NoneType' objects




Version-Release number of selected component (if applicable):
redhat-certification-2.3-20160223.el7.noarch
redhat-certification-hardware-1.7.1-20160210.el7.noarch



How reproducible:
realiably on at least one test system

Steps to Reproduce:
1. run the hwcert realtime test
2. check logs or debug output
3.

Actual results:
crash with traceback:

  File "/usr/lib/python2.7/site-packages/rhcert/client/harness.py", line 573, in _doRun
    returnValue = self.runTest(logDirectory, testDocument, runDocument, outputFilePath)
  File "/usr/lib/python2.7/site-packages/rhcert/client/harness.py", line 1001, in runTest
    rv = test.run()
  File "/usr/lib/python2.7/site-packages/rhcert/suites/hwcert/tests/realtime/realtime.py", line 101, in run
    from rteval import RTEVAL_VERSION
  File "/usr/lib/python2.7/site-packages/rteval/__init__.py", line 37, in &lt;module&gt;
    from modules.loads import LoadModules
  File "/usr/lib/python2.7/site-packages/rteval/modules/__init__.py", line 26, in &lt;module&gt;
    from rteval.rtevalConfig import rtevalCfgSection
  File "/usr/lib/python2.7/site-packages/rteval/rtevalConfig.py", line 82, in &lt;module&gt;
    'srcdir'     : default_config_search(['loadsource']),
  File "/usr/lib/python2.7/site-packages/rteval/rtevalConfig.py", line 41, in default_config_search
    (os.getenv('SUDO_USER') or os.getenv('USER'))), '.rteval'),
TypeError: cannot concatenate 'str' and 'NoneType' objects



Expected results:
test runs to completion and succeeds

Additional info:

Comment 1 Clark Williams 2016-04-14 00:05:54 UTC
Created attachment 1146993 [details]
patch to handle sparse environment in hwcert test suite

Comment 2 Clark Williams 2016-04-14 00:06:43 UTC
Note, the above patch will go into rteval-2.8

Comment 3 Clark Williams 2016-04-28 18:27:52 UTC
Added to rteval build 2.8

Comment 6 Clark Williams 2016-09-20 14:02:52 UTC
Created attachment 1202917 [details]
local function to return string value when determining user name

Comment 7 Clark Williams 2016-09-20 14:04:33 UTC
The above patch adds the local function get_user_name() which handles empty environment variables SUDO_USER and USER. This patch modifies the original patch and will be available in the next build of rteval (2.12).

Comment 10 errata-xmlrpc 2016-11-04 01:34:39 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://rhn.redhat.com/errata/RHBA-2016-2244.html

Comment 11 John Kacur 2017-03-21 00:06:23 UTC
*** Bug 1418811 has been marked as a duplicate of this bug. ***