Skip to content

Commit

Permalink
Bug lp:829064
Browse files Browse the repository at this point in the history
Removed the fetchfile() and execute() methods.. all tests are passing.

Change-Id: If32dff06911e9224da2a31fbc53b92db1b7bb0ca
  • Loading branch information
Justin Shepherd committed Aug 24, 2011
1 parent 3554d5a commit 40b98d3
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions glance/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,42 +87,6 @@ def import_object(import_str):
return cls()


def fetchfile(url, target):
logging.debug("Fetching %s" % url)
# c = pycurl.Curl()
# fp = open(target, "wb")
# c.setopt(c.URL, url)
# c.setopt(c.WRITEDATA, fp)
# c.perform()
# c.close()
# fp.close()
execute("curl --fail %s -o %s" % (url, target))


def execute(cmd, process_input=None, addl_env=None, check_exit_code=True):
logging.debug("Running cmd: %s", cmd)
env = os.environ.copy()
if addl_env:
env.update(addl_env)
obj = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)
result = None
if process_input != None:
result = obj.communicate(process_input)
else:
result = obj.communicate()
obj.stdin.close()
if obj.returncode:
logging.debug("Result was %s" % (obj.returncode))
if check_exit_code and obj.returncode != 0:
(stdout, stderr) = result
raise ProcessExecutionError(exit_code=obj.returncode,
stdout=stdout,
stderr=stderr,
cmd=cmd)
return result


def abspath(s):
return os.path.join(os.path.dirname(__file__), s)

Expand Down

0 comments on commit 40b98d3

Please sign in to comment.