Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
90fa09a7
Commit
90fa09a7
authored
Aug 01, 2013
by
Christos Stavrakakis
Browse files
ci: Specify directory to fetch packages to
parent
c14d11ae
Changes
2
Hide whitespace changes
Inline
Side-by-side
ci/snf-ci
View file @
90fa09a7
...
...
@@ -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
=
Fals
e
,
default
=
Non
e
,
help
=
"Download the debian packages that were created"
" during the '%s' step."
%
BUILD_SYNNEFO_CMD
)
" during the '%s' step in this directory"
%
BUILD_SYNNEFO_CMD
)
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
):
synnefo_ci
.
build_synnefo
()
if
options
.
fetch_packages
:
synnefo_ci
.
fetch_packages
()
dest
=
os
.
path
.
abspath
(
options
.
fetch_packages
)
synnefo_ci
.
fetch_packages
(
dest
=
dest
)
if
getattr
(
options
,
DEPLOY_SYNNEFO_CMD
,
False
):
synnefo_ci
.
deploy_synnefo
(
schema
=
options
.
schema
)
if
getattr
(
options
,
TEST_SYNNEFO_CMD
,
False
):
...
...
ci/utils.py
View file @
90fa09a7
...
...
@@ -520,7 +520,7 @@ class SynnefoCI(object):
_run
(
cmd
,
True
)
@
_check_fabric
def
fetch_packages
(
self
):
def
fetch_packages
(
self
,
dest
=
None
):
"""Download Synnefo packages"""
self
.
logger
.
info
(
"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'
)
else
:
pkgs_dir
=
dest
self
.
logger
.
debug
(
"Fetch packages to local dir %s"
%
pkgs_dir
)
os
.
makedirs
(
pkgs_dir
)
# Create package directory if missing
if
not
os
.
path
.
exists
(
pkgs_dir
):
os
.
makedirs
(
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
)
self
.
logger
.
info
(
"Downloaded debian packages to %s"
%
_green
(
pkgs_dir
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment