From d795d7f6fbe45f5ebcd230716d063f49b55de8bf Mon Sep 17 00:00:00 2001 From: Nicolas Simonds Date: Wed, 6 Aug 2014 11:08:28 -0700 Subject: [PATCH] launch-node.py: request flavors/images by ID or name It is deemed useful by some to pass IDs rather than names to launch-node.py for flavors and images; mostly due to the fact that names are not unique, and the "first-matched" behavior on names means that it can end up doing the wrong thing in certain cases. Change-Id: Ief89174fedac7921f85bbfe3a456059ecc0f19bf --- launch/launch-node.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/launch/launch-node.py b/launch/launch-node.py index e38ac8c7f4..5ee77f5e4e 100755 --- a/launch/launch-node.py +++ b/launch/launch-node.py @@ -194,12 +194,13 @@ def main(): cert)): raise Exception("Please specify the name of a signed puppet cert.") - flavors = [f for f in client.flavors.list() if options.flavor in f.name] + flavors = [f for f in client.flavors.list() + if options.flavor in (f.name, f.id)] flavor = flavors[0] print "Found flavor", flavor images = [i for i in client.images.list() - if (options.image.lower() in i.name.lower() and + if (options.image.lower() in (i.id, i.name.lower()) and not i.name.endswith('(Kernel)') and not i.name.endswith('(Ramdisk)'))]