From 1dadda3fd6adc7d1cc426b389e69103a658cdb22 Mon Sep 17 00:00:00 2001 From: Theo Chatzimichos Date: Feb 09 2017 17:58:40 +0000 Subject: unhardcode the /etc/zypp/zypp.conf values add support for /etc/zypp/zypper.conf as well --- diff --git a/pillar/common.sls b/pillar/common.sls index 23ccfa0..edad313 100644 --- a/pillar/common.sls +++ b/pillar/common.sls @@ -127,3 +127,7 @@ sudoers: users: nagios: - 'ALL=(ALL) NOPASSWD: /usr/sbin/zypp-refresh,/usr/bin/zypper ref,/usr/bin/zypper sl,/usr/bin/zypper --xmlout --non-interactive list-updates -t package -t patch' +zypper: + zypp_conf: + main: + solver.onlyRequires: 'true' diff --git a/salt/profile/zypper/config.sls b/salt/profile/zypper/config.sls index 80582b9..457ce84 100644 --- a/salt/profile/zypper/config.sls +++ b/salt/profile/zypper/config.sls @@ -1,6 +1,26 @@ -# TODO: unhardcode, move to pillars +{% set zypp_conf = salt['pillar.get']('zypper:zypp_conf', {}) %} +{% set zypper_conf = salt['pillar.get']('zypper:zypper_conf', {}) %} + +{% if zypp_conf %} /etc/zypp/zypp.conf: ini.options_present: - sections: - main: - solver.onlyRequires: 'true' + {% for section, data in zypp_conf.iteritems() %} + {{ section }}: + {% for config, value in data.iteritems() %} + {{ config }}: {{ value }} + {% endfor %} + {% endfor %} +{% endif %} + +{% if zypper_conf %} +/etc/zypp/zypper.conf: + ini.options_present: + - sections: + {% for section, data in zypper_conf.iteritems() %} + {{ section }}: + {% for config, value in data.iteritems() %} + {{ config }}: {{ value }} + {% endfor %} + {% endfor %} +{% endif %}