summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Windisch <eric@cloudscaling.com>2011-03-09 15:33:20 -0500
committerEric Windisch <eric@cloudscaling.com>2011-03-09 15:33:20 -0500
commitfc9840bae6200c8f89fb8a3ba0ab45663c872b3c (patch)
tree3c1eb10004c40aa31939a9c694c21a30c9aa68a1
parent23369a63f4b74fb64bf57554a3fd8b15e3e2b49c (diff)
downloadnova-fc9840bae6200c8f89fb8a3ba0ab45663c872b3c.tar.gz
nova-fc9840bae6200c8f89fb8a3ba0ab45663c872b3c.tar.xz
nova-fc9840bae6200c8f89fb8a3ba0ab45663c872b3c.zip
execvp passes pep8
-rw-r--r--nova/console/xvp.py6
-rw-r--r--nova/crypto.py3
-rw-r--r--nova/network/linux_net.py19
-rw-r--r--nova/tests/test_virt.py2
-rw-r--r--nova/utils.py19
-rw-r--r--nova/volume/driver.py4
6 files changed, 30 insertions, 23 deletions
diff --git a/nova/console/xvp.py b/nova/console/xvp.py
index 271dffa54..68d8c8565 100644
--- a/nova/console/xvp.py
+++ b/nova/console/xvp.py
@@ -134,9 +134,9 @@ class XVPConsoleProxy(object):
logging.debug(_("Starting xvp"))
try:
utils.execute('xvp',
- '-p',FLAGS.console_xvp_pid,
- '-c',FLAGS.console_xvp_conf,
- '-l',FLAGS.console_xvp_log)
+ '-p', FLAGS.console_xvp_pid,
+ '-c', FLAGS.console_xvp_conf,
+ '-l', FLAGS.console_xvp_log)
except exception.ProcessExecutionError, err:
logging.error(_("Error starting xvp: %s") % err)
diff --git a/nova/crypto.py b/nova/crypto.py
index 20bb570a5..717ea0041 100644
--- a/nova/crypto.py
+++ b/nova/crypto.py
@@ -120,7 +120,8 @@ def generate_key_pair(bits=1024):
# bio = M2Crypto.BIO.MemoryBuffer()
# key.save_pub_key_bio(bio)
# public_key = bio.read()
- # public_key, err = execute('ssh-keygen', '-y', '-f', '/dev/stdin', private_key)
+ # public_key, err = execute('ssh-keygen', '-y', '-f',
+ # '/dev/stdin', private_key)
return (private_key, public_key, fingerprint)
diff --git a/nova/network/linux_net.py b/nova/network/linux_net.py
index b66a1adb7..228a4d9ea 100644
--- a/nova/network/linux_net.py
+++ b/nova/network/linux_net.py
@@ -68,7 +68,8 @@ def metadata_forward():
_confirm_rule("PREROUTING", '-t', 'nat', '-s', '0.0.0.0/0',
'-d', '169.254.169.254/32', '-p', 'tcp', '-m', 'tcp',
'--dport', '80', '-j', 'DNAT',
- '--to-destination', '%s:%s' % (FLAGS.ec2_dmz_host, FLAGS.ec2_port))
+ '--to-destination',
+ '%s:%s' % (FLAGS.ec2_dmz_host, FLAGS.ec2_port))
def init_host():
@@ -86,7 +87,8 @@ def init_host():
_execute('sudo', 'iptables', '-D', 'FORWARD', '-j', 'nova_forward',
check_exit_code=False)
_execute('sudo', 'iptables', '-A', 'FORWARD', '-j', 'nova_forward')
- _execute('sudo', 'iptables', '-N', 'nova_output', check_exit_code=False)
+ _execute('sudo', 'iptables', '-N', 'nova_output',
+ check_exit_code=False)
_execute('sudo', 'iptables', '-D', 'OUTPUT', '-j', 'nova_output',
check_exit_code=False)
_execute('sudo', 'iptables', '-A', 'OUTPUT', '-j', 'nova_output')
@@ -220,7 +222,7 @@ def ensure_bridge(bridge, interface, net_attrs=None):
# bridge for it to respond to reqests properly
suffix = net_attrs['cidr'].rpartition('/')[2]
out, err = _execute('sudo', 'ip', 'addr', 'add',
- "%s/%s" %
+ "%s/%s" %
(net_attrs['gateway'], suffix),
'brd',
net_attrs['broadcast'],
@@ -237,7 +239,8 @@ def ensure_bridge(bridge, interface, net_attrs=None):
# bridge, then the bridge has to be in promiscuous
# to forward packets properly.
if(FLAGS.public_interface == bridge):
- _execute('sudo', 'ip', 'link', 'set', 'dev', bridge, 'promisc', 'on')
+ _execute('sudo', 'ip', 'link', 'set',
+ 'dev', bridge, 'promisc', 'on')
if interface:
# NOTE(vish): This will break if there is already an ip on the
# interface, so we move any ips to the bridge
@@ -253,8 +256,10 @@ def ensure_bridge(bridge, interface, net_attrs=None):
fields = line.split()
if fields and fields[0] == "inet":
params = ' '.join(fields[1:-1])
- _execute('sudo', 'ip', 'addr', 'del', params, 'dev', fields[-1])
- _execute('sudo', 'ip', 'addr', 'add', params, 'dev', bridge)
+ _execute('sudo', 'ip', 'addr',
+ 'del', params, 'dev', fields[-1])
+ _execute('sudo', 'ip', 'addr',
+ 'add', params, 'dev', bridge)
if gateway:
_execute('sudo', 'route', 'add', '0.0.0.0', 'gw', gateway)
out, err = _execute('sudo', 'brctl', 'addif', bridge, interface,
@@ -397,7 +402,7 @@ def _device_exists(device):
def _confirm_rule(chain, *cmd, **kwargs):
- append=kwargs.get('append',False)
+ append = kwargs.get('append', False)
"""Delete and re-add iptables rule"""
if FLAGS.use_nova_chains:
chain = "nova_%s" % chain.lower()
diff --git a/nova/tests/test_virt.py b/nova/tests/test_virt.py
index 7f1ad002e..dfa607f14 100644
--- a/nova/tests/test_virt.py
+++ b/nova/tests/test_virt.py
@@ -316,7 +316,7 @@ class IptablesFirewallTestCase(test.TestCase):
# self.fw.add_instance(instance_ref)
def fake_iptables_execute(*cmd, **kwargs):
- process_input=kwargs.get('process_input', None)
+ process_input = kwargs.get('process_input', None)
if cmd == ('sudo', 'ip6tables-save', '-t', 'filter'):
return '\n'.join(self.in6_rules), None
if cmd == ('sudo', 'iptables-save', '-t', 'filter'):
diff --git a/nova/utils.py b/nova/utils.py
index 0937522ec..3a4ec3c6a 100644
--- a/nova/utils.py
+++ b/nova/utils.py
@@ -40,7 +40,7 @@ import netaddr
from eventlet import event
from eventlet import greenthread
from eventlet.green import subprocess
-
+None
from nova import exception
from nova.exception import ProcessExecutionError
from nova import log as logging
@@ -129,13 +129,13 @@ def fetchfile(url, target):
def execute(*cmd, **kwargs):
- process_input=kwargs.get('process_input', None)
- addl_env=kwargs.get('addl_env', None)
- check_exit_code=kwargs.get('check_exit_code', 0)
- stdin=kwargs.get('stdin', subprocess.PIPE)
- stdout=kwargs.get('stdout', subprocess.PIPE)
- stderr=kwargs.get('stderr', subprocess.PIPE)
- cmd=map(str,cmd)
+ process_input = kwargs.get('process_input', None)
+ addl_env = kwargs.get('addl_env', None)
+ check_exit_code = kwargs.get('check_exit_code', 0)
+ stdin = kwargs.get('stdin', subprocess.PIPE)
+ stdout = kwargs.get('stdout', subprocess.PIPE)
+ stderr = kwargs.get('stderr', subprocess.PIPE)
+ cmd = map(str, cmd)
LOG.debug(_("Running cmd (subprocess): %s"), ' '.join(cmd))
env = os.environ.copy()
@@ -151,7 +151,8 @@ def execute(*cmd, **kwargs):
obj.stdin.close()
if obj.returncode:
LOG.debug(_("Result was %s") % obj.returncode)
- if check_exit_code is not None and obj.returncode != check_exit_code:
+ if type(check_exit_code) == types.IntType \
+ and obj.returncode != check_exit_code:
(stdout, stderr) = result
raise ProcessExecutionError(exit_code=obj.returncode,
stdout=stdout,
diff --git a/nova/volume/driver.py b/nova/volume/driver.py
index e9bdf162f..45cc800e7 100644
--- a/nova/volume/driver.py
+++ b/nova/volume/driver.py
@@ -112,7 +112,7 @@ class VolumeDriver(object):
# If the volume isn't present, then don't attempt to delete
return True
- self._try_execute('sudo', 'lvremove', '-f',"%s/%s" %
+ self._try_execute('sudo', 'lvremove', '-f', "%s/%s" %
(FLAGS.volume_group,
volume['name']))
@@ -256,7 +256,7 @@ class ISCSIDriver(VolumeDriver):
self._sync_exec('sudo', 'ietadm', '--op', 'new',
"--tid=%s" % iscsi_target,
'--params',
- "Name=%s" % iscsi-name,
+ "Name=%s" % iscsi_name,
check_exit_code=False)
self._sync_exec('sudo', 'ietadm', '--op', 'new',
"--tid=%s" % iscsi_target,