Remove spurious direct use of subprocess

This commit is contained in:
Thierry Carrez 2011-08-05 14:02:55 +02:00
parent 502801bfff
commit 2a89883297
3 changed files with 5 additions and 3 deletions

View File

@ -20,7 +20,6 @@
import fcntl
import os
import signal
import subprocess
from Cheetah import Template

View File

@ -137,6 +137,8 @@ def execute(*cmd, **kwargs):
:delay_on_retry True | False. Defaults to True. If set to True, wait a
short amount of time before retrying.
:attempts How many times to retry cmd.
:shell True | False. Defaults to False. If set to True,
Popen command is called shell=True.
:raises exception.Error on receiving unknown arguments
:raises exception.ProcessExecutionError
@ -147,6 +149,7 @@ def execute(*cmd, **kwargs):
check_exit_code = kwargs.pop('check_exit_code', 0)
delay_on_retry = kwargs.pop('delay_on_retry', True)
attempts = kwargs.pop('attempts', 1)
shell = kwargs.pop('shell', False)
if len(kwargs):
raise exception.Error(_('Got unknown keyword args '
'to utils.execute: %r') % kwargs)
@ -164,6 +167,7 @@ def execute(*cmd, **kwargs):
stdin=_PIPE,
stdout=_PIPE,
stderr=_PIPE,
shell=shell,
env=env)
result = None
if process_input is not None:

View File

@ -43,7 +43,6 @@ import os
import random
import re
import shutil
import subprocess
import sys
import tempfile
import time
@ -684,7 +683,7 @@ class LibvirtConnection(driver.ComputeDriver):
cmd = '%s/tools/ajaxterm/ajaxterm.py --command "%s" -t %s -p %s' \
% (utils.novadir(), ajaxterm_cmd, token, port)
subprocess.Popen(cmd, shell=True)
utils.execute(cmd, shell=True)
return {'token': token, 'host': host, 'port': port}
def get_host_ip_addr(self):