Switch to classic confinement

Classic confinement allows the snap to behave like a traditionally
packaged application with full access to the system, and enables the
use of traditional directories such as /etc and /var/log.

We will continue to store all of the snap's files in $SNAP* directories.
This enables the snap to cleanup after itself if it is removed. However,
traditional directory locations are symlinked to their corresponding
$SNAP* directories.

For example, glance configs are installed in $SNAP_COMMON/etc/glance
which has a symlink at /etc/glance.

The glance apps then use the traditional directories when running
commands and services.

Change-Id: Ic763f9c8f34ab3096e8592520db00cdf81b0d9ef
This commit is contained in:
Corey Bryant 2017-03-20 19:30:38 +00:00
parent 23b8f67dd3
commit cd9990d665
5 changed files with 35 additions and 37 deletions

View File

@ -1 +1,2 @@
snapcraft [platform:dpkg]
snapd [platform:dpkg]

View File

@ -1,33 +1,36 @@
setup:
dirs:
- "{snap_common}/etc/glance.conf.d"
- "{snap_common}/etc/glance"
- "{snap_common}/log"
- "{snap_common}/lock"
- "{snap_common}/images"
- "{snap_common}/etc/glance/conf.d"
- "{snap_common}/lib/glance/images"
- "{snap_common}/log/glance"
- "{snap_common}/lock/glance"
symlinks:
"{snap_common}/etc/glance": /etc/glance
"{snap_common}/lib/glance": /var/lib/glance
"{snap_common}/log/glance": /var/log/glance
"{snap_common}/lock/glance": /var/lock/glance
templates:
"glance-snap.conf.j2": "{snap_common}/etc/glance.conf.d/glance-snap.conf"
glance-snap.conf.j2: "{snap_common}/etc/glance/conf.d/glance-snap.conf"
copyfiles:
"{snap}/etc/glance": "{snap_common}/etc/glance"
entry_points:
glance-manage:
binary: glance-manage
config-files:
- "{snap}/etc/glance/glance.conf"
- "{snap_common}/etc/glance/glance.conf"
- "/etc/glance/glance.conf"
config-dirs:
- "{snap_common}/etc/glance.conf.d"
- "/etc/glance/conf.d"
glance-registry:
binary: glance-registry
config-files:
- "{snap}/etc/glance/glance-registry.conf"
- "{snap_common}/etc/glance/glance-registry.conf"
- "/etc/glance/glance-registry.conf"
config-dirs:
- "{snap_common}/etc/glance.conf.d"
log-file: "{snap_common}/log/glance-registry.log"
- "/etc/glance/conf.d"
log-file: "/var/log/glance/glance-registry.log"
glance-api:
binary: glance-api
config-files:
- "{snap}/etc/glance/glance-api.conf"
- "{snap_common}/etc/glance/glance-api.conf"
- "/etc/glance/glance-api.conf"
config-dirs:
- "{snap_common}/etc/glance.conf.d"
log-file: "{snap_common}/log/glance-api.log"
- "/etc/glance/conf.d"
log-file: "/var/log/glance/glance-api.log"

View File

@ -1,11 +1,11 @@
[DEFAULT]
# Set state path to writable directory
state_path = {{ snap_common }}
state_path = /var/lib/glance
[oslo_concurrency]
# Oslo Concurrency lock path
lock_path = {{ snap_common }}/lock
lock_path = /var/lock/glance
[glance_store]
# Set default glance_store path to writable directory
filesystem_store_datadir = {{ snap_common }}/images
filesystem_store_datadir = /var/lib/glance/images

View File

@ -6,26 +6,21 @@ description: |
to store, browse, share, distribute and manage bootable disk images,
other data closely associated with initializing compute resources,
and metadata definitions.
confinement: strict
confinement: classic
grade: devel
environment:
PATH: $PATH:$SNAP/bin/
apps:
api:
command: snap-openstack glance-api
daemon: simple
plugs:
- network
- network-bind
registry:
command: snap-openstack glance-registry
daemon: simple
plugs:
- network
- network-bind
manage:
command: snap-openstack glance-manage
plugs:
- network
aliases:
- glance-manage
@ -46,21 +41,16 @@ parts:
- git+https://github.com/openstack/snap.openstack#egg=snap.openstack
constraints: https://raw.githubusercontent.com/openstack/requirements/master/upper-constraints.txt
build-packages:
- gcc
- libffi-dev
- libssl-dev
- libxml2-dev
- libxslt1-dev
- pkg-config
- gcc
templates:
after:
- glance
after: [glance]
plugin: dump
source: snap
# TODO: replace below with scriplets once implemented in snapcraft
config:
after:
- glance
after: [glance]
plugin: dump
source: http://tarballs.openstack.org/glance/glance-master.tar.gz
organize:

View File

@ -6,9 +6,13 @@ skipsdist = True
basepython = python3.5
install_command = pip install {opts} {packages}
passenv = HOME TERM
whitelist_externals =
sudo
snapcraft
[testenv:snap]
deps = -r{toxinidir}/requirements.txt
commands =
sudo snap install core
snapcraft clean
snapcraft snap