Commit e8366819 authored by Ilias Tsitsimpis's avatar Ilias Tsitsimpis
Browse files

ci: pep8 fixes

parent 606b2530
#!/usr/bin/env python
# Invalid name for type module. pylint: disable-msg=C0103
Continuous Integration script for Synnefo.
import os
from utils import SynnefoCI
from optparse import OptionParser
......@@ -45,12 +49,13 @@ command:
def main():
def main(): # Too many branches. pylint: disable-msg=R0912
"""Parse command line options and run the specified actions"""
parser = OptionParser(usage=USAGE)
parser.add_option("--conf", dest="config_file", default=None,
help="Configuration file for SynnefoCI script"),
help="Configuration file for SynnefoCI script")
parser.add_option("-c", "--cloud", dest="kamaki_cloud", default=None,
help="Use specified cloud, as is in .kamakirc"),
help="Use specified cloud, as is in .kamakirc")
parser.add_option("-f", "--flavor", dest="flavor", default=None,
help="Name of flavor to use for the server.")
parser.add_option("-i", "--image", dest="image", default=None,
......@@ -27,7 +27,7 @@ def _run(cmd, verbose):
args = ('running',)
args = ('running', 'stdout',)
with fabric.hide(*args):
with fabric.hide(*args): # Used * or ** magic. pylint: disable-msg=W0142
......@@ -118,7 +118,7 @@ class SynnefoCI(object):
if cleanup_config:
except OSError:
else:'Global', 'temporary_config'))
......@@ -281,6 +281,7 @@ class SynnefoCI(object):
def _copy_ssh_keys(self):
"""Upload/Install ssh keys to server"""
if not self.config.has_option("Deployment", "ssh_keys"):
authorized_keys = self.config.get("Deployment",
......@@ -356,12 +357,14 @@ class SynnefoCI(object):
synnefo_repo = self.config.get('Global', 'synnefo_repo')
synnefo_branch = self.config.get("Global", "synnefo_branch")
if synnefo_branch == "":
synnefo_branch =\
subprocess.Popen(["git", "rev-parse", "--abbrev-ref", "HEAD"],
synnefo_branch = \
["git", "rev-parse", "--abbrev-ref", "HEAD"],
if synnefo_branch == "HEAD":
synnefo_branch = \
subprocess.Popen(["git", "rev-parse","--short", "HEAD"],
["git", "rev-parse", "--short", "HEAD"],
stdout=subprocess.PIPE).communicate()[0].strip()"Will use branch %s" % synnefo_branch)
# Currently clonning synnefo can fail unexpectedly
......@@ -372,12 +375,13 @@ class SynnefoCI(object):
_run("git clone %s synnefo" % synnefo_repo, False)
cloned = True
except BaseException:
self.logger.warning("Clonning synnefo failed.. retrying %s"
% i)
cmd ="""
cmd = """
cd synnefo
for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master`; do
for branch in `git branch -a | grep remotes | \
grep -v HEAD | grep -v master`; do
git branch --track ${branch##*/} $branch
git checkout %s
......@@ -446,15 +450,18 @@ class SynnefoCI(object):
_run(cmd, False)
def build_documentation(self):
"""Build Synnefo documentation""""Build Synnefo documentation..")
_run("pip install -U Sphinx", False)
_run("devflow-update-version; ./ci/ synnefo_documentation", False)
_run("devflow-update-version; "
"./ci/ synnefo_documentation", False)
def fetch_documentation(self, dest=None):
"""Fetch Synnefo documentation""""Fetch Synnefo documentation..")
if dest is None:
dest = "synnefo_documentation"
dest = os.path.abspath(dest)
......@@ -540,6 +547,7 @@ class SynnefoCI(object):
def fetch_compressed(self, src, dest=None):
"""Create a tarball and fetch it locally"""
self.logger.debug("Creating tarball of %s" % src)
basename = os.path.basename(src)
tar_file = basename + ".tgz"
......@@ -566,6 +574,7 @@ class SynnefoCI(object):
def fetch_packages(self, dest=None):
"""Fetch Synnefo packages"""
if dest is None:
dest = self.config.get('Global', 'pkgs_dir')
dest = os.path.abspath(dest)
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