added service executable check, added error message to gui for service load errors

This commit is contained in:
Blake J. Harnden 2018-06-19 09:19:49 -07:00
parent e80736061f
commit bf47e5fc0d
10 changed files with 90 additions and 39 deletions

View file

@ -4,7 +4,6 @@ Sample user-defined service.
from core.misc.ipaddress import Ipv4Prefix
from core.service import CoreService
from core.service import ServiceManager
class MyService(CoreService):
@ -12,22 +11,22 @@ class MyService(CoreService):
This is a sample user-defined service.
"""
# a unique name is required, without spaces
_name = "MyService"
name = "MyService"
# you can create your own group here
_group = "Utility"
group = "Utility"
# list of other services this service depends on
_depends = ()
depends = ()
# per-node directories
_dirs = ()
dirs = ()
# generated files (without a full path this file goes in the node's dir,
# e.g. /tmp/pycore.12345/n1.conf/)
_configs = ('myservice.sh',)
configs = ('myservice.sh',)
# this controls the starting order vs other enabled services
_startindex = 50
startindex = 50
# list of startup commands, also may be generated during startup
_startup = ('sh myservice.sh',)
startup = ('sh myservice.sh',)
# list of shutdown commands
_shutdown = ()
shutdown = ()
@classmethod
def generateconfig(cls, node, filename, services):
@ -57,9 +56,3 @@ class MyService(CoreService):
else:
net = Ipv4Prefix(x)
return 'echo " network %s"' % net
# this is needed to load desired services when being integrated into core, otherwise this is not needed
def load_services():
# this line is required to add the above class to the list of available services
ServiceManager.add(MyService)