@@ -169,7 +169,7 @@ class SystemdService(SysvService):
169169
170170 def _has_systemd_suffix (self ):
171171 """
172- Check if service name has a known systemd unit suffix
172+ Check if the service name has a known systemd unit suffix
173173 """
174174 unit_suffix = self .name .split ("." )[- 1 ]
175175 return unit_suffix in self .suffix_list
@@ -182,7 +182,7 @@ def exists(self):
182182 # 2: unused
183183 # 3: unit is not active
184184 # 4: no such unit
185- cmd = self .run_expect ([0 , 1 , 3 , 4 ], "systemctl status %s" , self .name )
185+ cmd = self .run_expect ([0 , 1 , 3 , 4 ], "systemctl status -- %s" , self .name )
186186 return cmd .rc < 4
187187
188188 @property
@@ -192,15 +192,15 @@ def is_running(self):
192192 # 1: program is dead and pid file exists
193193 # 3: not running and pid file does not exists
194194 # 4: Unable to determine status (no such unit)
195- out = self .run_expect ([0 , 1 , 3 , 4 ], "systemctl is-active %s" , self .name )
195+ out = self .run_expect ([0 , 1 , 3 , 4 ], "systemctl is-active -- %s" , self .name )
196196 if out .rc == 1 :
197197 # Failed to connect to bus: No such file or directory
198198 return super ().is_running
199199 return out .rc == 0
200200
201201 @property
202202 def is_enabled (self ):
203- cmd = self .run_test ("systemctl is-enabled %s" , self .name )
203+ cmd = self .run_test ("systemctl is-enabled -- %s" , self .name )
204204 if cmd .rc == 0 :
205205 return True
206206 if cmd .stdout .strip () == "disabled" :
@@ -217,7 +217,7 @@ def is_enabled(self):
217217 def is_valid (self ):
218218 # systemd-analyze requires a full unit name.
219219 name = self .name if self ._has_systemd_suffix () else f"{ self .name } .service"
220- cmd = self .run ("systemd-analyze verify %s" , name )
220+ cmd = self .run ("systemd-analyze verify -- %s" , name )
221221 # A bad unit file still returns a rc of 0, so check the
222222 # stdout for anything. Nothing means no warns/errors.
223223 # Docs at https://www.freedesktop.org/software/systemd/man/systemd
@@ -240,16 +240,17 @@ def is_valid(self):
240240 ]
241241
242242 stderr = "" .join (stderr_lines )
243- return (cmd .stdout , stderr ) == ("" , "" )
243+ return (cmd .stdout , stderr )
244+ # return (cmd.stdout, stderr) == ("", "")
244245
245246 @property
246247 def is_masked (self ):
247- cmd = self .run_test ("systemctl is-enabled %s" , self .name )
248+ cmd = self .run_test ("systemctl is-enabled -- %s" , self .name )
248249 return cmd .stdout .strip () == "masked"
249250
250251 @functools .cached_property
251252 def systemd_properties (self ):
252- out = self .check_output ("systemctl show %s" , self .name )
253+ out = self .check_output ("systemctl show -- %s" , self .name )
253254 out_d = {}
254255 if out :
255256 # maxsplit is required because values can contain `=`
0 commit comments