From 819d73a5969d8316805f963f6331141c96015188 Mon Sep 17 00:00:00 2001 From: Serg Kand Date: Sun, 20 Sep 2015 16:21:34 +0300 Subject: [PATCH] changing visudo checking to avoid wrong reporting when launched with test=true --- users/init.sls | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/users/init.sls b/users/init.sls index a1915a0..da04f01 100644 --- a/users/init.sls +++ b/users/init.sls @@ -325,6 +325,7 @@ users_sudoer-{{ name }}: - group: {{ users.root_group }} - mode: '0440' {% if 'sudo_rules' in user or 'sudo_defaults' in user %} +#{#% {% if 'sudo_rules' in user %} {% for rule in user['sudo_rules'] %} "validate {{ name }} sudo rule {{ loop.index0 }} {{ name }} {{ rule }}": @@ -353,6 +354,7 @@ users_sudoer-{{ name }}: - file: users_{{ users.sudoers_dir }}/{{ name }} {% endfor %} {% endif %} +#%#} users_{{ users.sudoers_dir }}/{{ name }}: file.managed: @@ -371,6 +373,10 @@ users_{{ users.sudoers_dir }}/{{ name }}: - require: - file: users_sudoer-defaults - file: users_sudoer-{{ name }} + cmd.wait: + - name: visudo -cf {{ users.sudoers_dir }}/{{ name }} || ( rm -rvf {{ users.sudoers_dir }}/{{ name }}; exit 1 ) + - watch: + - file: {{ users.sudoers_dir }}/{{ name }} {% endif %} {% else %} users_{{ users.sudoers_dir }}/{{ name }}: