Commit 90fa09a7 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

ci: Specify directory to fetch packages to

parent c14d11ae
......@@ -2,6 +2,7 @@
import os
from utils import SynnefoCI
from optparse import OptionParser
......@@ -51,9 +52,10 @@ def main():
parser.add_option("-i", "--image", dest="image", default=None,
help="UUID of image to use for the server.")
parser.add_option("--fetch-packages", dest="fetch_packages",
action="store_true", default=False,
help="Download the debian packages that were created"
" during the '%s' step." % BUILD_SYNNEFO_CMD)
" during the '%s' step in this directory" %
parser.add_option("--schema", dest="schema", default=None,
help="Schema for snf-deploy.")
......@@ -91,7 +93,8 @@ def main():
if getattr(options, BUILD_SYNNEFO_CMD, False):
if options.fetch_packages:
dest = os.path.abspath(options.fetch_packages)
if getattr(options, DEPLOY_SYNNEFO_CMD, False):
if getattr(options, TEST_SYNNEFO_CMD, False):
......@@ -520,7 +520,7 @@ class SynnefoCI(object):
_run(cmd, True)
def fetch_packages(self):
def fetch_packages(self, dest=None):
"""Download Synnefo packages""""Download Synnefo packages")
self.logger.debug("Create tarball with packages")
......@@ -529,9 +529,16 @@ class SynnefoCI(object):
_run(cmd, False)
pkgs_dir = self.config.get('Global', 'pkgs_dir')
if dest is None:
pkgs_dir = self.config.get('Global', 'pkgs_dir')
pkgs_dir = dest
self.logger.debug("Fetch packages to local dir %s" % pkgs_dir)
# Create package directory if missing
if not os.path.exists(pkgs_dir):
with fabric.quiet():
fabric.get("synnefo_build-area.tgz", pkgs_dir)
......@@ -539,6 +546,12 @@ class SynnefoCI(object):
self._check_hash_sum(pkgs_file, "synnefo_build-area.tgz")
self.logger.debug("Untar packages file %s" % pkgs_file)
os.system("cd %s; tar xzf synnefo_build-area.tgz" % pkgs_dir)
cmd = """
cd %s
tar xzf synnefo_build-area.tgz
cp synnefo_build-area/* %s
rm -r synnefo_build-area
""" % (pkgs_dir, dest)
os.system(cmd)"Downloaded debian packages to %s" %
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