Make missing global config dir not fatal in tempest init

Due to the complexities and inability of the python packaging
infrastructure to install data files properly or consistently we have
to be prepared for the case when we have no idea where the data files
end up from a tempest install. Thus this commit makes tempest init
not fail when it can't find the global config dir and just logs a
warning that it couldn't be found.

Change-Id: Iff944092228ca1ae081e8faaf10ee0048e7ea414
This commit is contained in:
Matthew Treinish 2016-06-07 16:54:55 -04:00
parent c24869b191
commit d5cef9552d
No known key found for this signature in database
GPG Key ID: FD12A0F214C9E177

View File

@ -114,15 +114,22 @@ class TempestInit(command.Command):
config_parse.write(conf_file)
def copy_config(self, etc_dir, config_dir):
shutil.copytree(config_dir, etc_dir)
if os.path.isdir(config_dir):
shutil.copytree(config_dir, etc_dir)
else:
LOG.warning("Global config dir %s can't be found" % config_dir)
def generate_sample_config(self, local_dir, config_dir):
conf_generator = os.path.join(config_dir,
'config-generator.tempest.conf')
if os.path.isdir(config_dir):
conf_generator = os.path.join(config_dir,
'config-generator.tempest.conf')
subprocess.call(['oslo-config-generator', '--config-file',
conf_generator],
cwd=local_dir)
subprocess.call(['oslo-config-generator', '--config-file',
conf_generator],
cwd=local_dir)
else:
LOG.warning("Skipping sample config generation because global "
"config dir %s can't be found" % config_dir)
def create_working_dir(self, local_dir, config_dir):
# Create local dir if missing