mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
fixes for MacOS X 13
This commit is contained in:
parent
4f790e3945
commit
6640b05216
2 changed files with 8 additions and 7 deletions
|
@ -143,7 +143,7 @@ def _get_service(name):
|
|||
# so we need to raise that the service could not be found.
|
||||
try:
|
||||
if not __context__["using_cached_services"]:
|
||||
raise CommandExecutionError("Service not found: {}".format(name))
|
||||
raise CommandExecutionError(f"Service not found: {name}")
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
|
@ -151,7 +151,7 @@ def _get_service(name):
|
|||
# state then there is no reason to check again.
|
||||
# fixes https://github.com/saltstack/salt/issues/57907
|
||||
if __context__.get("service.state") == "dead":
|
||||
raise CommandExecutionError("Service not found: {}".format(name))
|
||||
raise CommandExecutionError(f"Service not found: {name}")
|
||||
|
||||
# we used a cached version to check, a service could have been made
|
||||
# between now and then, we should refresh our available services.
|
||||
|
@ -162,7 +162,7 @@ def _get_service(name):
|
|||
|
||||
if not service:
|
||||
# Could not find the service after refresh raise.
|
||||
raise CommandExecutionError("Service not found: {}".format(name))
|
||||
raise CommandExecutionError(f"Service not found: {name}")
|
||||
|
||||
# found it :)
|
||||
return service
|
||||
|
@ -240,7 +240,7 @@ def _get_domain_target(name, service_target=False):
|
|||
if "LaunchAgents" in path:
|
||||
# Get the console user so we can service in the correct session
|
||||
uid = __utils__["mac_utils.console_user"]()
|
||||
domain_target = "gui/{}".format(uid)
|
||||
domain_target = f"gui/{uid}"
|
||||
|
||||
# check to see if we need to make it a full service target.
|
||||
if service_target is True:
|
||||
|
@ -638,7 +638,8 @@ def disabled(name, runas=None, domain="system"):
|
|||
if name != srv_name:
|
||||
pass
|
||||
else:
|
||||
return True if "true" in status.lower() else False
|
||||
matches = ["true", "disabled"]
|
||||
return True if any([x in status.lower() for x in matches]) else False
|
||||
|
||||
return False
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ from salt.exceptions import CommandExecutionError
|
|||
from tests.support.case import ModuleCase
|
||||
|
||||
# Module Variables
|
||||
ASSIGN_CMD = "net.inet.icmp.icmplim"
|
||||
ASSIGN_CMD = "net.inet.icmp.timestamp"
|
||||
CONFIG = "/etc/sysctl.conf"
|
||||
|
||||
|
||||
|
@ -74,7 +74,7 @@ class DarwinSysctlModuleTest(ModuleCase):
|
|||
os.remove(CONFIG)
|
||||
try:
|
||||
self.run_function("sysctl.persist", [ASSIGN_CMD, 10])
|
||||
line = "{}={}".format(ASSIGN_CMD, 10)
|
||||
line = f"{ASSIGN_CMD}={10}"
|
||||
found = self.__check_string(CONFIG, line)
|
||||
self.assertTrue(found)
|
||||
except CommandExecutionError:
|
||||
|
|
Loading…
Add table
Reference in a new issue