fix(chocolatey): verify chocolatey dicts are not empty

This commit is contained in:
kartnico 2019-09-15 12:57:12 +02:00 committed by Imran Iqbal
parent c0c1195242
commit 385b2238f4
No known key found for this signature in database
GPG key ID: 6D8629439D2B7819

View file

@ -2,6 +2,7 @@
# vim: ft=sls # vim: ft=sls
{% from "packages/map.jinja" import packages with context %} {% from "packages/map.jinja" import packages with context %}
{% if packages.chocolatey %}
{% set req_states = packages.chocolatey.required.states %} {% set req_states = packages.chocolatey.required.states %}
{% set req_pkgs = packages.chocolatey.required.pkgs %} {% set req_pkgs = packages.chocolatey.required.pkgs %}
{% set wanted_chocolatey = packages.chocolatey.wanted %} {% set wanted_chocolatey = packages.chocolatey.wanted %}
@ -20,6 +21,7 @@ chocolatey_req_pkgs:
- retry: {{ packages.retry_options|json }} - retry: {{ packages.retry_options|json }}
### CHOCOLATEY PACKAGES to install ### CHOCOLATEY PACKAGES to install
{% if wanted_chocolatey %}
{% for choco, settings in wanted_chocolatey.items() %} {% for choco, settings in wanted_chocolatey.items() %}
{{ choco }}: {{ choco }}:
chocolatey.installed: chocolatey.installed:
@ -34,10 +36,14 @@ chocolatey_req_pkgs:
- package_args: {{ '' if 'package_args' not in settings else settings.package_args }} - package_args: {{ '' if 'package_args' not in settings else settings.package_args }}
- allow_multiple: {{ False if 'allow_multiple' not in settings else settings.allow_multiple }} - allow_multiple: {{ False if 'allow_multiple' not in settings else settings.allow_multiple }}
{% endfor %} {% endfor %}
{% endif %}
### CHOCOLATEY PACKAGES to uninstall ### CHOCOLATEY PACKAGES to uninstall
{% if unwanted_chocolatey %}
{% for uchoco in unwanted_chocolatey %} {% for uchoco in unwanted_chocolatey %}
{{ uchoco }}: {{ uchoco }}:
chocolatey.uninstalled: chocolatey.uninstalled:
- name: {{ uchoco }} - name: {{ uchoco }}
{% endfor %} {% endfor %}
{% endif %}
{% endif %}