from jadi import interface
[docs]class Service():
"""
Basic class to store service informations.
"""
def __init__(self, manager):
self.id = None
self.name = None
self.manager = manager
self.state = None
self.running = None
[docs]class ServiceOperationError(Exception):
"""
Exception class for services.
"""
def __init__(self, inner):
self.inner = inner
def __unicode__(self):
return '[ServiceOperationError %s]' % self.inner
[docs]@interface
class ServiceManager():
"""
Abstract interface for all managers.
"""
id = None
name = None
[docs] def list(self):
raise NotImplementedError
[docs] def get_service(self, _id):
raise NotImplementedError
[docs] def start(self, _id):
raise NotImplementedError
[docs] def stop(self, _id):
raise NotImplementedError
[docs] def restart(self, _id):
raise NotImplementedError