-# f14 is a bit odd in this respect, although this worked fine in guests up to f18
-# however using a vplc guest under f20 requires this trick
-# the symptom is this: service plc start
-# Starting plc (via systemctl): Failed to get D-Bus connection: \
-# Failed to connect to socket /org/freedesktop/systemd1/private: Connection refused
-# weird thing is the doc says f14 uses upstart by default and not systemd
-# so this sounds kind of harmless
- def start_service (self,service): return self.start_stop_service (service,'start')
- def stop_service (self,service): return self.start_stop_service (service,'stop')
-
- def start_stop_service (self, service,start_or_stop):
- "utility to start/stop a service with the special trick for f14"
- if self.options.fcdistro != 'f14':
- return self.run_in_guest ("service %s %s"%(service,start_or_stop))==0
- else:
- # patch /sbin/service so it does not reset environment
- self.run_in_guest ('sed -i -e \\"s,env -i,env,\\" /sbin/service')
- # this is because our own scripts in turn call service
- return self.run_in_guest("SYSTEMCTL_SKIP_REDIRECT=true service %s %s"%(service,start_or_stop))==0
+ # care only about f>=27
+ def start_stop_systemd(self, service, start_or_stop):
+ "utility to start/stop a systemd-defined service (sfa)"
+ return self.run_in_guest("systemctl {} {}".format(start_or_stop, service)) == 0