Skip to content

Commit

Permalink
salt: add a no-op if there is nothing to do in Solutions sls
Browse files Browse the repository at this point in the history
Adding of salt no-op to avoid having an empty sls file
after rendering, otherwise it returns an exit code of 2
when using --retcode-passthrough, thus breaking the
calling script.

Refs: #2277
  • Loading branch information
alexandre-allard committed Mar 5, 2020
1 parent 2b72ad2 commit ac115f9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions salt/metalk8s/solutions/available.sls
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,20 @@
{{ machine_name }},{{ display_name }},{{ mount_path }}
{%- endmacro %}
{%- set available = pillar.metalk8s.solutions.available | d({}) %}
{%- set configured = pillar.metalk8s.solutions.config.archives | d([]) %}
{%- if '_errors' in pillar.metalk8s.solutions.config %}
Cannot proceed with mounting of Solution archives:
test.fail_without_changes:
- comment: "Errors: {{ pillar.metalk8s.solutions.config._errors | join('; ') }}"
{%- elif not available and not configured %}
No Solution found in configuration:
test.succeed_without_changes
{%- else %}
{#- Mount configured #}
{%- set configured = pillar.metalk8s.solutions.config.archives %}
{%- for archive_path in configured %}
{%- set solution = salt['metalk8s.archive_info_from_iso'](archive_path) %}
{%- set machine_name = solution.name | replace(' ', '-') | lower %}
Expand Down Expand Up @@ -76,7 +82,6 @@ Expose container images for Solution {{ display_name }}:
{#- Unmount all Solution ISOs mounted in /srv/scality not referenced in
the configuration file #}
{%- set available = pillar.metalk8s.solutions.available %}
{%- for machine_name, versions in available.items() %}
{%- for info in versions %}
{%- if info.archive not in configured %}
Expand All @@ -94,7 +99,6 @@ Remove container images for Solution {{ display_name }}:
Unmount Solution {{ display_name }}:
mount.unmounted:
- name: {{ info.mountpoint }}
- device: {{ info.archive }}
- persist: True
- require:
- file: Remove container images for Solution {{ display_name }}
Expand Down

0 comments on commit ac115f9

Please sign in to comment.