summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTomas Sedovic <tomas@sedovic.cz>2012-10-12 17:35:26 +0200
committerTomas Sedovic <tomas@sedovic.cz>2012-10-12 17:35:26 +0200
commitf25d37d888c84a4caf9944000c25305e353a083a (patch)
tree49f92643b7da44474261cde24082ea890d4ea75d /bin
parent39401324d5114a99d697f55da5255c6df7027c43 (diff)
downloadheat-cfntools-f25d37d888c84a4caf9944000c25305e353a083a.tar.gz
Don't load the glance when it's not needed
Fixes #13 If the user doesn't specify the --register-with-glance option, the python-glance or python-glanceclient library should not be needed. Signed-off-by: Tomas Sedovic <tomas@sedovic.cz>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/heat-jeos10
1 files changed, 9 insertions, 1 deletions
diff --git a/bin/heat-jeos b/bin/heat-jeos
index 71afd0c..d8f2d2b 100755
--- a/bin/heat-jeos
+++ b/bin/heat-jeos
@@ -38,7 +38,10 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
if os.path.exists(os.path.join(possible_topdir, 'heat_jeos')):
sys.path.insert(0, possible_topdir)
-from heat_jeos import glance_clients as glance
+try:
+ from heat_jeos import glance_clients as glance
+except ImportError:
+ glance = None
from heat_jeos.utils import *
@@ -99,6 +102,11 @@ def command_create(options, arguments):
sys.exit(1)
if options.register_with_glance:
+ if not glance:
+ logging.error("The Python Glance client is not installed. Please "
+ "install python-glance for Essex or python-glanceclient for "
+ "Folsom.")
+ sys.exit(1)
try:
client = glance.client(options)
glance.get_image(client, 'test')