mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix timezone and locale tests on photon
This commit is contained in:
parent
78e06fdb42
commit
718654ae21
2 changed files with 14 additions and 2 deletions
|
@ -1,13 +1,26 @@
|
|||
import subprocess
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.support.case import ModuleCase
|
||||
|
||||
|
||||
def _check_systemctl():
|
||||
if not hasattr(_check_systemctl, "memo"):
|
||||
proc = subprocess.run(["localectl"], 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
|
||||
)
|
||||
return _check_systemctl.memo
|
||||
|
||||
|
||||
@pytest.mark.skip_on_windows(reason="minion is windows")
|
||||
@pytest.mark.skip_on_darwin(reason="locale method is not supported on mac")
|
||||
@pytest.mark.skip_on_freebsd(
|
||||
reason="locale method is supported only within login classes or environment variables"
|
||||
)
|
||||
@pytest.mark.skipif(_check_systemctl(), reason="localectl degraded")
|
||||
@pytest.mark.requires_salt_modules("locale")
|
||||
@pytest.mark.windows_whitelisted
|
||||
class LocaleModuleTest(ModuleCase):
|
||||
|
|
|
@ -20,12 +20,11 @@ except ImportError:
|
|||
|
||||
def _check_systemctl():
|
||||
if not hasattr(_check_systemctl, "memo"):
|
||||
proc = subprocess.run(["systemctl"], capture_output=True, check=False)
|
||||
proc = subprocess.run(["timedatectl"], 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
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue