Add option to tempest init to show global conf dir
Due to the fun and nondeterminism that is python packaging knowing
where tempest thinks the global state dir which is used to preseed
the local etc/ directory can be a complete mystery. To address this
issue this commit adds a new option to tempest init that will print
where this directory is and then exit. So in the off case you want
to preseed your local tempest working directories you can use this
to figure out where to put the files.
Change-Id: I07128fb802a6c1408d4f6154c68004b38aaf1860
diff --git a/tempest/cmd/init.py b/tempest/cmd/init.py
index d8d9d7c..5d5a9f9 100644
--- a/tempest/cmd/init.py
+++ b/tempest/cmd/init.py
@@ -85,6 +85,10 @@
parser = super(TempestInit, self).get_parser(prog_name)
parser.add_argument('dir', nargs='?', default=os.getcwd())
parser.add_argument('--config-dir', '-c', default=None)
+ parser.add_argument('--show-global-config-dir', '-s',
+ action='store_true', dest='show_global_dir',
+ help="Print the global config dir location, "
+ "then exit")
return parser
def generate_testr_conf(self, local_path):
@@ -156,4 +160,7 @@
def take_action(self, parsed_args):
config_dir = parsed_args.config_dir or get_tempest_default_config_dir()
+ if parsed_args.show_global_dir:
+ print("Global config dir is located at: %s" % config_dir)
+ sys.exit(0)
self.create_working_dir(parsed_args.dir, config_dir)