From d61e671fa0de58fe60c5c0cdc23d55c49b93dd01 Mon Sep 17 00:00:00 2001 From: noelmcloughlin Date: Fri, 11 Sep 2020 22:28:29 +0100 Subject: [PATCH] fix(windows): group arg not supported on windows --- salt/formulas.sls | 2 ++ salt/osfamilymap.yaml | 14 +++++++++----- salt/osmap.yaml | 1 - 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/salt/formulas.sls b/salt/formulas.sls index c8a75f3..c20e1b4 100644 --- a/salt/formulas.sls +++ b/salt/formulas.sls @@ -39,7 +39,9 @@ {'makedirs': True}).items() %} - {{ key }}: {{ value }} - user: {{ salt_settings.rootuser }} + {%- if grains.kernel != 'Windows' %} - group: {{ salt_settings.rootgroup }} + {%- endif %} {%- endfor %} {%- endif %} diff --git a/salt/osfamilymap.yaml b/salt/osfamilymap.yaml index 1a530d8..5dc1a9f 100644 --- a/salt/osfamilymap.yaml +++ b/salt/osfamilymap.yaml @@ -15,11 +15,14 @@ {%- set suse_testing_repo = ':/products:/next:/testing' if [osfamily_lower, osrelease] == ['suse', '15.2'] else '' %} #from template-formula -{%- if grains.os == 'MacOS' %} -{%- set macos_rootuser = salt['cmd.run']("stat -f '%Su' /dev/console") %} -{%- set macos_rootgroup = salt['cmd.run']("stat -f '%Sg' /dev/console") %} +{%- if grains.os_family == 'MacOS' %} +{%- set rootuser = salt['cmd.run']("stat -f '%Su' /dev/console") %} +{%- set rootgroup = salt['cmd.run']("stat -f '%Sg' /dev/console") %} +{%- elif grains.os_family == 'Windows' %} +{%- set rootuser = salt['cmd.run']("id -un") %} {%- endif %} + Debian: pkgrepo: 'deb http://repo.saltstack.com/{{ py_ver_repr or 'apt' }}/{{ osfamily_lower }}/{{ osmajorrelease }}/amd64/{{ salt_release }} {{ oscodename }} main' key_url: 'https://repo.saltstack.com/{{ py_ver_repr or 'apt' }}/{{ osfamily_lower }}/{{ osmajorrelease }}/amd64/{{ salt_release }}/SALTSTACK-GPG-KEY.pub' @@ -130,6 +133,7 @@ Windows: salt_minion: salt-minion{{ '-' ~ py_ver_repr if py_ver_repr else '' }} config_path: 'C:\salt\conf' minion_service: salt-minion + rootuser: {{ rootuser | d('') }} MacOS: salt_minion: salt @@ -138,5 +142,5 @@ MacOS: config_path: /private/etc/salt minion_service: com.saltstack.salt.minion ## from template-formula - rootuser: {{ macos_rootuser | d('') }} - rootgroup: {{ macos_rootgroup | d('') }} + rootuser: {{ rootuser | d('') }} + rootgroup: {{ rootgroup | d('') }} diff --git a/salt/osmap.yaml b/salt/osmap.yaml index 383355d..bd8ba2c 100644 --- a/salt/osmap.yaml +++ b/salt/osmap.yaml @@ -63,5 +63,4 @@ MacOS: salt_minion_macos_plist_hash: 26b33da12e0d8960ee96b488c8352002c22a377c19bf3df3f986a1e49eca8b20 Windows: - rootgroup: Users parallel: false # not supported on windows/cygwin