We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cb46ffa commit 603ce09Copy full SHA for 603ce09
testinfra/modules/service.py
@@ -176,7 +176,10 @@ def _has_systemd_suffix(self):
176
177
@property
178
def exists(self):
179
- cmd = self.run_test('systemctl list-unit-files | grep -q"^%s"', self.name)
+ # list-unit-files: Older systemd versions only show native unit files
180
+ # list-units: List all units that Systemd currently has in memory,
181
+ # this includes generated units like SysV files also
182
+ cmd = self.run_test(r'systemctl list-units --all | grep -q "^[[:space:]]*%s"', self.name)
183
return cmd.rc == 0
184
185
0 commit comments