docker support

Change-Id: I6f09b6d39010a7412cfd4997e82549b6a5d7501c
This commit is contained in:
Jakub Pavlik 2016-05-24 23:25:25 +02:00
parent 81a8943862
commit 7634ad9d3a
3 changed files with 42 additions and 3 deletions

View File

@ -0,0 +1,25 @@
{%- from "glance/map.jinja" import server with context -%}
#!/bin/bash -e
cat /srv/salt/pillar/glance-server.sls | envsubst > /tmp/glance-server.sls
mv /tmp/glance-server.sls /srv/salt/pillar/glance-server.sls
salt-call --local --retcode-passthrough state.highstate
{% for service in server.services %}
service {{ service }} stop || true
{% endfor %}
if [ "$1" == "api" ]; then
echo "starting glance-api"
su glance --shell=/bin/sh -c '/usr/bin/glance-api --config-file=/etc/glance/glance-api.conf'
elif [ "$1" == "registry" ]; then
echo "starting glance-registry"
su glance --shell=/bin/sh -c '/usr/bin/glance-registry --config-file=/etc/glance/glance-registry.conf'
else
echo "No parameter submitted, don't know what to start" 1>&2
fi
{#-
vim: syntax=jinja
-#}

View File

@ -1,7 +1,7 @@
{% set server = salt['grains.filter_by']({
'Debian': {
'pkgs': ['glance', 'glance-api', 'glance-registry', 'glance-common', 'python-glance', 'python-glance-store', 'python-glanceclient'],
'pkgs': ['glance', 'glance-api', 'glance-registry', 'glance-common', 'python-glance', 'python-glance-store', 'python-glanceclient', 'gettext-base'],
'services': ['glance-api', 'glance-registry'],
'notification': False,
},

View File

@ -61,8 +61,8 @@ glance_group:
- template: jinja
- require:
- pkg: glance_packages
- watch_in:
- service: glance_services
{%- if not grains.get('noservices', False) %}
glance_services:
service.running:
@ -71,6 +71,7 @@ glance_services:
- watch:
- file: /etc/glance/glance-api.conf
- file: /etc/glance/glance-registry.conf
- file: /etc/glance/glance-api-paste.ini
glance_install_database:
cmd.run:
@ -78,6 +79,19 @@ glance_install_database:
- require:
- service: glance_services
{%- endif %}
{%- if grains.get('virtual_subtype', None) == "Docker" %}
glance_entrypoint:
file.managed:
- name: /entrypoint.sh
- template: jinja
- source: salt://glance/files/entrypoint.sh
- mode: 755
{%- endif %}
/var/lib/glance/images:
file.directory:
- mode: 755