Skip to content

Commit

Permalink
test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dwoz committed Jan 8, 2025
1 parent 2cb9d84 commit 4fad8a8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions salt/modules/localemod.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import logging
import os
import re
import subprocess

import salt.utils.locales
import salt.utils.path
Expand Down Expand Up @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/modules/test_timezone.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
def _check_systemctl():
if not hasattr(_check_systemctl, "memo"):
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
)
_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


Expand Down

0 comments on commit 4fad8a8

Please sign in to comment.