From 7579f5f9d119db5f3f78f3955baf428168df3319 Mon Sep 17 00:00:00 2001 From: noelmcloughlin Date: Tue, 13 Mar 2018 16:35:00 +0000 Subject: [PATCH] support for systemd in kitchen --- .kitchen.yml | 9 +++++++++ packages/defaults.yaml | 3 ++- packages/osmap.yaml | 4 +++- packages/snaps.sls | 30 +++++++++++++++++++++++------- 4 files changed, 37 insertions(+), 9 deletions(-) diff --git a/.kitchen.yml b/.kitchen.yml index 61058b4..1c188be 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -9,11 +9,20 @@ driver_config: platforms: - name: debian-9 + driver_config: + run_command: /lib/systemd/systemd + provision_command: + - apt-get install udev -y - name: ubuntu-17.10 + driver_config: + run_command: /lib/systemd/systemd - name: fedora-27 + driver_config: + run_command: /usr/lib/systemd/systemd - name: centos-7 driver_config: image: saltstack/centos-7-minimal + run_command: /usr/lib/systemd/systemd provisioner: name: salt_solo diff --git a/packages/defaults.yaml b/packages/defaults.yaml index 82a4129..91ddd56 100644 --- a/packages/defaults.yaml +++ b/packages/defaults.yaml @@ -23,7 +23,8 @@ packages: pkgs: [] snaps: package: snapd - collides: ['snap',] + collides: [] + symlink: False service: ['snapd.service', 'snapd.socket',] wanted: [] unwanted: [] diff --git a/packages/osmap.yaml b/packages/osmap.yaml index 757aa06..1e5fba8 100644 --- a/packages/osmap.yaml +++ b/packages/osmap.yaml @@ -10,4 +10,6 @@ Fedora: - gcc - python2-pip - python2-devel - + snaps: + collides: ['snap',] + symlink: True diff --git a/packages/snaps.sls b/packages/snaps.sls index ce79f86..3e23b7d 100644 --- a/packages/snaps.sls +++ b/packages/snaps.sls @@ -6,7 +6,9 @@ {% set wanted_snaps = packages.snaps.wanted %} {% set unwanted_snaps = packages.snaps.unwanted %} -### REQ PKGS (without these, some WANTED SNAPS fail to install/uninstall) +{% if packages.snaps.wanted or packages.snaps.unwanted %} + +### REQ PKGS (without this, SNAPS can fail to install/uninstall) include: - packages.pkgs @@ -30,7 +32,20 @@ extend: {% endfor %} {% endif %} -{% for snap in packages.snaps.service %} + {% if packages.snaps.symlink %} + {# classic confinement requires snaps under /snap or symlink from #} + {# /snap to /var/lib/snapd/snap #} +packages-snap-classic-symlink: + file.symlink: + - name: /snap + - target: /var/lib/snapd/snap + - unless: test -d /snap + - require: + - pkg: pkg_req_pkgs + - pkg: unwanted_pkgs + {% endif %} + + {% for snap in packages.snaps.service %} packages-{{ snap }}-service: service.running: - name: {{ snap }} @@ -38,11 +53,11 @@ packages-{{ snap }}-service: - require: - pkg: pkg_req_pkgs - pkg: unwanted_pkgs -{% endfor %} + {% endfor %} ### SNAPS to install -{% for snap in wanted_snaps %} + {% for snap in wanted_snaps %} packages-snapd-{{ snap }}-wanted: cmd.run: - name: snap install {{ snap }} @@ -51,11 +66,11 @@ packages-snapd-{{ snap }}-wanted: - require: - pkg: pkg_req_pkgs - pkg: unwanted_pkgs -{% endfor %} + {% endfor %} ### SNAPS to uninstall -{% for snap in unwanted_snaps %} + {% for snap in unwanted_snaps %} packages-snapd-{{ snap }}-unwanted: cmd.run: - name: snap remove {{ snap }} @@ -64,5 +79,6 @@ packages-snapd-{{ snap }}-unwanted: - require: - pkg: pkg_req_pkgs - pkg: unwanted_pkgs -{% endfor %} + {% endfor %} +{% endif %}