27 |
27 |
args = ('running',)
|
28 |
28 |
else:
|
29 |
29 |
args = ('running', 'stdout',)
|
30 |
|
with fabric.hide(*args):
|
|
30 |
with fabric.hide(*args): # Used * or ** magic. pylint: disable-msg=W0142
|
31 |
31 |
return fabric.run(cmd)
|
32 |
32 |
|
33 |
33 |
|
... | ... | |
118 |
118 |
if cleanup_config:
|
119 |
119 |
try:
|
120 |
120 |
os.remove(temp_config)
|
121 |
|
except:
|
|
121 |
except OSError:
|
122 |
122 |
pass
|
123 |
123 |
else:
|
124 |
124 |
self.config.read(self.config.get('Global', 'temporary_config'))
|
... | ... | |
281 |
281 |
|
282 |
282 |
@_check_fabric
|
283 |
283 |
def _copy_ssh_keys(self):
|
|
284 |
"""Upload/Install ssh keys to server"""
|
284 |
285 |
if not self.config.has_option("Deployment", "ssh_keys"):
|
285 |
286 |
return
|
286 |
287 |
authorized_keys = self.config.get("Deployment",
|
... | ... | |
356 |
357 |
synnefo_repo = self.config.get('Global', 'synnefo_repo')
|
357 |
358 |
synnefo_branch = self.config.get("Global", "synnefo_branch")
|
358 |
359 |
if synnefo_branch == "":
|
359 |
|
synnefo_branch =\
|
360 |
|
subprocess.Popen(["git", "rev-parse", "--abbrev-ref", "HEAD"],
|
|
360 |
synnefo_branch = \
|
|
361 |
subprocess.Popen(
|
|
362 |
["git", "rev-parse", "--abbrev-ref", "HEAD"],
|
361 |
363 |
stdout=subprocess.PIPE).communicate()[0].strip()
|
362 |
364 |
if synnefo_branch == "HEAD":
|
363 |
365 |
synnefo_branch = \
|
364 |
|
subprocess.Popen(["git", "rev-parse","--short", "HEAD"],
|
|
366 |
subprocess.Popen(
|
|
367 |
["git", "rev-parse", "--short", "HEAD"],
|
365 |
368 |
stdout=subprocess.PIPE).communicate()[0].strip()
|
366 |
369 |
self.logger.info("Will use branch %s" % synnefo_branch)
|
367 |
370 |
# Currently clonning synnefo can fail unexpectedly
|
... | ... | |
372 |
375 |
_run("git clone %s synnefo" % synnefo_repo, False)
|
373 |
376 |
cloned = True
|
374 |
377 |
break
|
375 |
|
except:
|
|
378 |
except BaseException:
|
376 |
379 |
self.logger.warning("Clonning synnefo failed.. retrying %s"
|
377 |
380 |
% i)
|
378 |
|
cmd ="""
|
|
381 |
cmd = """
|
379 |
382 |
cd synnefo
|
380 |
|
for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master`; do
|
|
383 |
for branch in `git branch -a | grep remotes | \
|
|
384 |
grep -v HEAD | grep -v master`; do
|
381 |
385 |
git branch --track ${branch##*/} $branch
|
382 |
386 |
done
|
383 |
387 |
git checkout %s
|
... | ... | |
446 |
450 |
"""
|
447 |
451 |
_run(cmd, False)
|
448 |
452 |
|
449 |
|
|
450 |
453 |
@_check_fabric
|
451 |
454 |
def build_documentation(self):
|
|
455 |
"""Build Synnefo documentation"""
|
452 |
456 |
self.logger.info("Build Synnefo documentation..")
|
453 |
457 |
_run("pip install -U Sphinx", False)
|
454 |
458 |
with fabric.cd("synnefo"):
|
455 |
|
_run("devflow-update-version; ./ci/make_docs.sh synnefo_documentation", False)
|
|
459 |
_run("devflow-update-version; "
|
|
460 |
"./ci/make_docs.sh synnefo_documentation", False)
|
456 |
461 |
|
457 |
462 |
def fetch_documentation(self, dest=None):
|
|
463 |
"""Fetch Synnefo documentation"""
|
|
464 |
self.logger.info("Fetch Synnefo documentation..")
|
458 |
465 |
if dest is None:
|
459 |
466 |
dest = "synnefo_documentation"
|
460 |
467 |
dest = os.path.abspath(dest)
|
... | ... | |
540 |
547 |
|
541 |
548 |
@_check_fabric
|
542 |
549 |
def fetch_compressed(self, src, dest=None):
|
|
550 |
"""Create a tarball and fetch it locally"""
|
543 |
551 |
self.logger.debug("Creating tarball of %s" % src)
|
544 |
552 |
basename = os.path.basename(src)
|
545 |
553 |
tar_file = basename + ".tgz"
|
... | ... | |
566 |
574 |
|
567 |
575 |
@_check_fabric
|
568 |
576 |
def fetch_packages(self, dest=None):
|
|
577 |
"""Fetch Synnefo packages"""
|
569 |
578 |
if dest is None:
|
570 |
579 |
dest = self.config.get('Global', 'pkgs_dir')
|
571 |
580 |
dest = os.path.abspath(dest)
|