Skip to content

Commit

Permalink
support for systemd in kitchen
Browse files Browse the repository at this point in the history
  • Loading branch information
noelmcloughlin committed Mar 14, 2018
1 parent 4816786 commit 7579f5f
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 9 deletions.
9 changes: 9 additions & 0 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion packages/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ packages:
pkgs: []
snaps:
package: snapd
collides: ['snap',]
collides: []
symlink: False
service: ['snapd.service', 'snapd.socket',]
wanted: []
unwanted: []
Expand Down
4 changes: 3 additions & 1 deletion packages/osmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ Fedora:
- gcc
- python2-pip
- python2-devel

snaps:
collides: ['snap',]
symlink: True
30 changes: 23 additions & 7 deletions packages/snaps.sls
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -30,19 +32,32 @@ 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 }}
- enable: true
- 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 }}
Expand All @@ -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 }}
Expand All @@ -64,5 +79,6 @@ packages-snapd-{{ snap }}-unwanted:
- require:
- pkg: pkg_req_pkgs
- pkg: unwanted_pkgs
{% endfor %}
{% endfor %}
{% endif %}

0 comments on commit 7579f5f

Please sign in to comment.