0
0
mirror of https://github.com/saltstack-formulas/users-formula.git synced 2024-11-27 22:38:34 +01:00

Replace periods in username with underscores.

Fixes #118
This commit is contained in:
Vincent Schumaker 2016-06-22 10:11:42 -04:00 committed by Vincent Schumaker
parent 95e61e1abe
commit 954b735f5c

View File

@ -337,11 +337,12 @@ users_ssh_known_hosts_delete_{{ name }}_{{ loop.index0 }}:
{% endfor %}
{% endif %}
{% if 'sudouser' in user and user['sudouser'] %}
{% set sudoers_d_filename = name|replace('.','_') %}
{% if 'sudouser' in user and user['sudouser']|string() == "True" %}
users_sudoer-{{ name }}:
file.managed:
- name: {{ users.sudoers_dir }}/{{ name }}
- name: {{ users.sudoers_dir }}/{{ sudoers_d_filename }}
- user: root
- group: {{ users.root_group }}
- mode: '0440'
@ -358,7 +359,7 @@ users_sudoer-{{ name }}:
# Specify the rule via an env var to avoid shell quoting issues.
- rule: "{{ name }} {{ rule }}"
- require_in:
- file: users_{{ users.sudoers_dir }}/{{ name }}
- file: users_{{ users.sudoers_dir }}/{{ sudoers_d_filename }}
{% endfor %}
{% endif %}
{% if 'sudo_defaults' in user %}
@ -372,14 +373,14 @@ users_sudoer-{{ name }}:
# Specify the rule via an env var to avoid shell quoting issues.
- rule: "Defaults:{{ name }} {{ entry }}"
- require_in:
- file: users_{{ users.sudoers_dir }}/{{ name }}
- file: users_{{ users.sudoers_dir }}/{{ sudoers_d_filename }}
{% endfor %}
{% endif %}
#%#}
users_{{ users.sudoers_dir }}/{{ name }}:
users_{{ users.sudoers_dir }}/{{ sudoers_d_filename }}:
file.managed:
- name: {{ users.sudoers_dir }}/{{ name }}
- name: {{ users.sudoers_dir }}/{{ sudoers_d_filename }}
- contents: |
{%- if 'sudo_defaults' in user %}
{%- for entry in user['sudo_defaults'] %}
@ -399,15 +400,16 @@ 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 }}
cmd.wait:
- name: visudo -cf {{ users.sudoers_dir }}/{{ sudoers_d_filename }} || ( rm -rvf {{ users.sudoers_dir }}/{{ sudoers_d_filename }}; exit 1 )
- watch:
- file: {{ users.sudoers_dir }}/{{ sudoers_d_filename }}
{% endif %}
{% else %}
users_{{ users.sudoers_dir }}/{{ name }}:
users_{{ users.sudoers_dir }}/{{ sudoers_d_filename }}:
file.absent:
- name: {{ users.sudoers_dir }}/{{ name }}
- name: {{ users.sudoers_dir }}/{{ sudoers_d_filename }}
{% endif %}
{%- if 'google_auth' in user %}