We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cb46ffa commit a7fcca2Copy full SHA for a7fcca2
testinfra/modules/service.py
@@ -176,7 +176,12 @@ 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(
183
+ r'systemctl list-units --all | grep -q "^[[:space:]]*%s"', self.name
184
+ )
185
return cmd.rc == 0
186
187
0 commit comments