xenapi: fix pep8 violations in nova plugins
Removed plugins/xenserver from tox.ini excludes list, ran tox -e pep8, and fixed violations. Fixes: bug 1197893 Change-Id: I8e0116304b07d54c49a01202b3ce6d3426097bb4
This commit is contained in:
parent
cad0f06ec9
commit
2266c04458
@ -135,7 +135,8 @@ def exists(args, key):
|
|||||||
|
|
||||||
def optional(args, key):
|
def optional(args, key):
|
||||||
"""If the given key is in args, return the corresponding value, otherwise
|
"""If the given key is in args, return the corresponding value, otherwise
|
||||||
return None"""
|
return None
|
||||||
|
"""
|
||||||
return key in args and args[key] or None
|
return key in args and args[key] or None
|
||||||
|
|
||||||
|
|
||||||
@ -207,7 +208,8 @@ def vbd_unplug_with_retry(session, vbd):
|
|||||||
"""Call VBD.unplug on the given VBD, with a retry if we get
|
"""Call VBD.unplug on the given VBD, with a retry if we get
|
||||||
DEVICE_DETACH_REJECTED. For reasons which I don't understand, we're
|
DEVICE_DETACH_REJECTED. For reasons which I don't understand, we're
|
||||||
seeing the device still in use, even when all processes using the device
|
seeing the device still in use, even when all processes using the device
|
||||||
should be dead."""
|
should be dead.
|
||||||
|
"""
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
session.xenapi.VBD.unplug(vbd)
|
session.xenapi.VBD.unplug(vbd)
|
||||||
@ -215,7 +217,7 @@ def vbd_unplug_with_retry(session, vbd):
|
|||||||
return
|
return
|
||||||
except XenAPI.Failure, e:
|
except XenAPI.Failure, e:
|
||||||
if (len(e.details) > 0 and
|
if (len(e.details) > 0 and
|
||||||
e.details[0] == 'DEVICE_DETACH_REJECTED'):
|
e.details[0] == 'DEVICE_DETACH_REJECTED'):
|
||||||
logging.debug(_('VBD.unplug rejected: retrying...'))
|
logging.debug(_('VBD.unplug rejected: retrying...'))
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
elif (len(e.details) > 0 and
|
elif (len(e.details) > 0 and
|
||||||
|
@ -103,6 +103,7 @@ def finish_subprocess(proc, cmdline, cmd_input=None, ok_exit_codes=None):
|
|||||||
raise SubprocessException(' '.join(cmdline), ret, out, err)
|
raise SubprocessException(' '.join(cmdline), ret, out, err)
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
|
||||||
def run_command(cmd, cmd_input=None, ok_exit_codes=None):
|
def run_command(cmd, cmd_input=None, ok_exit_codes=None):
|
||||||
"""Abstracts out the basics of issuing system commands. If the command
|
"""Abstracts out the basics of issuing system commands. If the command
|
||||||
returns anything in stderr, an exception is raised with that information.
|
returns anything in stderr, an exception is raised with that information.
|
||||||
|
@ -64,7 +64,8 @@ def jsonify(fnc):
|
|||||||
|
|
||||||
def _record_exists(arg_dict):
|
def _record_exists(arg_dict):
|
||||||
"""Returns whether or not the given record exists. The record path
|
"""Returns whether or not the given record exists. The record path
|
||||||
is determined from the given path and dom_id in the arg_dict."""
|
is determined from the given path and dom_id in the arg_dict.
|
||||||
|
"""
|
||||||
cmd = ["xenstore-exists", "/local/domain/%(dom_id)s/%(path)s" % arg_dict]
|
cmd = ["xenstore-exists", "/local/domain/%(dom_id)s/%(path)s" % arg_dict]
|
||||||
try:
|
try:
|
||||||
_run_command(cmd)
|
_run_command(cmd)
|
||||||
|
2
tox.ini
2
tox.ini
@ -51,7 +51,7 @@ commands = {posargs}
|
|||||||
# H102 Apache 2.0 license header not found
|
# H102 Apache 2.0 license header not found
|
||||||
|
|
||||||
ignore = E121,E122,E123,E124,E126,E127,E128,E711,E712,H102,H404,F403,F811,F841,H803
|
ignore = E121,E122,E123,E124,E126,E127,E128,E711,E712,H102,H404,F403,F811,F841,H803
|
||||||
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,*plugins/xenserver*,tools
|
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools
|
||||||
|
|
||||||
[hacking]
|
[hacking]
|
||||||
local-check-factory = nova.hacking.checks.factory
|
local-check-factory = nova.hacking.checks.factory
|
||||||
|
Loading…
x
Reference in New Issue
Block a user