瀏覽代碼

Add possibility to remove user's git config keys

master
Damien Tardy-Panis 8 年之前
父節點
當前提交
8e33bb8aa9
共有 2 個文件被更改,包括 18 次插入1 次删除
  1. +4
    -0
      pillar.example
  2. +14
    -1
      users/init.sls

+ 4
- 0
pillar.example 查看文件

@@ -115,6 +115,10 @@ users:
user.email: buser@example.com
"url.https://.insteadOf": "git://"

gitconfig.absent:
- push.default
- color\..+

google_2fa: True
google_auth:
ssh: |

+ 14
- 1
users/init.sls 查看文件

@@ -491,8 +491,9 @@ users_googleauth-{{ svc }}-{{ name }}:
# - require_in:
# - sls: users
#
{% if 'gitconfig' in user %}
{% if salt['cmd.has_exec']('git') %}

{% if 'gitconfig' in user %}
{% for key, value in user['gitconfig'].items() %}
users_{{ name }}_user_gitconfig_{{ loop.index0 }}:
{% if grains['saltversioninfo'] >= [2015, 8, 0, 0] %}
@@ -510,6 +511,18 @@ users_{{ name }}_user_gitconfig_{{ loop.index0 }}:
{% endif %}
{% endfor %}
{% endif %}

{% if 'gitconfig.absent' in user and grains['saltversioninfo'] >= [2015, 8, 0, 0] %}
{% for key in user.get('gitconfig.absent') %}
users_{{ name }}_user_gitconfig_absent_{{ key }}:
git.config_unset:
- name: '{{ key }}'
- user: {{ name }}
- global: True
- all: True
{% endfor %}
{% endif %}

{% endif %}

{% endfor %}

Loading…
取消
儲存