This commit is contained in:
Daniel A. Wozniak 2025-01-07 23:53:12 -07:00 committed by Daniel Wozniak
parent 6f7b448591
commit 78e06fdb42
2 changed files with 7 additions and 0 deletions

View file

@ -5,6 +5,7 @@ Module for managing locales on POSIX-like systems.
import logging
import os
import re
import subprocess
import salt.utils.locales
import salt.utils.path
@ -67,6 +68,10 @@ def _localectl_status():
"""
if salt.utils.path.which("localectl") is None:
raise CommandExecutionError('Unable to find "localectl"')
else:
proc = subprocess.run(["localectl"], check=False, capture_output=True)
if b"Failed to connect to bus: No such file or directory" in proc.stderr:
raise CommandExecutionError('Command "localectl" is in a degraded state.')
ret = {}
locale_ctl_out = (__salt__["cmd.run"]("localectl status") or "").strip()

View file

@ -23,7 +23,9 @@ def _check_systemctl():
proc = subprocess.run(["systemctl"], capture_output=True, check=False)
_check_systemctl.memo = (
b"Failed to get D-Bus connection: No such file or directory" in proc.stderr
or b"Failed to connect to bus: No such file or directory" in proc.stderr
)
print(repr(proc.stderr))
return _check_systemctl.memo