From 9e657b620440e80f8e909b8cb76a63fe8e7b331d Mon Sep 17 00:00:00 2001 From: Federico Ressi Date: Fri, 5 Jul 2019 13:10:22 +0200 Subject: [PATCH] Create a loop for defining image configuration option Change-Id: I50c5d5d3e60be44ff8673bd204788957bb66d4e1 --- tobiko/openstack/glance/config.py | 34 ++++++++++++++++--------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/tobiko/openstack/glance/config.py b/tobiko/openstack/glance/config.py index 9f04818e4..49adfb972 100644 --- a/tobiko/openstack/glance/config.py +++ b/tobiko/openstack/glance/config.py @@ -28,19 +28,21 @@ def register_tobiko_options(conf): help=("Default directory where to look for image " "files")), ]) - conf.register_opts( - group=cfg.OptGroup('cirros'), - opts=[cfg.StrOpt('image_name', - help="Default CirrOS image name"), - cfg.StrOpt('image_url', - help="Default CirrOS image URL"), - cfg.StrOpt('image_file', - help="Default CirrOS image filename"), - cfg.StrOpt('container_format', - help="Default CirrOS container format"), - cfg.StrOpt('disk_format', - help="Default CirrOS disk format"), - cfg.StrOpt('username', - help="Default CirrOS username"), - cfg.StrOpt('password', - help="Default CirrOS password"), ]) + for name in ['CirrOS']: + group_name = name.lower() + conf.register_opts( + group=cfg.OptGroup(group_name), + opts=[cfg.StrOpt('image_name', + help="Default " + name + " image name"), + cfg.StrOpt('image_url', + help="Default " + name + " image URL"), + cfg.StrOpt('image_file', + help="Default " + name + " image filename"), + cfg.StrOpt('container_format', + help="Default " + name + " container format"), + cfg.StrOpt('disk_format', + help="Default " + name + " disk format"), + cfg.StrOpt('username', + help="Default " + name + " username"), + cfg.StrOpt('password', + help="Default " + name + " password"), ])