hacking: check for deprecated os.open()

Add hacking check for deprecated library function os.popen().
This bug was reported https://bugs.launchpad.net/tempest/+bug/1529836
and this hacking prevents new os.popen() in the code.

Change-Id: I124b9f86ffc6eba268c99ad9834686f55fd857c3
This commit is contained in:
kairoaraujo 2016-02-17 12:21:39 -02:00
parent 57e2eb13d0
commit e5749bec65
2 changed files with 17 additions and 0 deletions

View File

@ -10,6 +10,8 @@ Nova-PowerVM Specific Commandments
- Follow the Nova HACKING.rst
- [P301] LOG.warn() is not allowed. Use LOG.warning()
- [P302] Deprecated library function os.popen()
Creating Unit Tests

View File

@ -25,6 +25,21 @@ def no_log_warn(logical_line, filename):
yield(0, 'P301 Use LOG.warning() rather than LOG.warn()')
def no_os_popen(logical_line):
"""Disallow 'os.popen('
Deprecated library function os.popen() Replace it using subprocess
if 'os.popen(' in logical_line:
yield(0, 'P302 Deprecated library function os.popen(). '
'Replace it using subprocess module. ')
def factory(register):