Fix for custom root dir

This commit is contained in:
Stefan Reimer 2019-07-05 11:02:10 +00:00
parent 39c9c56fea
commit c28d9c751d
4 changed files with 13 additions and 3 deletions

View File

@ -1,5 +1,8 @@
# Changelog # Changelog
## 0.6.2
- Fixed custom root directory to allow automated template tests
## 0.6.1 ## 0.6.1
- Add support for onfailure for create stack, defaults to DELETE - Add support for onfailure for create stack, defaults to DELETE

View File

@ -2,7 +2,7 @@ import logging
__author__ = "Stefan Reimer" __author__ = "Stefan Reimer"
__email__ = "stefan@zero-downtimet.net" __email__ = "stefan@zero-downtimet.net"
__version__ = "0.6.1" __version__ = "0.6.2"
# Set up logging to ``/dev/null`` like a library is supposed to. # Set up logging to ``/dev/null`` like a library is supposed to.

View File

@ -20,8 +20,15 @@ logger = logging.getLogger(__name__)
def cli(ctx, debug, directory): def cli(ctx, debug, directory):
setup_logging(debug) setup_logging(debug)
# Make sure our root is abs
if directory:
if not os.path.isabs(directory):
directory = os.path.normpath(os.path.join(os.getcwd(), directory))
else:
directory = os.getcwd()
# Read global config # Read global config
cb = CloudBender(directory if directory else os.getcwd()) cb = CloudBender(directory)
cb.read_config() cb.read_config()
cb.dump_config() cb.dump_config()

View File

@ -21,7 +21,7 @@ class CloudBender(object):
"artifact_paths": [os.path.join(self.root, "artifacts")] "artifact_paths": [os.path.join(self.root, "artifacts")]
} }
if not os.path.isdir(self.root): if not os.path.isdir(self.ctx['config_path']):
raise "Check '{0}' exists and is a valid project folder.".format(root_path) raise "Check '{0}' exists and is a valid project folder.".format(root_path)
def read_config(self): def read_config(self):