示例#1
0
 def try_restart(self,mode):
     """Try restart unit.
     
     @param mode: Must be one of "fail" or "replace.
     
     @raise SystemdError: Raised when mode is invalid.
     
     @rtype: L{systemd.job.Job}
     """
     try:
         job_path = self.__interface.TryRestart(mode)
         job = Job.if_exists(job_path)
         return job
     except dbus.exceptions.DBusException, error:
         raise SystemdError(error)
示例#2
0
 def reload_or_restart(self, mode):
     """Reload or restart unit.
     
     @param mode: Must be one of fail, replace or isolate.
     
     @raise SystemdError: Raised when mode is invalid.
     
     @rtype: systemd.job.Job
     """
     try:
         job_path = self.__interface.ReloadOrRestart(mode)
         job = Job.if_exists(job_path)
         return job
     except dbus.exceptions.DBusException, error:
         raise SystemdError(error)
示例#3
0
 def get_job(self, ID):
     """Get job by it ID.
     
     @param ID: Job ID.
     
     @raise SystemdError: Raised when no job is found with the given ID.
     
     @rtype: systemd.job.Job
     """
     try:
         job_path = self.__interface.GetJob(ID)
         job = Job.if_exists(job_path)
         return job
     except dbus.exceptions.DBusException, error:
         raise SystemdError(error)
示例#4
0
 def stop(self, mode):
     """Stop unit.
     
     @param mode:  Must be one of fail or replace.
     
     @raise SystemdError: Raised when mode is invalid.
     
     @rtype: systemd.job.Job
     """
     try:
         job_path = self.__interface.Stop(mode)
         job = Job.if_exists(job_path)
         return job
     except dbus.exceptions.DBusException, error:
         raise SystemdError(error)
示例#5
0
 def get_job(self, ID):
     """Get job by it ID.
     
     @param ID: Job ID.
     
     @raise SystemdError: Raised when no job is found with the given ID.
     
     @rtype: systemd.job.Job
     """
     try:
         job_path = self.__interface.GetJob(ID)
         job = Job.if_exists(job_path)
         return job
     except dbus.exceptions.DBusException, error:
         raise SystemdError(error)
示例#6
0
 def stop_unit(self, name, mode):
     """Stop unit.
     
     @param name: Unit name (ie: network.service).
     @param mode:  Must be one of fail or replace.
     
     @raise SystemdError: Raised when no unit is found with the given name.
     
     @rtype: L{systemd.job.Job}
     """
     try:
         job_path = self.__interface.StopUnit(name, mode)
         job = Job.if_exists(job_path)
         return job
     except dbus.exceptions.DBusException, error:
         raise SystemdError(error)
示例#7
0
 def reload_or_try_restart_unit(self, name, mode):
     """Reload or try restart unit.
     
     @param name: Unit name (ie: network.service).
     @param mode: Must be one of fail, replace or isolate.
     
     @raise SystemdError: Raised when no unit is found with the given name.
     
     @rtype: L{systemd.job.Job}
     """
     try:
         job_path = self.__interface.ReloadOrTryRestartUnit(name, mode)
         job = Job.if_exists(job_path)
         return job
     except dbus.exceptions.DBusException, error:
         raise SystemdError(error)
示例#8
0
 def stop_unit(self, name, mode):
     """Stop unit.
     
     @param name: Unit name (ie: network.service).
     @param mode:  Must be one of fail or replace.
     
     @raise SystemdError: Raised when no unit is found with the given name.
     
     @rtype: L{systemd.job.Job}
     """
     try:
         job_path = self.__interface.StopUnit(name, mode)
         job = Job.if_exists(job_path)
         return job
     except dbus.exceptions.DBusException, error:
         raise SystemdError(error)
示例#9
0
 def reload_or_try_restart_unit(self, name, mode):
     """Reload or try restart unit.
     
     @param name: Unit name (ie: network.service).
     @param mode: Must be one of fail, replace or isolate.
     
     @raise SystemdError: Raised when no unit is found with the given name.
     
     @rtype: L{systemd.job.Job}
     """
     try:
         job_path = self.__interface.ReloadOrTryRestartUnit(name, mode)
         job = Job.if_exists(job_path)
         return job
     except dbus.exceptions.DBusException, error:
         raise SystemdError(error)
示例#10
0
 def try_restart_unit(self, name, mode):
     """Try restart unit.
     
     @param name: Unit name (ie: network.service).
     @param mode: Must be one of "fail" or "replace.
     
     @raise SystemdError: Raised when no unit is found with the given name or
     mode is invalid.
     
     @rtype: L{systemd.job.Job}
     """
     try:
         job_path = self.__interface.TryRestartUnit(name, mode)
         job = Job.if_exists(job_path)
         return job
     except dbus.exceptions.DBusException, error:
         raise SystemdError(error)
示例#11
0
 def start_unit_replace(self, old_unit, new_unit, mode):
     """Start unit replace.
     
     @param old_unit: Old unit.
     @param new_unit: New unit.
     @param mode: Must be one of fail, replace, isolate, rescue or emergency.
     
     @raise SystemdError: Raised when no unit is found with the given name.
     
     @rtype: L{systemd.job.Job}
     """
     try:
         job_path = self.__interface.StartUnitReplace(old_unit, new_unit, mode)
         job = Job.if_exists(job_path)
         return job
     except dbus.exceptions.DBusException, error:
         raise SystemdError(error)
示例#12
0
 def try_restart_unit(self, name, mode):
     """Try restart unit.
     
     @param name: Unit name (ie: network.service).
     @param mode: Must be one of "fail" or "replace.
     
     @raise SystemdError: Raised when no unit is found with the given name or
     mode is invalid.
     
     @rtype: L{systemd.job.Job}
     """
     try:
         job_path = self.__interface.TryRestartUnit(name, mode)
         job = Job.if_exists(job_path)
         return job
     except dbus.exceptions.DBusException, error:
         raise SystemdError(error)
示例#13
0
 def start_unit_replace(self, old_unit, new_unit, mode):
     """Start unit replace.
     
     @param old_unit: Old unit.
     @param new_unit: New unit.
     @param mode: Must be one of fail, replace, isolate, rescue or emergency.
     
     @raise SystemdError: Raised when no unit is found with the given name.
     
     @rtype: L{systemd.job.Job}
     """
     try:
         job_path = self.__interface.StartUnitReplace(
             old_unit, new_unit, mode)
         job = Job.if_exists(job_path)
         return job
     except dbus.exceptions.DBusException, error:
         raise SystemdError(error)