summaryrefslogtreecommitdiff
path: root/app-admin/salt/files/salt-3007.10-tests-without-systemd.patch
blob: 9fa7938b659a7da204ace5f835c023c6143907cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
diff --git a/tests/integration/modules/test_localemod.py b/tests/integration/modules/test_localemod.py
index 5a59e84e49..680bceb698 100644
--- a/tests/integration/modules/test_localemod.py
+++ b/tests/integration/modules/test_localemod.py
@@ -11,8 +11,11 @@ def _check_systemctl():
         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
+            try:
+                proc = subprocess.run(["localectl"], capture_output=True, check=False)
+                _check_systemctl.memo = b"No such file or directory" in proc.stderr
+            except FileNotFoundError:
+                _check_systemctl.memo = False
     return _check_systemctl.memo
 
 
diff --git a/tests/integration/modules/test_timezone.py b/tests/integration/modules/test_timezone.py
index c9894c6108..e4c37e8716 100644
--- a/tests/integration/modules/test_timezone.py
+++ b/tests/integration/modules/test_timezone.py
@@ -24,8 +24,11 @@ def _check_systemctl():
         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
+            try:
+                proc = subprocess.run(["timedatectl"], capture_output=True, check=False)
+                _check_systemctl.memo = b"No such file or directory" in proc.stderr
+            except FileNotFoundError:
+                _check_systemctl.memo = False
     return _check_systemctl.memo
 
 
diff --git a/tests/pytests/functional/modules/test_service.py b/tests/pytests/functional/modules/test_service.py
index 8384c9c5b2..3f66e0de63 100644
--- a/tests/pytests/functional/modules/test_service.py
+++ b/tests/pytests/functional/modules/test_service.py
@@ -20,11 +20,14 @@ def _check_systemctl():
         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
-            )
+            try:
+                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
+                )
+            except FileNotFoundError:
+                _check_systemctl.memo = False
     return _check_systemctl.memo
 
 
diff --git a/tests/pytests/functional/modules/test_system.py b/tests/pytests/functional/modules/test_system.py
index 8ffb048fd5..8c165d9dae 100644
--- a/tests/pytests/functional/modules/test_system.py
+++ b/tests/pytests/functional/modules/test_system.py
@@ -25,13 +25,16 @@ def check_hostnamectl():
         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
-                or b"Failed to query system properties" in proc.stderr
-            )
+            try:
+                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
+                    or b"Failed to query system properties" in proc.stderr
+                )
+            except FileNotFoundError:
+                check_hostnamectl.memo = False
     return check_hostnamectl.memo
 
 
diff --git a/tests/pytests/functional/states/test_service.py b/tests/pytests/functional/states/test_service.py
index 671d56893d..2fd4e37fcf 100644
--- a/tests/pytests/functional/states/test_service.py
+++ b/tests/pytests/functional/states/test_service.py
@@ -28,12 +28,15 @@ def _check_systemctl():
         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
-            )
+            try:
+                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
+                )
+            except FileNotFoundError:
+                _check_systemctl.memo = False
     return _check_systemctl.memo
 
 
diff --git a/tests/pytests/unit/states/test_service.py b/tests/pytests/unit/states/test_service.py
index 04cdd9b059..1d82de78e2 100644
--- a/tests/pytests/unit/states/test_service.py
+++ b/tests/pytests/unit/states/test_service.py
@@ -22,12 +22,15 @@ def _check_systemctl():
         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
-            )
+            try:
+                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
+                )
+            except FileNotFoundError:
+                _check_systemctl.memo = False
     return _check_systemctl.memo