Revision e908a902
b/ci/utils.py | ||
---|---|---|
101 | 101 |
self.repo_dir = os.path.dirname(self.ci_dir) |
102 | 102 |
|
103 | 103 |
# Read config file |
104 |
self.conffile = os.path.join(self.ci_dir, "new_config") |
|
104 |
default_conffile = os.path.join(self.ci_dir, "new_config") |
|
105 |
self.conffile = os.environ.get("SYNNEFO_CI_CONFIG_FILE", |
|
106 |
default_conffile) |
|
107 |
|
|
105 | 108 |
self.config = ConfigParser() |
106 | 109 |
self.config.optionxform = str |
107 | 110 |
self.config.read(self.conffile) |
... | ... | |
197 | 200 |
self.logger.debug("Server's admin user is %s" % _green(server_user)) |
198 | 201 |
server_passwd = server['adminPass'] |
199 | 202 |
self.write_config('server_passwd', server_passwd) |
200 |
self.logger.debug( |
|
201 |
"Server's admin password is %s" % _green(server_passwd)) |
|
202 | 203 |
|
203 | 204 |
server = self._wait_transition(server_id, "BUILD", "ACTIVE") |
204 | 205 |
self._get_server_ip_and_port(server) |
... | ... | |
239 | 240 |
self.logger.info("Get server connection details..") |
240 | 241 |
# XXX: check if this IP is from public network |
241 | 242 |
server_ip = server['attachments'][0]['ipv4'] |
242 |
if eval(self.config.get('Deployment', 'deploy_on_io')):
|
|
243 |
if self.config.get('Deployment', 'deploy_on_io') == "True":
|
|
243 | 244 |
tmp1 = int(server_ip.split(".")[2]) |
244 | 245 |
tmp2 = int(server_ip.split(".")[3]) |
245 | 246 |
server_ip = "gate.okeanos.io" |
... | ... | |
268 | 269 |
fabric.env.user = self.config.get('Temporary Options', 'server_user') |
269 | 270 |
fabric.env.host_string = \ |
270 | 271 |
self.config.get('Temporary Options', 'server_ip') |
271 |
fabric.env.port = self.config.getint('Temporary Options', 'server_port') |
|
272 |
fabric.env.password = \ |
|
273 |
self.config.get('Temporary Options', 'server_passwd') |
|
272 |
fabric.env.port = self.config.getint('Temporary Options', |
|
273 |
'server_port') |
|
274 |
fabric.env.password = self.config.get('Temporary Options', |
|
275 |
'server_passwd') |
|
274 | 276 |
fabric.env.connection_attempts = 10 |
275 | 277 |
fabric.env.shell = "/bin/bash -c" |
276 | 278 |
fabric.env.disable_known_hosts = True |
... | ... | |
309 | 311 |
_run(cmd, False) |
310 | 312 |
|
311 | 313 |
synnefo_repo = self.config.get('Global', 'synnefo_repo') |
314 |
synnefo_branch = self.config.get('Global', 'synnefo_branch') |
|
312 | 315 |
# Currently clonning synnefo can fail unexpectedly |
316 |
cloned = False |
|
313 | 317 |
for i in range(3): |
314 | 318 |
self.logger.debug("Clone synnefo from %s" % synnefo_repo) |
319 |
cmd = ("git clone --branch %s %s" |
|
320 |
% (synnefo_branch, synnefo_repo)) |
|
315 | 321 |
try: |
316 |
_run("git clone %s" % synnefo_repo, False) |
|
322 |
_run(cmd, False) |
|
323 |
cloned = True |
|
317 | 324 |
break |
318 | 325 |
except: |
319 |
self.logger.warning("Clonning synnefo failed.. retrying %s" % i) |
|
320 |
|
|
321 |
synnefo_branch = self.config.get('Global', 'synnefo_branch') |
|
322 |
if synnefo_branch == "HEAD": |
|
323 |
# Get current branch |
|
324 |
synnefo_branch = os.popen("git rev-parse HEAD").read().strip() |
|
325 |
self.logger.debug( |
|
326 |
"Checkout %s in feature-ci branch" % synnefo_branch) |
|
327 |
with fabric.cd("synnefo"): |
|
328 |
_run("git checkout -b feature-ci %s" % synnefo_branch, False) |
|
329 |
elif synnefo_branch == "origin/master": |
|
330 |
pass |
|
331 |
elif "origin" in synnefo_branch: |
|
332 |
self.logger.debug("Checkout %s branch" % synnefo_branch) |
|
333 |
with fabric.cd("synnefo"): |
|
334 |
_run("git checkout -t %s" % synnefo_branch, False) |
|
335 |
else: |
|
336 |
self.logger.debug( |
|
337 |
"Checkout %s in feature-ci branch" % synnefo_branch) |
|
338 |
with fabric.cd("synnefo"): |
|
339 |
_run("git checkout -b feature-ci %s" % synnefo_branch, False) |
|
326 |
self.logger.warning("Clonning synnefo failed.. retrying %s" |
|
327 |
% i) |
|
328 |
if not cloned: |
|
329 |
self.logger.error("Can not clone Synnefo repo.") |
|
330 |
sys.exit(-1) |
|
340 | 331 |
|
341 | 332 |
deploy_repo = self.config.get('Global', 'deploy_repo') |
342 | 333 |
self.logger.debug("Clone snf-deploy from %s" % deploy_repo) |
343 |
_run("git clone %s" % deploy_repo, False) |
|
334 |
_run("git clone --depth 1 %s" % deploy_repo, False)
|
|
344 | 335 |
|
345 | 336 |
@_check_fabric |
346 | 337 |
def build_synnefo(self): |
... | ... | |
355 | 346 |
""" |
356 | 347 |
_run(cmd, False) |
357 | 348 |
|
358 |
if eval(self.config.get('Global', 'patch_pydist')):
|
|
349 |
if self.config.get('Global', 'patch_pydist') == "True":
|
|
359 | 350 |
self.logger.debug("Patch pydist.py module") |
360 | 351 |
cmd = r""" |
361 | 352 |
sed -r -i 's/(\(\?P<name>\[A-Za-z\]\[A-Za-z0-9_\.)/\1\\\-/' \ |
Also available in: Unified diff