Commit b2381acb authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

ci: Add option to override configuration file

Add 'config_file' argument to SynnefoCI in order to use a different
configuration file. Also, added the corresponding option to 'snf-ci'
parent fc965b40
......@@ -42,6 +42,8 @@ command:
def main():
parser = OptionParser(usage=USAGE)
parser.add_option("--conf", dest="config_file", default=None,
help="Configuration file for SynnefoCI script"),
parser.add_option("-c", "--cloud", dest="kamaki_cloud", default=None,
help="Use specified cloud, as is in .kamakirc"),
parser.add_option("-f", "--flavor", dest="flavor", default=None,
......@@ -72,7 +74,8 @@ def main():
setattr(options, command, True)
cleanup_config = command in CLEAN_CONFIG_CMDS
synnefo_ci = SynnefoCI(cleanup_config=cleanup_config,
synnefo_ci = SynnefoCI(config_file=options.config_file,
if getattr(options, CREATE_SERVER_CMD, False):
......@@ -16,6 +16,8 @@ from kamaki.clients.astakos import AstakosClient
from kamaki.clients.cyclades import CycladesClient
from kamaki.clients.image import ImageClient
DEFAULT_CONFIG_FILE = "new_config"
def _run(cmd, verbose):
"""Run fabric with verbose level"""
......@@ -85,7 +87,7 @@ class _MyFormatter(logging.Formatter):
class SynnefoCI(object):
"""SynnefoCI python class"""
def __init__(self, cleanup_config=False, cloud=None):
def __init__(self, config_file=None, cleanup_config=False, cloud=None):
""" Initialize SynnefoCI python class
Setup logger, local_dir, config and kamaki
......@@ -102,13 +104,14 @@ class SynnefoCI(object):
self.repo_dir = os.path.dirname(self.ci_dir)
# Read config file
default_conffile = os.path.join(self.ci_dir, "new_config")
self.conffile = os.environ.get("SYNNEFO_CI_CONFIG_FILE",
if config_file is None:
if not os.path.isabs(config_file):
config_file = os.path.join(self.ci_dir, config_file)
self.config = ConfigParser()
self.config.optionxform = str
temp_config = self.config.get('Global', 'temporary_config')
if cleanup_config:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment