Bug 484657 - hts uses code deprecated in python 2.6
hts uses code deprecated in python 2.6
Status: CLOSED ERRATA
Product: Red Hat Hardware Certification Program
Classification: Red Hat
Component: Test Suite (harness) (Show other bugs)
5.3
All Linux
low Severity medium
: ---
: ---
Assigned To: Greg Nichols
Lawrence Lim
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-02-09 05:39 EST by Scott Scriven
Modified: 2014-03-25 20:56 EDT (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-04-21 11:57:42 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
deprecations.diff (1.15 KB, patch)
2009-02-09 06:07 EST, Scott Scriven
no flags Details | Diff
command.py patch replacing popen2 with subprocess module (7.46 KB, patch)
2009-12-21 14:39 EST, Greg Nichols
no flags Details | Diff
Makefile patch encoding RHEL version (2.29 KB, patch)
2009-12-21 14:45 EST, Greg Nichols
no flags Details | Diff
v7/v7/Makefile patch to install multiple command.py versions (1008 bytes, patch)
2009-12-21 14:48 EST, Greg Nichols
no flags Details | Diff
build utility script changes for new Make changes (2.68 KB, application/octet-stream)
2009-12-21 14:52 EST, Greg Nichols
no flags Details
memory test patch removing popen2 reference (1.15 KB, patch)
2009-12-21 14:54 EST, Greg Nichols
no flags Details | Diff
command.py pach on R21 fixing lack of newlines in output (1.43 KB, patch)
2010-01-10 07:04 EST, Greg Nichols
no flags Details | Diff

  None (edit)
Description Scott Scriven 2009-02-09 05:39:36 EST
Description of problem:
Some of the code in hts will need to be updated for python 2.6.  Specifically, the Exception.message member is deprecated, as is the popen2 module (use subprocesses instead).

Version-Release number of selected component (if applicable):
hts-5.3-15

Steps to Reproduce:
1. Try running hts on a system with python 2.6.
  
Actual results: Deprecation warnings.

Additional info:
I've only tested the parts related to the cpuscaling test.
Comment 1 Scott Scriven 2009-02-09 06:07:54 EST
Created attachment 331301 [details]
deprecations.diff

Removed all references to the 'exceptions' module because, according to Python's docs, "this module never needs to be imported explicitly".  Its contents are always available in the global namespace.

Works around Exception.message warning by adding a 'message' property in the subclass.

I didn't fix the popen2 warning, since its replacement is too new for RHEL4 (added in python 2.4; distro has python 2.3).
Comment 2 Greg Nichols 2009-12-21 14:39:46 EST
Created attachment 379692 [details]
command.py patch replacing popen2 with subprocess module

also uses previous patch to account for exeptions changes in python 2.6.
Comment 3 Greg Nichols 2009-12-21 14:45:05 EST
Created attachment 379694 [details]
Makefile patch encoding RHEL version

This Makefile patch makes the v7 build process RHEL version-specific via a new varible V7_RHEL_VERSION.   This is necessary since v7 coverage will now span RHEL4 through RHEL6, which means Python versions 2.3 through 2.6.    In this cases, the popen2 module is depreciated in Python 2.6 in favor of the subprocess module, which is not available in Python 2.3.

This patch also changes the build process to use RHEL version-specific v7.spec and rpm source tar files.
Comment 4 Greg Nichols 2009-12-21 14:48:33 EST
Created attachment 379696 [details]
v7/v7/Makefile patch to install multiple command.py versions


This patch changes the v7 library Makefile to install the correct version of the Command wrapper class for subprocesses/commands.   For RHEL 4, the old popen2-based version will be used (command-popen2.py).   For later RHEL releases, the revised subprocess-based version will be used (command.py).
Comment 5 Greg Nichols 2009-12-21 14:52:26 EST
Created attachment 379698 [details]
build utility script changes for new Make changes


The build utility script will be changed to build a single RHEL release-specific v7.
Comment 6 Greg Nichols 2009-12-21 14:54:22 EST
Created attachment 379700 [details]
memory test patch removing popen2 reference

The memory test is changed to use the v7/command.py wrapper.
Comment 7 Scott Scriven 2010-01-04 17:55:23 EST
FWIW, it might be easier to handle the multiple modules entirely in Python, without relying the build system.  Just try to import subprocess, and if it fails, fall back to popen2.  This is simple, and more tolerant of unexpected environments.
Comment 8 Greg Nichols 2010-01-10 07:04:59 EST
Created attachment 382792 [details]
command.py pach on R21 fixing lack of newlines in output
Comment 14 errata-xmlrpc 2010-04-21 11:57:42 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2010-0365.html

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