From effda5db361b42d9b3409211017d4cbe6eb6c662 Mon Sep 17 00:00:00 2001 From: Nikos Skalkotos Date: Fri, 23 Aug 2013 16:24:32 +0300 Subject: [PATCH 1/1] Extend the allowed cloud name characters Allow the characters that kamaki allows --- image_creator/dialog_util.py | 4 ++-- image_creator/kamaki_wrapper.py | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/image_creator/dialog_util.py b/image_creator/dialog_util.py index ec5be5f..af5e425 100644 --- a/image_creator/dialog_util.py +++ b/image_creator/dialog_util.py @@ -180,10 +180,10 @@ def extract_image(session): def _check_cloud(session, name, description, url, token): """Checks if the provided info for a cloud are valid""" d = session['dialog'] - regexp = re.compile('^[a-zA-Z0-9_]+$') + regexp = re.compile('^[~@#$:\-\w]+$') if not re.match(regexp, name): - d.msgbox("Allowed characters for name: [a-zA-Z0-9_]", width=WIDTH) + d.msgbox("Allowed characters for name: a-zA-Z0-9_~@#$:-", width=WIDTH) return False if len(url) == 0: diff --git a/image_creator/kamaki_wrapper.py b/image_creator/kamaki_wrapper.py index c515fa6..3669526 100644 --- a/image_creator/kamaki_wrapper.py +++ b/image_creator/kamaki_wrapper.py @@ -38,6 +38,8 @@ The library is used to upload images to and register them with a Synnefo deployment. """ +import sys + from os.path import basename from kamaki.cli.config import Config @@ -46,8 +48,11 @@ from kamaki.clients.image import ImageClient from kamaki.clients.pithos import PithosClient from kamaki.clients.astakos import AstakosClient - -config = Config() +try: + config = Config() +except Exception as e: + sys.stderr.write("Kamaki config error: %s\n" % str(e)) + sys.exit(1) class Kamaki(object): -- 1.7.10.4