Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions tests/integration/modules/test_localemod.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@

import pytest

import salt.utils.platform
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"No such file or directory" in proc.stderr
if not salt.utils.platform.is_linux():
_check_systemctl.memo = False
else:
proc = subprocess.run(["localectl"], capture_output=True, check=False)
_check_systemctl.memo = b"No such file or directory" in proc.stderr
return _check_systemctl.memo


Expand Down
8 changes: 6 additions & 2 deletions tests/integration/modules/test_timezone.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import pytest

import salt.utils.platform
from tests.support.case import ModuleCase

try:
Expand All @@ -20,8 +21,11 @@

def _check_systemctl():
if not hasattr(_check_systemctl, "memo"):
proc = subprocess.run(["timedatectl"], capture_output=True, check=False)
_check_systemctl.memo = b"No such file or directory" in proc.stderr
if not salt.utils.platform.is_linux():
_check_systemctl.memo = False
else:
proc = subprocess.run(["timedatectl"], capture_output=True, check=False)
_check_systemctl.memo = b"No such file or directory" in proc.stderr
return _check_systemctl.memo


Expand Down
12 changes: 8 additions & 4 deletions tests/pytests/functional/modules/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@

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
)
if not salt.utils.platform.is_linux():
_check_systemctl.memo = False
else:
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
)
return _check_systemctl.memo


Expand Down
15 changes: 9 additions & 6 deletions tests/pytests/functional/modules/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@

def check_hostnamectl():
if not hasattr(check_hostnamectl, "memo"):
proc = subprocess.run(["hostnamectl"], capture_output=True, check=False)
check_hostnamectl.memo = (
b"Failed to connect to bus: No such file or directory" in proc.stderr
or b"Failed to create bus connection: No such file or directory"
in proc.stderr
)
if not salt.utils.platform.is_linux():
check_hostnamectl.memo = False
else:
proc = subprocess.run(["hostnamectl"], capture_output=True, check=False)
check_hostnamectl.memo = (
b"Failed to connect to bus: No such file or directory" in proc.stderr
or b"Failed to create bus connection: No such file or directory"
in proc.stderr
)
return check_hostnamectl.memo


Expand Down
14 changes: 9 additions & 5 deletions tests/pytests/functional/states/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@

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
or b"Failed to connect to bus: No such file or directory" in proc.stderr
)
if not salt.utils.platform.is_linux():
_check_systemctl.memo = False
else:
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
)
return _check_systemctl.memo


Expand Down
14 changes: 9 additions & 5 deletions tests/pytests/unit/states/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@

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
or b"Failed to connect to bus: No such file or directory" in proc.stderr
)
if not salt.utils.platform.is_linux():
_check_systemctl.memo = False
else:
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
)
return _check_systemctl.memo


Expand Down
Loading