removed startup service

This commit is contained in:
Blake J. Harnden 2018-06-20 13:07:43 -07:00
parent 3443937ff2
commit ed4e6f0f00
2 changed files with 2 additions and 50 deletions

View file

@ -214,10 +214,6 @@ class CoreServices(object):
# dict of tuple of service objects, key is node number
self.customservices = {}
# TODO: remove need for cyclic import
from core.services import startup
self.is_startup_service = startup.Startup.is_startup_service
def reset(self):
"""
Called when config message with reset flag is received
@ -418,7 +414,6 @@ class CoreServices(object):
results = []
services = sorted(node.services, key=lambda x: x.startindex)
use_startup_service = any(map(self.is_startup_service, services))
for service in services:
if len(str(service.starttime)) > 0:
try:
@ -429,7 +424,7 @@ class CoreServices(object):
continue
except ValueError:
logger.exception("error converting start time to float")
result = pool.apply_async(self.bootnodeservice, (node, service, services, use_startup_service))
result = pool.apply_async(self.bootnodeservice, (node, service, services))
results.append(result)
pool.close()
@ -437,7 +432,7 @@ class CoreServices(object):
for result in results:
result.get()
def bootnodeservice(self, node, service, services, use_startup_service):
def bootnodeservice(self, node, service, services):
"""
Start a service on a node. Create private dirs, generate config
files, and execute startup commands.
@ -445,7 +440,6 @@ class CoreServices(object):
:param core.netns.vnode.LxcNode node: node to boot services on
:param CoreService service: service to start
:param list services: service list
:param bool use_startup_service: flag to use startup services or not
:return: nothing
"""
logger.info("starting node(%s) service: %s (%s)", node.name, service.name, service.startindex)
@ -457,10 +451,6 @@ class CoreServices(object):
# create service files
self.node_service_files(node, service, services)
# check for startup service
if use_startup_service and not self.is_startup_service(service):
return
# run startup
wait = service.validation_mode == ServiceMode.BLOCKING
status = self.node_service_startup(node, service, services, wait)

View file

@ -1,38 +0,0 @@
from inspect import isclass
from sys import maxint
from core.service import CoreService
class Startup(CoreService):
"""
A CORE service to start other services in order, serially
"""
name = 'startup'
group = 'Utility'
depends = ()
dirs = ()
configs = ('startup.sh',)
startindex = maxint
startup = ('sh startup.sh',)
shutdown = ()
validate = ()
@staticmethod
def is_startup_service(s):
return isinstance(s, Startup) or (isclass(s) and issubclass(s, Startup))
@classmethod
def generateconfig(cls, node, filename, services):
if filename != cls.configs[0]:
return ''
script = '#!/bin/sh\n' \
'# auto-generated by Startup (startup.py)\n\n' \
'exec > startup.log 2>&1\n\n'
for s in sorted(services, key=lambda x: x.startindex):
if cls.is_startup_service(s) or len(str(s.starttime)) > 0:
continue
start = '\n'.join(s.getstartup(node, services))
if start:
script += start + '\n'
return script