execvp: cleanup.
This commit is contained in:
parent
fc9840bae6
commit
e8554da80a
@ -105,7 +105,7 @@ def generate_key_pair(bits=1024):
|
||||
|
||||
tmpdir = tempfile.mkdtemp()
|
||||
keyfile = os.path.join(tmpdir, 'temp')
|
||||
utils.execute('ssh-keygen', '-q', '-b', '%d' % bits, '-N', '',
|
||||
utils.execute('ssh-keygen', '-q', '-b', bits, '-N', '',
|
||||
'-f', keyfile)
|
||||
(out, err) = utils.execute('ssh-keygen', '-q', '-l', '-f',
|
||||
'%s.pub' % (keyfile))
|
||||
@ -147,9 +147,9 @@ def revoke_cert(project_id, file_name):
|
||||
os.chdir(ca_folder(project_id))
|
||||
# NOTE(vish): potential race condition here
|
||||
utils.execute('openssl', 'ca', '-config', './openssl.cnf', '-revoke',
|
||||
'%s' % file_name)
|
||||
file_name)
|
||||
utils.execute('openssl', 'ca', '-gencrl', '-config', './openssl.cnf',
|
||||
'-out', '%s' % FLAGS.crl_file)
|
||||
'-out', FLAGS.crl_file)
|
||||
os.chdir(start)
|
||||
|
||||
|
||||
|
@ -52,7 +52,7 @@ def main(dom_id, command, only_this_vif=None):
|
||||
apply_iptables_rules(command, params)
|
||||
|
||||
|
||||
def execute(command, return_stdout=False):
|
||||
def execute(*command, return_stdout=False):
|
||||
devnull = open(os.devnull, 'w')
|
||||
proc = subprocess.Popen(command, close_fds=True,
|
||||
stdout=subprocess.PIPE, stderr=devnull)
|
||||
@ -110,26 +110,26 @@ def apply_arptables_rules(command, params):
|
||||
def apply_ebtables_rules(command, params):
|
||||
ebtables = lambda *rule: execute("/sbin/ebtables", *rule)
|
||||
|
||||
ebtables('-D', 'FORWARD', '-p', '0806', '-o', '%(VIF)s' % params,
|
||||
'--arp-ip-dst', '%(IP)s' % params,
|
||||
ebtables('-D', 'FORWARD', '-p', '0806', '-o', params['VIF'],
|
||||
'--arp-ip-dst', params['IP'],
|
||||
'-j', 'ACCEPT')
|
||||
ebtables('-D', 'FORWARD', '-p', '0800', '-o',
|
||||
'%(VIF)s' % params, '--ip-dst', '%(IP)s' % params,
|
||||
params['VIF'], '--ip-dst', params['IP'],
|
||||
'-j', 'ACCEPT')
|
||||
if command == 'online':
|
||||
ebtables('-A', 'FORWARD', '-p', '0806',
|
||||
'-o', '%(VIF)s' % params
|
||||
'--arp-ip-dst', '%(IP)s' % params,
|
||||
'-o', params['VIF'],
|
||||
'--arp-ip-dst', params['IP'],
|
||||
'-j', 'ACCEPT')
|
||||
ebtables('-A', 'FORWARD', '-p', '0800',
|
||||
'-o', '%(VIF)s' % params,
|
||||
'--ip-dst', '%(IP)s' % params,
|
||||
'-o', params['VIF'],
|
||||
'--ip-dst', params['IP'],
|
||||
'-j', 'ACCEPT')
|
||||
|
||||
ebtables('-D', 'FORWARD', '-s', '!', '%(MAC)s' % params,
|
||||
'-i', '%(VIF)s' % params, '-j', 'DROP')
|
||||
ebtables('-D', 'FORWARD', '-s', '!', params['MAC'],
|
||||
'-i', params['VIF'], '-j', 'DROP')
|
||||
if command == 'online':
|
||||
ebtables('-I', 'FORWARD', '1', '-s', '!', '%(MAC)s' % params,
|
||||
ebtables('-I', 'FORWARD', '1', '-s', '!', params['MAC'],
|
||||
'-i', '%(VIF)s', '-j', 'DROP')
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user