From aafe309042fda5628630b6655ea4f69984aaf6ff Mon Sep 17 00:00:00 2001 From: Ed Hall Date: Tue, 7 Feb 2012 13:53:40 -0800 Subject: [PATCH 1/3] Detect existance of bad symlink. --- devstack/shell.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devstack/shell.py b/devstack/shell.py index 6af320e6..0f9e2cb3 100644 --- a/devstack/shell.py +++ b/devstack/shell.py @@ -323,7 +323,7 @@ def symlink(source, link, force=True, run_as_root=True): LOG.debug("Creating symlink from %s => %s" % (link, source)) path = dirname(link) mkdirslist(path) - if force and exists(link): + if force and (exists(link) or islink(link)): unlink(link, True) os.symlink(source, link) From d8c9e98a7ff260bd9ecdd35d908ec28128a9b5a1 Mon Sep 17 00:00:00 2001 From: Ken Thomas Date: Tue, 7 Feb 2012 09:11:31 -0800 Subject: [PATCH 2/3] Support pip command options on a per package basis --- conf/pips/glance.json | 3 ++- devstack/pip.py | 4 ++++ utils/env_gen.py | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/conf/pips/glance.json b/conf/pips/glance.json index 471d7801..f23415ac 100644 --- a/conf/pips/glance.json +++ b/conf/pips/glance.json @@ -9,7 +9,8 @@ }, #the base is 2.0, need to upgrade "pycrypto": { - "version": "2.5" + "version": "2.5", + "options": "--upgrade" }, #the newest we can get is 1.3.3 from epel/rhel #this causes issues like the following diff --git a/devstack/pip.py b/devstack/pip.py index 468fbc7c..3dca227c 100644 --- a/devstack/pip.py +++ b/devstack/pip.py @@ -43,6 +43,10 @@ def install(pips, distro): if version: pipfull = pipfull + "==" + version actions.append(pipfull) + options = str(pipinfo.get('options')) + if options: + LOG.info("Using pip options:%s" % (options)) + actions.append(options) if actions: LOG.info("Installing python packages [%s]" % (", ".join(actions))) root_cmd = PIP_CMD_NAMES.get(distro, 'pip') diff --git a/utils/env_gen.py b/utils/env_gen.py index 0bb0ae16..2c6e7e6a 100755 --- a/utils/env_gen.py +++ b/utils/env_gen.py @@ -157,6 +157,7 @@ def load_local_rc(fn=None, cfg=None): am_set += 1 return am_set + def main(): opts = optparse.OptionParser() opts.add_option("-o", "--output", dest="filename", From cc73d3d21ca472a824da8c64cadd35388d5eabfc Mon Sep 17 00:00:00 2001 From: Ken Thomas Date: Tue, 7 Feb 2012 09:23:50 -0800 Subject: [PATCH 3/3] Moved str function to append, after the test for None --- devstack/pip.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/devstack/pip.py b/devstack/pip.py index 3dca227c..f6dfd007 100644 --- a/devstack/pip.py +++ b/devstack/pip.py @@ -39,14 +39,16 @@ def install(pips, distro): pipfull = name pipinfo = pips.get(name) if pipinfo and pipinfo.get('version'): - version = str(pipinfo.get('version')) + # Move str after the test since str(None) is 'None' + version = pipinfo.get('version') if version: - pipfull = pipfull + "==" + version + pipfull = pipfull + "==" + str(version) actions.append(pipfull) - options = str(pipinfo.get('options')) + # Move str after the test since str(None) is 'None' + options = pipinfo.get('options') if options: LOG.info("Using pip options:%s" % (options)) - actions.append(options) + actions.append(str(options)) if actions: LOG.info("Installing python packages [%s]" % (", ".join(actions))) root_cmd = PIP_CMD_NAMES.get(distro, 'pip')