From f8ae0d85d95194f0a6acfb1cb77e7214d88e6e0a Mon Sep 17 00:00:00 2001 From: Theo Chatzimichos Date: Nov 19 2017 19:30:23 +0000 Subject: Merge branch 'cboltz-ignore_missing' into 'production' pillar: replace include_optional macro with ignore_missing See merge request infra/salt!103 --- diff --git a/pillar/macros.jinja b/pillar/macros.jinja index 75fe364..a824781 100644 --- a/pillar/macros.jinja +++ b/pillar/macros.jinja @@ -1,11 +1,3 @@ -{%- macro include_optional(sls_file) %} - {%- for root in opts['pillar_roots'][saltenv] -%} - {%- if salt['file.file_exists']('{0}/{1}/init.sls'.format(root, sls_file)) or salt['file.file_exists']('{0}/{1}.sls'.format(root, sls_file)) %} - - {{ sls_file }} - {% endif %} - {%- endfor %} -{%- endmacro %} - {%- macro valid_virt_cluster() -%} {%- import_yaml "valid_custom_grains.yaml" as valid_custom_grains -%} {%- set valid_virt_cluster = [] -%} diff --git a/pillar/top.sls b/pillar/top.sls index eab9795..2680eda 100644 --- a/pillar/top.sls +++ b/pillar/top.sls @@ -1,4 +1,3 @@ -{% from "macros.jinja" import include_optional with context %} {% from "macros.jinja" import valid_virt_cluster with context %} {% set country = salt['grains.get']('country') %} {% set domain = salt['grains.get']('domain') %} @@ -16,7 +15,8 @@ production: {% for role in roles %} 'roles:{{ role }}': - match: grain - {{ include_optional("role/{0}".format(role)) }} + - ignore_missing: True + - role.{{ role }} {% endfor %} {% if virt_cluster in valid_virt_cluster() %} 'virt_cluster:{{ virt_cluster }}':