瀏覽代碼

feat(formula/group): enable the use of members in group.present

pull/204/head
mm-irvingleonard 5 年之前
父節點
當前提交
29de7bb19b
共有 1 個檔案被更改,包括 10 行新增8 行删除
  1. +10
    -8
      linux/system/group.sls

+ 10
- 8
linux/system/group.sls 查看文件

@@ -11,13 +11,6 @@

{%- if group.enabled %}

{%- set requires = [] %}
{%- for user in group.get('addusers', []) %}
{%- if user in system.get('user', {}).keys() %}
{%- do requires.append({'user': 'system_user_'+user}) %}
{%- endif %}
{%- endfor %}

system_group_{{ group_name }}:
group.present:
- name: {{ group.get('name', group_name) }}
@@ -27,10 +20,19 @@ system_group_{{ group_name }}:
{%- if group.gid is defined and group.gid %}
- gid: {{ group.gid }}
{%- endif %}
{%- if group.members is defined %}
- members: {{ group.members|json }}
{%- else %}
{%- set requires = [] %}
{%- for user in group.get('addusers', []) %}
{%- if user in system.get('user', {}).keys() %}
{%- do requires.append({'user': 'system_user_'+user}) %}
{%- endif %}
{%- endfor %}
- require: {{ requires|yaml }}
{{ set_p('addusers', group)|indent(2, True) }}
{{ set_p('delusers', group)|indent(2, True) }}

{% endif %}
{%- else %}

system_group_{{ group_name }}:

Loading…
取消
儲存