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:
parent
57e2eb13d0
commit
e5749bec65
@ -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
|
||||
-------------------
|
||||
|
@ -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
|
||||
https://bugs.launchpad.net/tempest/+bug/1529836
|
||||
|
||||
P302
|
||||
"""
|
||||
|
||||
if 'os.popen(' in logical_line:
|
||||
yield(0, 'P302 Deprecated library function os.popen(). '
|
||||
'Replace it using subprocess module. ')
|
||||
|
||||
|
||||
def factory(register):
|
||||
register(no_log_warn)
|
||||
register(no_os_popen)
|
||||
checks.factory(register)
|
||||
|
Loading…
Reference in New Issue
Block a user