From 9346483d38d9921f222d24132eb8220ecd9def34 Mon Sep 17 00:00:00 2001 From: Jake Yip Date: Sat, 18 Jun 2016 00:57:40 +1000 Subject: [PATCH] Make `tempest init` working dir an abspath The working directory can be either a relative path or absolute path depending on how `tempest init` is called. If `tempest init` is called, the working directory is absolute, but if `tempest init [dir]` is called, the working directory is relative. The relative case leads to a bug in setting up the tempest config file later. We normalized and absolutized local_dir early on, and make everything work with abspath. This minimize handling of the different paths and reduces the chances of bugs from handling in later code. Change-Id: I6dc314017eb264302ba68bbf25060e833d8e317a Closes-Bug: #1593747 --- tempest/cmd/init.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tempest/cmd/init.py b/tempest/cmd/init.py index 77d62d34d..b9db98935 100644 --- a/tempest/cmd/init.py +++ b/tempest/cmd/init.py @@ -138,6 +138,8 @@ class TempestInit(command.Command): "config dir %s can't be found" % config_dir) def create_working_dir(self, local_dir, config_dir): + # make sure we are working with abspath however tempest init is called + local_dir = os.path.abspath(local_dir) # Create local dir if missing if not os.path.isdir(local_dir): LOG.debug('Creating local working dir: %s' % local_dir)