Add --show-config

Change-Id: Ieb9358d942675c3ef8464389084b9ba3315c3662
This commit is contained in:
ahothan 2015-08-28 14:31:36 -07:00
parent 0d30c860fc
commit 1b2af01cf6
3 changed files with 16 additions and 8 deletions

View File

@ -18,6 +18,7 @@ import sys
import configure
import log as logging
from oslo_config import cfg
from pkg_resources import resource_string
import credentials
import kb_vm_agent
@ -70,9 +71,9 @@ class KBConfig(object):
def __init__(self):
# The default configuration file for KloudBuster
default_cfg_file = get_absolute_path_for_file("cfg.scale.yaml")
default_cfg = resource_string(__name__, "cfg.scale.yaml")
# Read the configuration file
self.config_scale = configure.Configuration.from_file(default_cfg_file).configure()
self.config_scale = configure.Configuration.from_string(default_cfg).configure()
self.cred_tested = None
self.cred_testing = None
self.server_cfg = None

View File

@ -34,6 +34,7 @@ from keystoneclient.v2_0 import client as keystoneclient
import log as logging
from novaclient.exceptions import ClientException
from oslo_config import cfg
from pkg_resources import resource_string
from tabulate import tabulate
import tenant
@ -563,13 +564,20 @@ def main():
help='store results in JSON format file'),
cfg.BoolOpt("no-env",
default=False,
help="Do not read env variables")
help="Do not read env variables"),
cfg.BoolOpt("show-config",
default=False,
help="Show the default configuration")
]
CONF.register_cli_opts(cli_opts)
CONF.set_default("verbose", True)
full_version = __version__ + ', VM image: ' + kb_vm_agent.get_image_name()
CONF(sys.argv[1:], project="kloudbuster", version=full_version)
if CONF.show_config:
print resource_string(__name__, "cfg.scale.yaml")
sys.exit(0)
logging.setup("kloudbuster")
try:
kb_config = KBConfig()

View File

@ -1,11 +1,11 @@
[metadata]
name = kloudbuster
summary = KloudBuster is a open source tool that allows anybody to load any Neutron OpenStack cloud at massive data plane scale swiftly and effortlessly.
summary = KloudBuster is an open source tool that allows anybody to load any Neutron OpenStack cloud at massive data plane scale swiftly and effortlessly.
description-file =
README.rst
author = OpenStack
author-email = openstack-dev@lists.openstack.org
home-page = http://www.openstack.org/
author = KloudBuster team at OpenStack
author-email = kloudbuster-core@lists.launchpad.net
home-page = https://github.com/openstack/kloudbuster
classifier =
Environment :: OpenStack
Intended Audience :: Developers
@ -17,7 +17,6 @@ classifier =
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 2.6
[files]
packages =