Skip to content

Commit

Permalink
Implement feedback in t_u module
Browse files Browse the repository at this point in the history
  • Loading branch information
m-czernek committed Apr 18, 2024
1 parent 3c06882 commit c0e081e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions salt/modules/transactional_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -989,8 +989,8 @@ def call(function, *args, **kwargs):
return local
finally:
# Check if reboot is needed
if (activate_transaction and pending_transaction()) or _user_specified_reboot(
local
if (activate_transaction and pending_transaction()) or (
not kwargs.get("test", False) and _user_specified_reboot(local)
):
reboot()

Expand All @@ -1000,13 +1000,13 @@ def _user_specified_reboot(local):
# Skip if execution is not state/highstate
return False

explicit_reboot_cmds = ["reboot", "init 6", "shutdown -r", "shutdown --reboot"]
names = []
explicit_reboot_cmds = set(["reboot", "system.reboot"])
names = set()
for _, value in local.items():
if isinstance(value, dict) and "name" in value:
names.append(value["name"])
# Partial match reboot_cmds to names, so that e.g. "reboot" matches "system.reboot"
return any([cmd in name for cmd in explicit_reboot_cmds for name in names])
names.add(value["name"])

return bool(explicit_reboot_cmds.intersection(names))


def apply_(mods=None, **kwargs):
Expand Down

0 comments on commit c0e081e

Please sign in to comment.