Commit 0eef886c authored by Dimitris Aragiorgis's avatar Dimitris Aragiorgis Committed by Stratos Psomadakis

deploy: Fix debian_base.diskdump registration

In commit 255795 we use official meta file in order to register
the image. Here we store both downloaded diskdump and meta files
under /srv/images.
Signed-off-by: default avatarDimitris Aragiorgis <dimitris.aragiorgis@gmail.com>
parent 3767b316
......@@ -796,11 +796,9 @@ class Image(base.Component):
@base.run_cmds
def prepare(self):
url = config.debian_base_url
d = config.images_dir
image = "debian_base.diskdump"
image = config.debian_base_image
return [
"test -e /tmp/%s || wget -4 %s -O /tmp/%s" % (image, url, image),
"cp /tmp/%s %s/%s" % (image, d, image),
"test -e %s || wget -4 %s -O %s" % (image, url, image),
"mv /etc/default/snf-image /etc/default/snf-image.orig",
]
......@@ -1794,37 +1792,39 @@ class Kamaki(base.Component):
def _fetch_image(self):
url = config.debian_base_url
image = "debian_base.diskdump"
image = config.debian_base_image
return [
"test -e /tmp/%s || wget -4 %s -O /tmp/%s" % (image, url, image)
"test -e %s || wget -4 %s -O %s" % (image, url, image)
]
def _fetch_image_meta(self):
url = config.debian_base_url + ".meta"
meta = "debian_base.diskdump.meta"
meta = config.debian_base_image + ".meta"
return [
"test -e /srv/images/%s || wget -4 %s -O /srv/images/%s" % (meta, url, meta)
"test -e %s || wget -4 %s -O %s" % (meta, url, meta)
]
def _upload_image(self):
image = "debian_base.diskdump"
local = config.debian_base_image
remote = config.debian_base_name
return [
"kamaki file upload --container images /tmp/%s %s" % (image, image)
"kamaki file upload --container images %s %s" % (local, remote)
]
def _upload_image_meta(self):
image = "debian_base.diskdump.meta"
local = config.debian_base_image + ".meta"
remote = config.debian_base_name + ".meta"
return [
"kamaki file upload --container images /srv/images/%s %s" % (image, image)
"kamaki file upload --container images %s %s" % (local, remote)
]
def _register_image(self):
image = "debian_base.diskdump"
image_location = "/images/%s" % image
meta = config.debian_base_image + ".meta"
image_location = "/images/%s" % config.debian_base_name
cmd = """
kamaki image register --name "Debian Base" --location {0} --public \
--force --metafile /srv/{0}.meta
""".format(image_location)
--force --metafile {1}
""".format(image_location, meta)
return [
"sleep 5",
cmd
......
......@@ -147,6 +147,12 @@ def init(args):
config.archip_dir = os.path.join(config.shared_dir, "archip")
config.src_dir = os.path.join(config.shared_dir, "src")
# debian_base_url is given in config
# Here we set some config vars that will be frequently used
config.debian_base_name = "debian_base.diskdump"
config.debian_base_image = os.path.join(config.images_dir,
config.debian_base_name)
if args.disable_colors:
disable_color()
......
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