Do not fail on checking user/group in test mode

This commit is contained in:
Victor Zhestkov 2022-08-17 09:46:46 +03:00 committed by Megan Wilhite
parent 8c591700ce
commit 84e90b20bf

View file

@ -379,6 +379,11 @@ def _check_user(user, group):
gid = __salt__["file.group_to_gid"](group)
if gid == "":
err += "Group {} is not available".format(group)
if err and __opts__["test"]:
# Write the warning with error message, but prevent failing,
# in case of applying the state in test mode.
log.warning(err)
return ""
return err