Revision e2db4a57
b/ci/snf-ci | ||
---|---|---|
42 | 42 |
|
43 | 43 |
def main(): |
44 | 44 |
parser = OptionParser(usage=USAGE) |
45 |
parser.add_option("--conf", dest="config_file", default=None, |
|
46 |
help="Configuration file for SynnefoCI script"), |
|
45 | 47 |
parser.add_option("-c", "--cloud", dest="kamaki_cloud", default=None, |
46 | 48 |
help="Use specified cloud, as is in .kamakirc"), |
47 | 49 |
parser.add_option("-f", "--flavor", dest="flavor", default=None, |
... | ... | |
72 | 74 |
setattr(options, command, True) |
73 | 75 |
|
74 | 76 |
cleanup_config = command in CLEAN_CONFIG_CMDS |
75 |
synnefo_ci = SynnefoCI(cleanup_config=cleanup_config, |
|
77 |
synnefo_ci = SynnefoCI(config_file=options.config_file, |
|
78 |
cleanup_config=cleanup_config, |
|
76 | 79 |
cloud=options.kamaki_cloud) |
77 | 80 |
|
78 | 81 |
if getattr(options, CREATE_SERVER_CMD, False): |
b/ci/utils.py | ||
---|---|---|
16 | 16 |
from kamaki.clients.cyclades import CycladesClient |
17 | 17 |
from kamaki.clients.image import ImageClient |
18 | 18 |
|
19 |
DEFAULT_CONFIG_FILE = "new_config" |
|
20 |
|
|
19 | 21 |
|
20 | 22 |
def _run(cmd, verbose): |
21 | 23 |
"""Run fabric with verbose level""" |
... | ... | |
85 | 87 |
class SynnefoCI(object): |
86 | 88 |
"""SynnefoCI python class""" |
87 | 89 |
|
88 |
def __init__(self, cleanup_config=False, cloud=None): |
|
90 |
def __init__(self, config_file=None, cleanup_config=False, cloud=None):
|
|
89 | 91 |
""" Initialize SynnefoCI python class |
90 | 92 |
|
91 | 93 |
Setup logger, local_dir, config and kamaki |
... | ... | |
102 | 104 |
self.repo_dir = os.path.dirname(self.ci_dir) |
103 | 105 |
|
104 | 106 |
# Read config file |
105 |
default_conffile = os.path.join(self.ci_dir, "new_config") |
|
106 |
self.conffile = os.environ.get("SYNNEFO_CI_CONFIG_FILE", |
|
107 |
default_conffile) |
|
107 |
if config_file is None: |
|
108 |
config_file = DEFAULT_CONFIG_FILE |
|
109 |
if not os.path.isabs(config_file): |
|
110 |
config_file = os.path.join(self.ci_dir, config_file) |
|
108 | 111 |
|
109 | 112 |
self.config = ConfigParser() |
110 | 113 |
self.config.optionxform = str |
111 |
self.config.read(self.conffile)
|
|
114 |
self.config.read(config_file)
|
|
112 | 115 |
temp_config = self.config.get('Global', 'temporary_config') |
113 | 116 |
if cleanup_config: |
114 | 117 |
try: |
Also available in: Unified diff