forked from ungleich-public/cdist
case-based exceptions only on OS's where we know they are needed
always use -g instead of --gid when passing arg to groupmod
This commit is contained in:
parent
acb4644f1e
commit
1f8693a722
2 changed files with 15 additions and 14 deletions
|
@ -22,11 +22,12 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
name=$__object_id
|
name=$__object_id
|
||||||
os="$($__explorer/os)"
|
os_version="$($__explorer/os_version)"
|
||||||
|
|
||||||
case "$os" in
|
case "$os_version" in
|
||||||
centos|fedora|redhat)
|
"Red Hat Enterprise Linux Server release "[45]*|"CentOS release "[45]*)
|
||||||
grep "^${name}:" /etc/gshadow || true
|
# TODO: find a way to get this information
|
||||||
|
echo "$os_version does not have getent gshadow"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
getent gshadow "$name" || true
|
getent gshadow "$name" || true
|
||||||
|
|
|
@ -23,31 +23,31 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
name="$__object_id"
|
name="$__object_id"
|
||||||
os="$(cat "$__global/explorer/os")"
|
os_version="$(cat "$__global/explorer/os_version")"
|
||||||
|
|
||||||
cd "$__object/parameter"
|
cd "$__object/parameter"
|
||||||
if grep -q "^${name}:" "$__object/explorer/group"; then
|
if grep -q "^${name}:" "$__object/explorer/group"; then
|
||||||
for property in $(ls .); do
|
for property in $(ls .); do
|
||||||
new_value="$(cat "$property")"
|
new_value="$(cat "$property")"
|
||||||
# argument to pass the groupmod command for this property (os-specific
|
# argument to pass the groupmod command for this property (exceptions
|
||||||
# exceptions are listed in the case statement below)
|
# are made in the case statement below)
|
||||||
proparg="--$property"
|
proparg="--$property"
|
||||||
|
|
||||||
case "$property" in
|
case "$property" in
|
||||||
password)
|
password)
|
||||||
current_value="$(awk -F: '{ print $2 }' < "$__object/explorer/gshadow")"
|
current_value="$(awk -F: '{ print $2 }' < "$__object/explorer/gshadow")"
|
||||||
case "$os" in
|
case "$os_version" in
|
||||||
centos|fedora|redhat)
|
"Red Hat Enterprise Linux Server release "[45]*|"CentOS release "[45]*)
|
||||||
echo "group/$name: $os groupmod does not support password modification" >&2
|
# TODO: Use gpasswd? Need to fix gshadow explorer first.
|
||||||
continue
|
echo "group/$name: '$os_version' groupmod does not support password modification" >&2
|
||||||
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
gid)
|
gid)
|
||||||
|
# set to -g to support older redhat/centos
|
||||||
|
proparg="-g"
|
||||||
current_value="$(awk -F: '{ print $3 }' < "$__object/explorer/group")"
|
current_value="$(awk -F: '{ print $3 }' < "$__object/explorer/group")"
|
||||||
case "$os" in
|
|
||||||
centos|fedora|redhat) proparg="-g" ;;
|
|
||||||
esac
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue