Commit 46fef392 authored by Kristopher Ruzic's avatar Kristopher Ruzic

add an actual working (as in runnable) packer SR

this still has a long way to go, but it's getting there. Some stuff is not done properly at all
parent 0f1edbf2
......@@ -178,7 +178,7 @@ def getMapStorageList(disk_storage_dict, external_disk_number):
return id_list, external_disk_number
# Download existing hard drive if needed at first boot
if not (os.path.exists(disk_path) or os.path.exists(packer_path)) and virtual_hard_drive_url != '':
if not (os.path.exists(disk_path) or '%(is-packer)s') and virtual_hard_drive_url != '':
print('Downloading virtual hard drive...')
try:
downloaded_disk = disk_path
......
......@@ -20,6 +20,8 @@ extends =
# to avoid versioning issues
parts =
slapos-cookbook
slapos-cookbook-develop
template
eggs
......@@ -87,7 +89,7 @@ command =
[template]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg.in
md5sum = cf67212d3155767d0d0d8a6d75d2d8ad
#md5sum = ac3924b48aa22d70efb5316374acfb39
output = ${buildout:directory}/template.cfg
mode = 0644
......@@ -194,6 +196,15 @@ md5sum = 47d492dafe5cb314bdc49bf013d21ead
download-only = true
on-update = true
[template-packer]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/template/packer-wrapper.in
mode = 644
filename = packer-wrapper.in
md5sum = 718ae65d6410bc30001666e90ed46794
download-only = true
on-update = true
[template-httpd]
recipe = slapos.recipe.template:jinja2
filename = template-httpd.cfg
......
......@@ -6,16 +6,19 @@
#############################
[buildout]
parts =
packer
certificate-authority
publish-connection-information
# kvm-vnc-promise
kvm-disk-image-corruption-promise
# kvm-disk-image-corruption-promise
websockify-sighandler
novnc-promise
# kvm-monitor
cron
# cron-entry-monitor
frontend-promise
# frontend-promise
packer-build-template
{% if slapparameter_dict.get('document-host', '') %}
cluster-url-path
{% endif -%}
......@@ -23,7 +26,7 @@ parts =
httpd
httpd-promise
publish-host-config
packer-build-template
extends =
{{ template_httpd_cfg }}
......@@ -31,7 +34,6 @@ extends =
eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
offline = true
[directory]
recipe = slapos.cookbook:mkdirectory
......@@ -70,7 +72,7 @@ bytes = 8
# Specific code. It needs Jinja.
recipe = slapos.cookbook:kvm
is-packer = True
vnc-passwd = ''
vnc-passwd = 'l'
ipv4 = ${slap-network-information:local-ipv4}
ipv6 = ${slap-network-information:global-ipv6}
......@@ -100,6 +102,7 @@ ram-size = ${slap-parameter:ram-size}
numa = ${slap-parameter:numa}
mac-address = ${create-mac:mac-address}
tap-mac-address = ${create-tap-mac:mac-address}
kvm-software-type = software-test
# XXX-Cedric: should be named runner-wrapper-path and controller-wrapper-path
runner-path = ${directory:services}/kvm
......@@ -394,26 +397,48 @@ shell-path = {{ dash_executable_location }}
6tunnel-path = {{ sixtunnel_executable_location }}
runner-path = ${directory:services}/6tunnel-cluster
[packer]
recipe = slapos.recipe.build
# here, two %s are used, first one is for directory name (eg. x86_64), and second one is for filename (eg. x86-64).
url_x86-64 = https://dl.bintray.com/mitchellh/packer/packer_0.7.5_linux_amd64.zip
url_x86 = https://dl.bintray.com/mitchellh/packer/packer_0.7.5_linux_386.zip
# supported architectures md5sums
md5sum_x86 = a545108a0ccfde7c1e74de6c4e6fdded
md5sum_x86-64 = f343d709b84db494e8d6ec38259aa4a6
# script to install.
script =
location = %(location)r
self.failIfPathExists(location)
import sys
ARCH_DIR_MAP = { 'x86': 'x86', 'x86-64': 'x86_64' }
WK_SUFIX_MAP = { 'x86': '386', 'x86-64': 'amd64' }
platform = guessPlatform()
url = self.options['url_' + platform]
md5sum = self.options['md5sum_' + platform]
extract_dir = self.extract(self.download(url, md5sum))
shutil.move(extract_dir, location)
[packer-build-template]
< = jinja2-template-base
template = ${packer-template-wrapper:output}
rendered = $${directory:scripts}/packer-build
recipe = slapos.recipe.template:jinja2
template = {{ packer_wrapper }}
rendered = ${directory:scripts}/packer-build
mode = 0700
extra-context =
context =
key env packer-configuration:packer-environment
key content packer-configuration:packer-build-command
key dash dash_executable_location
key dash other:dash-exe
[packer-configuration]
packer-environment = ${buildout:parts-directory}/qemu/bin/
packer-build-command =
${buildout:parts-directory}/packer/packer build -color=false ${buildout:directory}/packer.json
[packer-template-wrapper]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/templates/packer-wrapper.in
output = ${buildout:directory}/packer-template-wrapper.cfg
mode = 0644
[slap-parameter]
# Default values if not specified
......@@ -463,3 +488,6 @@ packer-username = nexedi
#XXX: change to use password gen
packer-password = test
[other]
dash-exe = {{ dash_executable_location }}
\ No newline at end of file
......@@ -10,7 +10,7 @@ recipe = slapos.cookbook:softwaretype
default = $${:kvm}
kvm-cluster = $${dynamic-template-kvm-cluster:rendered}
kvm = $${dynamic-template-kvm:rendered}
packer = ${dynamic-template-packer:rendered}
packer = $${dynamic-template-packer:rendered}
nbd = ${template-nbd:output}
frontend = ${template-frontend:output}
......@@ -166,6 +166,8 @@ context =
raw sixtunnel_executable_location ${6tunnel:location}/bin/6tunnel
raw template_httpd_cfg ${template-httpd:rendered}
raw template_content ${template-content:location}/${template-content:filename}
raw packer_wrapper ${template-packer:location}/${template-packer:filename}
raw packer_dir ${template-packer:location}
raw websockify_executable_location ${buildout:directory}/bin/websockify
template-parts-destination = ${template-parts:destination}
template-replicated-destination = ${template-replicated:destination}
......
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