summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChiradeep Vittal <chiradeep@chiradeep-lt2>2011-01-03 11:37:07 -0800
committerChiradeep Vittal <chiradeep@chiradeep-lt2>2011-01-03 11:37:07 -0800
commit97cfb850033597eebe6be88266cd0e1f457ec9bc (patch)
tree4baaad2fb01737aabbc459aea7e92cb86a2f7b6b
parent82ccd2b656a364251aeecbf4c31cd062af6513f0 (diff)
downloadnova-97cfb850033597eebe6be88266cd0e1f457ec9bc.tar.gz
nova-97cfb850033597eebe6be88266cd0e1f457ec9bc.tar.xz
nova-97cfb850033597eebe6be88266cd0e1f457ec9bc.zip
Merge from trunk: process replaced with util
-rw-r--r--nova/virt/images.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/nova/virt/images.py b/nova/virt/images.py
index 69838ac5b..0ec578b06 100644
--- a/nova/virt/images.py
+++ b/nova/virt/images.py
@@ -30,7 +30,7 @@ import urllib2
import urlparse
from nova import flags
-from nova import process
+from nova import utils
from nova.auth import manager
from nova.auth import signer
from nova.objectstore import image
@@ -60,9 +60,7 @@ def _fetch_image_no_curl(url, path, headers):
while 1:
data = urlfile.read(chunk)
if not data:
- break
- f.write(data)
-
+ break f.write(data)
urlopened = urllib2.urlopen(request)
urlretrieve(urlopened, path)
logging.debug("Finished retreving %s -- placed in %s", url, path)
@@ -73,7 +71,7 @@ def _fetch_s3_image(image, path, user, project):
# This should probably move somewhere else, like e.g. a download_as
# method on User objects and at the same time get rewritten to use
- # twisted web client.
+ # a web client.
headers = {}
headers['Date'] = time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime())
@@ -90,9 +88,9 @@ def _fetch_s3_image(image, path, user, project):
cmd = ['/usr/bin/curl', '--fail', '--silent', url]
for (k, v) in headers.iteritems():
cmd += ['-H', '%s: %s' % (k, v)]
-
- cmd += ['-o', path]
- return process.SharedPool().execute(executable=cmd[0], args=cmd[1:])
+ cmd += ['-o', path]
+ cmd_out = ' '.join(cmd)
+ return utils.execute(cmd_out)
def _fetch_local_image(image, path, user, project):
@@ -100,7 +98,7 @@ def _fetch_local_image(image, path, user, project):
if sys.platform.startswith('win'):
return shutil.copy(source, path)
else:
- return process.simple_execute('cp %s %s' % (source, path))
+ return utils.execute('cp %s %s' % (source, path))
def _image_path(path):