Skip to content

Commit aaedb00

Browse files
fix(coupling): allow docker install without compose (#298)
* fix(compose): avoid rendering errors if not using compose * fix(init): only install what is 'wanted'
1 parent 299a1d0 commit aaedb00

3 files changed

Lines changed: 22 additions & 13 deletions

File tree

docker/compose/software/binary/clean.sls

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{%- set tplroot = tpldir.split('/')[0] %}
55
{%- from tplroot ~ "/map.jinja" import data as d with context %}
66
7-
{%- if grains.kernel|lower in ('linux',) %}
7+
{%- if grains.kernel|lower in ('linux',) and 'path' in d.pkg.compose %}
88
{%- set sls_alternatives_clean = tplroot ~ '.software.alternatives.clean' %}
99
1010
include:
@@ -16,9 +16,11 @@ docker-compose-archive-absent:
1616
- {{ d.dir.tmp }}/docker-compose
1717
- {{ d.pkg.compose.path }}
1818
{%- if d.linux.altpriority|int == 0 or grains.os_family in ('Arch', 'MacOS') %}
19-
{%- for cmd in d.pkg.compose.commands|unique %}
19+
{%- if 'commands' in d.pkg.compose %}
20+
{%- for cmd in d.pkg.compose.commands|unique %}
2021
- /usr/local/bin/{{ cmd }}
21-
{%- endfor %}
22+
{%- endfor %}
23+
{%- endif %}
2224
{%- endif %}
2325
2426
{%- endif %}

docker/compose/software/binary/install.sls

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
77
{%- if grains.kernel|lower in ('linux',) %}
88
{%- from tplroot ~ "/files/macros.jinja" import format_kwargs with context %}
9-
{%- if d.pkg.compose.use_upstream == 'binary' and 'binary' in d.pkg.compose %}
9+
{%- set composer = d.pkg.compose %}
10+
{%- if composer.use_upstream == 'binary' and 'binary' in composer and 'path' in composer %}
1011
1112
docker-compose-software-binary-install:
1213
{%- if 'deps' in d.pkg and d.pkg.deps %}
@@ -26,12 +27,12 @@ docker-compose-software-binary-install:
2627
- file: docker-compose-software-binary-install
2728
{%- endif %}
2829
file.managed:
29-
- unless: test -x {{ d.pkg.compose.path }}/docker-compose
30-
- name: {{ d.pkg.compose.path }}/docker-compose
31-
- source: {{ d.pkg.compose.binary.source }}
30+
- unless: test -x {{ composer.path }}/docker-compose
31+
- name: {{ composer.path }}/docker-compose
32+
- source: {{ composer.binary.source }}
3233
- clean: {{ d.misc.clean }}
33-
{%- if 'source_hash' in d.pkg.compose.binary and d.pkg.compose.binary.source_hash %}
34-
- source_hash: {{ d.pkg.compose.binary.source_hash }}
34+
{%- if 'source_hash' in composer.binary and composer.binary.source_hash %}
35+
- source_hash: {{ composer.binary.source_hash }}
3536
{%- else %}
3637
- skip_verify: True
3738
{%- endif %}
@@ -46,12 +47,12 @@ docker-compose-software-binary-install:
4647
- mode
4748
4849
{%- if d.linux.altpriority|int == 0 or grains.os_family in ('Arch', 'MacOS') %}
49-
{%- for cmd in d.pkg.compose.commands|unique %}
50+
{%- for cmd in composer.commands|unique %}
5051
5152
docker-compose-software-binary-install-symlink-{{ cmd }}:
5253
file.symlink:
5354
- name: /usr/local/bin/{{ cmd }}
54-
- target: {{ d.pkg.compose.path }}/{{ cmd }}
55+
- target: {{ composer.path }}/{{ cmd }}
5556
- force: True
5657
- onchanges:
5758
- file: docker-compose-software-binary-install

docker/init.sls

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
# -*- coding: utf-8 -*-
22
# vim: ft=sls
3+
{%- set tplroot = tpldir.split('/')[0] %}
4+
{%- from tplroot ~ "/map.jinja" import data as d with context %}
5+
6+
{%- if d.wanted is iterable %}
37
48
include:
5-
- .software
6-
- .compose
9+
{{ '- .software' if 'docker' in d.wanted else '' }}
10+
{{ '- .compose' if 'compose' in d.wanted else '' }}
711
# .networks
812
# .containers
13+
14+
{%- endif %}

0 commit comments

Comments
 (0)