Skip to content

Commit

Permalink
fix(compose-ng.sls): fix salt-lint errors
Browse files Browse the repository at this point in the history
```bash
Examining docker/compose-ng.sls of type state
[206] Jinja variables should have spaces before and after: {{ var_name }}
docker/compose-ng.sls:13
{{id}}:

[206] Jinja variables should have spaces before and after: {{ var_name }}
docker/compose-ng.sls:17
{{id}} image:

[206] Jinja variables should have spaces before and after: {{ var_name }}
docker/compose-ng.sls:22
    - name: {{image[0]}}

[206] Jinja variables should have spaces before and after: {{ var_name }}
docker/compose-ng.sls:23
    - tag: {{image[1]}}

[206] Jinja variables should have spaces before and after: {{ var_name }}
docker/compose-ng.sls:25
    - name: {{container.image}}

[206] Jinja variables should have spaces before and after: {{ var_name }}
docker/compose-ng.sls:28
{{id}} container:

[206] Jinja variables should have spaces before and after: {{ var_name }}
docker/compose-ng.sls:40
    - name: {{id}}

[206] Jinja variables should have spaces before and after: {{ var_name }}
docker/compose-ng.sls:41
    - image: {{container.image}}

[206] Jinja variables should have spaces before and after: {{ var_name }}
docker/compose-ng.sls:43
    - command: {{container.command}}

[206] Jinja variables should have spaces before and after: {{ var_name }}
docker/compose-ng.sls:48
        - {{variable}}: {{value}}

[206] Jinja variables should have spaces before and after: {{ var_name }}
docker/compose-ng.sls:57
      - "{{mapping[0]}}"

[206] Jinja variables should have spaces before and after: {{ var_name }}
docker/compose-ng.sls:59
      - "{{mapping[-1]}}/tcp":

[206] Jinja variables should have spaces before and after: {{ var_name }}
docker/compose-ng.sls:60
            HostPort: "{{mapping[-2]}}"

[206] Jinja variables should have spaces before and after: {{ var_name }}
docker/compose-ng.sls:61
            HostIp: "{{mapping[-3]|d('')}}"

[206] Jinja variables should have spaces before and after: {{ var_name }}
docker/compose-ng.sls:64
      - {{port_mapping}}

[206] Jinja variables should have spaces before and after: {{ var_name }}
docker/compose-ng.sls:71
      - {{volume}}

[206] Jinja variables should have spaces before and after: {{ var_name }}
docker/compose-ng.sls:78
      - {{volume}}

[206] Jinja variables should have spaces before and after: {{ var_name }}
docker/compose-ng.sls:86
        {{name}}: {{alias}}

[206] Jinja variables should have spaces before and after: {{ var_name }}
docker/compose-ng.sls:92
        Name: {{policy[0]}}

[206] Jinja variables should have spaces before and after: {{ var_name }}
docker/compose-ng.sls:94
        MaximumRetryCount: {{policy[1]}}

[206] Jinja variables should have spaces before and after: {{ var_name }}
docker/compose-ng.sls:99
      - docker_image: {{id}}

[206] Jinja variables should have spaces before and after: {{ var_name }}
docker/compose-ng.sls:101
      - docker: {{id}} image

[206] Jinja variables should have spaces before and after: {{ var_name }}
docker/compose-ng.sls:106
      - docker_image: {{containerid}}

[206] Jinja variables should have spaces before and after: {{ var_name }}
docker/compose-ng.sls:108
      - docker: {{containerid}}
```
  • Loading branch information
myii committed Oct 16, 2019
1 parent ea6be11 commit 9e8e1e8
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions docker/compose-ng.sls
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ include:
{%- set id = container.container_name|d(name) %}
{%- set required_containers = [] %}
{%- if grains['saltversioninfo'] >= [2017, 7, 0] %}
{{id}}:
{{ id }}:
docker_image.present:
- force: {{ docker.containers.force_present }}
{%- else %}
{{id}} image:
{{ id }} image:
docker.pulled:
{%- endif %}
{%- if ':' in container.image %}
{%- set image = container.image.split(':',1) %}
- name: {{image[0]}}
- tag: {{image[1]}}
- name: {{ image[0] }}
- tag: {{ image[1] }}
{%- else %}
- name: {{container.image}}
- name: {{ container.image }}
{%- endif %}
{{id}} container:
{{ id }} container:
{%- if grains['saltversioninfo'] >= [2017, 7, 0] %}
docker_container.running:
- skip_translate: {{ docker.containers.skip_translate }}
Expand All @@ -37,15 +37,15 @@ include:
docker.running:
{%- endif %}
{%- endif %}
- name: {{id}}
- image: {{container.image}}
- name: {{ id }}
- image: {{ container.image }}
{%- if 'command' in container %}
- command: {{container.command}}
- command: {{ container.command }}
{%- endif %}
{%- if 'environment' in container and container.environment is iterable %}
- environment:
{%- for variable, value in container.environment.items() %}
- {{variable}}: {{value}}
- {{ variable }}: {{ value }}
{%- endfor %}
{%- endif %}
{%- if 'ports' in container and container.ports is iterable %}
Expand All @@ -54,58 +54,58 @@ include:
{%- if port_mapping is string %}
{%- set mapping = port_mapping.split(':',2) %}
{%- if mapping|length < 2 %}
- "{{mapping[0]}}"
- "{{ mapping[0] }}"
{%- else %}
- "{{mapping[-1]}}/tcp":
HostPort: "{{mapping[-2]}}"
HostIp: "{{mapping[-3]|d('')}}"
- "{{ mapping[-1] }}/tcp":
HostPort: "{{ mapping[-2] }}"
HostIp: "{{ mapping[-3]|d('') }}"
{%- endif %}
{%- elif port_mapping is mapping %}
- {{port_mapping}}
- {{ port_mapping }}
{%- endif %}
{%- endfor %}
{%- endif %}
{%- if 'volumes' in container %}
- volumes:
{%- for volume in container.volumes %}
- {{volume}}
- {{ volume }}
{%- endfor %}
{%- endif %}
{%- if 'volumes_from' in container %}
- volumes_from:
{%- for volume in container.volumes_from %}
{%- do required_containers.append(volume) %}
- {{volume}}
- {{ volume }}
{%- endfor %}
{%- endif %}
{%- if 'links' in container %}
- links:
{%- for link in container.links %}
{%- set name, alias = link.split(':',1) %}
{%- do required_containers.append(name) %}
{{name}}: {{alias}}
{{ name }}: {{ alias }}
{%- endfor %}
{%- endif %}
{%- if 'restart' in container %}
- restart_policy:
{%- set policy = container.restart.split(':',1) %}
Name: {{policy[0]}}
Name: {{ policy[0] }}
{%- if policy|length > 1 %}
MaximumRetryCount: {{policy[1]}}
MaximumRetryCount: {{ policy[1] }}
{%- endif %}
{%- endif %}
- require:
{%- if grains['saltversioninfo'] >= [2017, 7, 0] %}
- docker_image: {{id}}
- docker_image: {{ id }}
{%- else %}
- docker: {{id}} image
- docker: {{ id }} image
{%- endif %}
{%- if required_containers is defined %}
{%- for containerid in required_containers %}
{%- if grains['saltversioninfo'] >= [2017, 7, 0] %}
- docker_image: {{containerid}}
- docker_image: {{ containerid }}
{%- else %}
- docker: {{containerid}}
- docker: {{ containerid }}
{%- endif %}
{%- endfor %}
{%- endif %}
Expand Down

0 comments on commit 9e8e1e8

Please sign in to comment.