2017-06-20 02:09:28 +01:00
|
|
|
"""
|
|
|
|
Definition of CoreService class that is subclassed to define
|
2013-08-29 15:21:13 +01:00
|
|
|
startup services and routing for nodes. A service is typically a daemon
|
2017-06-20 02:09:28 +01:00
|
|
|
program launched when a node starts that provides some sort of service.
|
|
|
|
The CoreServices class handles configuration messages for sending
|
2013-08-29 15:21:13 +01:00
|
|
|
a list of available services to the GUI and for configuring individual
|
|
|
|
services.
|
2017-06-20 02:09:28 +01:00
|
|
|
"""
|
|
|
|
|
2018-06-20 20:59:07 +01:00
|
|
|
import time
|
|
|
|
from multiprocessing.pool import ThreadPool
|
|
|
|
|
|
|
|
import enum
|
2018-06-19 17:19:49 +01:00
|
|
|
from core.constants import which
|
|
|
|
|
2018-03-03 00:22:20 +00:00
|
|
|
from core import CoreCommandError
|
2017-08-07 19:58:51 +01:00
|
|
|
from core import logger
|
2017-08-03 22:27:39 +01:00
|
|
|
from core.data import FileData
|
2017-06-20 02:09:28 +01:00
|
|
|
from core.enumerations import MessageFlags
|
|
|
|
from core.enumerations import RegisterTlvs
|
|
|
|
from core.misc import utils
|
|
|
|
|
|
|
|
|
2018-06-20 20:59:07 +01:00
|
|
|
class ServiceBootError(Exception):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class ServiceMode(enum.Enum):
|
|
|
|
BLOCKING = 0
|
|
|
|
NON_BLOCKING = 1
|
|
|
|
TIMER = 2
|
|
|
|
|
|
|
|
|
2018-06-15 22:03:27 +01:00
|
|
|
class ServiceShim(object):
|
|
|
|
keys = ["dirs", "files", "startidx", "cmdup", "cmddown", "cmdval", "meta", "starttime"]
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def tovaluelist(cls, service, node, services):
|
|
|
|
"""
|
|
|
|
Convert service properties into a string list of key=value pairs,
|
|
|
|
separated by "|".
|
|
|
|
|
|
|
|
:param CoreService service: service to get value list for
|
|
|
|
:param core.netns.nodes.CoreNode node: node to get value list for
|
|
|
|
:param list[CoreService] services: services for node
|
|
|
|
:return: value list string
|
|
|
|
:rtype: str
|
|
|
|
"""
|
|
|
|
valmap = [service.dirs, service.configs, service.startindex, service.startup,
|
|
|
|
service.shutdown, service.validate, service.meta, service.starttime]
|
|
|
|
if not service.custom:
|
|
|
|
# this is always reached due to classmethod
|
|
|
|
valmap[valmap.index(service.configs)] = service.getconfigfilenames(node.objid, services)
|
|
|
|
valmap[valmap.index(service.startup)] = service.getstartup(node, services)
|
|
|
|
vals = map(lambda a, b: "%s=%s" % (a, str(b)), cls.keys, valmap)
|
|
|
|
return "|".join(vals)
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def fromvaluelist(cls, service, values):
|
|
|
|
"""
|
|
|
|
Convert list of values into properties for this instantiated
|
|
|
|
(customized) service.
|
|
|
|
|
|
|
|
:param CoreService service: service to get value list for
|
|
|
|
:param dict values: value list to set properties from
|
|
|
|
:return: nothing
|
|
|
|
"""
|
|
|
|
# TODO: support empty value? e.g. override default meta with ''
|
|
|
|
for key in cls.keys:
|
|
|
|
try:
|
|
|
|
cls.setvalue(service, key, values[cls.keys.index(key)])
|
|
|
|
except IndexError:
|
|
|
|
# old config does not need to have new keys
|
|
|
|
logger.exception("error indexing into key")
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def setvalue(cls, service, key, value):
|
|
|
|
"""
|
|
|
|
Set values for this service.
|
|
|
|
|
|
|
|
:param CoreService service: service to get value list for
|
|
|
|
:param str key: key to set value for
|
|
|
|
:param value: value of key to set
|
|
|
|
:return: nothing
|
|
|
|
"""
|
|
|
|
if key not in cls.keys:
|
|
|
|
raise ValueError('key `%s` not in `%s`' % (key, cls.keys))
|
|
|
|
# this handles data conversion to int, string, and tuples
|
|
|
|
if value:
|
|
|
|
if key == "startidx":
|
|
|
|
value = int(value)
|
|
|
|
elif key == "meta":
|
|
|
|
value = str(value)
|
|
|
|
else:
|
|
|
|
value = utils.make_tuple_fromstr(value, str)
|
|
|
|
|
|
|
|
if key == "dirs":
|
|
|
|
service.dirs = value
|
|
|
|
elif key == "files":
|
|
|
|
service.configs = value
|
|
|
|
elif key == "startidx":
|
|
|
|
service.startindex = value
|
|
|
|
elif key == "cmdup":
|
|
|
|
service.startup = value
|
|
|
|
elif key == "cmddown":
|
|
|
|
service.shutdown = value
|
|
|
|
elif key == "cmdval":
|
|
|
|
service.validate = value
|
|
|
|
elif key == "meta":
|
|
|
|
service.meta = value
|
|
|
|
elif key == "starttime":
|
|
|
|
service.starttime = value
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def servicesfromopaque(self, opaque):
|
|
|
|
"""
|
|
|
|
Build a list of services from an opaque data string.
|
|
|
|
|
|
|
|
:param str opaque: opaque data string
|
|
|
|
:return: services
|
|
|
|
:rtype: list
|
|
|
|
"""
|
|
|
|
servicesstring = opaque.split(':')
|
|
|
|
if servicesstring[0] != "service":
|
|
|
|
return []
|
|
|
|
return servicesstring[1].split(',')
|
|
|
|
|
|
|
|
|
2017-06-20 02:09:28 +01:00
|
|
|
class ServiceManager(object):
|
|
|
|
"""
|
|
|
|
Manages services available for CORE nodes to use.
|
|
|
|
"""
|
2018-06-14 20:50:48 +01:00
|
|
|
services = {}
|
2013-08-29 15:21:13 +01:00
|
|
|
|
2017-06-20 02:09:28 +01:00
|
|
|
@classmethod
|
|
|
|
def add(cls, service):
|
|
|
|
"""
|
|
|
|
Add a service to manager.
|
|
|
|
|
|
|
|
:param CoreService service: service to add
|
|
|
|
:return: nothing
|
|
|
|
"""
|
2018-04-27 20:09:31 +01:00
|
|
|
logger.info("loading service: %s", service.__name__)
|
2018-06-15 22:03:27 +01:00
|
|
|
name = service.name
|
2018-06-19 17:19:49 +01:00
|
|
|
|
|
|
|
# avoid duplicate services
|
2018-06-14 20:50:48 +01:00
|
|
|
if name in cls.services:
|
|
|
|
raise ValueError("duplicate service being added: %s" % name)
|
2018-06-19 17:19:49 +01:00
|
|
|
|
|
|
|
# validate dependent executables are present
|
|
|
|
for executable in service.executables:
|
|
|
|
if not which(executable):
|
2018-06-20 21:04:13 +01:00
|
|
|
logger.warn("service(%s) missing executable: %s", service.name, executable)
|
2018-06-19 17:19:49 +01:00
|
|
|
raise ValueError("service(%s) missing executable: %s" % (service.name, executable))
|
|
|
|
|
|
|
|
# make service available
|
2018-06-14 20:50:48 +01:00
|
|
|
cls.services[name] = service
|
2017-06-20 02:09:28 +01:00
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def get(cls, name):
|
|
|
|
"""
|
|
|
|
Retrieve a service from the manager.
|
|
|
|
|
|
|
|
:param str name: name of the service to retrieve
|
|
|
|
:return: service if it exists, None otherwise
|
2018-06-15 22:03:27 +01:00
|
|
|
:rtype: CoreService.class
|
2017-06-20 02:09:28 +01:00
|
|
|
"""
|
2018-06-14 20:50:48 +01:00
|
|
|
return cls.services.get(name)
|
2014-04-30 22:27:41 +01:00
|
|
|
|
2017-08-04 00:33:54 +01:00
|
|
|
@classmethod
|
|
|
|
def add_services(cls, path):
|
|
|
|
"""
|
|
|
|
Method for retrieving all CoreServices from a given path.
|
|
|
|
|
|
|
|
:param str path: path to retrieve services from
|
2018-06-19 17:19:49 +01:00
|
|
|
:return: list of core services that failed to load
|
|
|
|
:rtype: list[str]
|
2017-08-04 00:33:54 +01:00
|
|
|
"""
|
2018-06-19 17:19:49 +01:00
|
|
|
service_errors = []
|
2018-02-05 19:22:01 +00:00
|
|
|
services = utils.load_classes(path, CoreService)
|
|
|
|
for service in services:
|
2018-06-15 22:03:27 +01:00
|
|
|
if not service.name:
|
2018-04-21 05:40:55 +01:00
|
|
|
continue
|
2018-02-05 19:22:01 +00:00
|
|
|
service.on_load()
|
2018-06-19 17:19:49 +01:00
|
|
|
|
|
|
|
try:
|
|
|
|
cls.add(service)
|
|
|
|
except ValueError as e:
|
|
|
|
service_errors.append(service.name)
|
2018-06-20 21:04:13 +01:00
|
|
|
logger.warn("not loading service: %s", e.message)
|
2018-06-19 17:19:49 +01:00
|
|
|
return service_errors
|
2017-08-04 00:33:54 +01:00
|
|
|
|
2017-06-20 02:09:28 +01:00
|
|
|
|
2018-06-06 22:51:45 +01:00
|
|
|
class CoreServices(object):
|
2017-06-20 02:09:28 +01:00
|
|
|
"""
|
|
|
|
Class for interacting with a list of available startup services for
|
|
|
|
nodes. Mostly used to convert a CoreService into a Config API
|
|
|
|
message. This class lives in the Session object and remembers
|
|
|
|
the default services configured for each node type, and any
|
|
|
|
custom service configuration. A CoreService is not a Configurable.
|
|
|
|
"""
|
|
|
|
name = "services"
|
|
|
|
config_type = RegisterTlvs.UTILITY.value
|
2017-02-24 00:20:57 +00:00
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
def __init__(self, session):
|
2017-06-20 02:09:28 +01:00
|
|
|
"""
|
|
|
|
Creates a CoreServices instance.
|
|
|
|
|
|
|
|
:param core.session.Session session: session this manager is tied to
|
|
|
|
"""
|
|
|
|
self.session = session
|
2013-08-29 15:21:13 +01:00
|
|
|
# dict of default services tuples, key is node type
|
|
|
|
self.defaultservices = {}
|
|
|
|
# dict of tuple of service objects, key is node number
|
|
|
|
self.customservices = {}
|
2017-06-20 02:09:28 +01:00
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
def reset(self):
|
2017-06-20 02:09:28 +01:00
|
|
|
"""
|
|
|
|
Called when config message with reset flag is received
|
|
|
|
"""
|
2013-08-29 15:21:13 +01:00
|
|
|
self.defaultservices.clear()
|
|
|
|
self.customservices.clear()
|
2017-06-20 02:09:28 +01:00
|
|
|
|
2018-06-21 00:18:30 +01:00
|
|
|
def node_service_dependencies(self, services):
|
2018-06-20 02:36:53 +01:00
|
|
|
# generate service map and find starting points
|
|
|
|
node_services = {service.name: service for service in services}
|
|
|
|
is_dependency = set()
|
|
|
|
all_services = set()
|
|
|
|
for service in services:
|
|
|
|
all_services.add(service.name)
|
|
|
|
for service_name in service.dependencies:
|
|
|
|
# check service needed is valid
|
|
|
|
if service_name not in node_services:
|
|
|
|
raise ValueError("service(%s) dependency does not exist: %s" % (service.name, service_name))
|
|
|
|
is_dependency.add(service_name)
|
|
|
|
starting_points = all_services - is_dependency
|
|
|
|
|
|
|
|
# cycles means no starting points
|
|
|
|
if not starting_points:
|
|
|
|
raise ValueError("no valid service starting points")
|
|
|
|
|
|
|
|
stack = [iter(starting_points)]
|
|
|
|
|
|
|
|
# information used to traverse dependency graph
|
|
|
|
visited = set()
|
|
|
|
path = []
|
|
|
|
path_set = set()
|
|
|
|
|
|
|
|
# store startup orderings
|
|
|
|
startups = []
|
|
|
|
startup = []
|
|
|
|
|
|
|
|
logger.debug("starting points: %s", starting_points)
|
|
|
|
while stack:
|
|
|
|
for service_name in stack[-1]:
|
|
|
|
service = node_services[service_name]
|
|
|
|
logger.debug("evaluating: %s", service.name)
|
|
|
|
|
|
|
|
# check this is not a cycle
|
|
|
|
if service.name in path_set:
|
|
|
|
raise ValueError("service has a cyclic dependency: %s" % service.name)
|
|
|
|
# check that we have not already visited this node
|
|
|
|
elif service.name not in visited:
|
|
|
|
logger.debug("visiting: %s", service.name)
|
|
|
|
visited.add(service.name)
|
|
|
|
path.append(service.name)
|
|
|
|
path_set.add(service.name)
|
|
|
|
|
|
|
|
# retrieve and set dependencies to the stack
|
|
|
|
stack.append(iter(service.dependencies))
|
|
|
|
startup.append(service)
|
|
|
|
break
|
|
|
|
# for loop completed without a break
|
|
|
|
else:
|
|
|
|
logger.debug("finished a visit: path(%s)", path)
|
|
|
|
if path:
|
|
|
|
path_set.remove(path.pop())
|
|
|
|
|
|
|
|
if not path and startup:
|
|
|
|
startup.reverse()
|
|
|
|
startups.append(startup)
|
|
|
|
startup = []
|
|
|
|
|
|
|
|
stack.pop()
|
|
|
|
|
|
|
|
if visited != all_services:
|
|
|
|
raise ValueError("cycle encountered, services are being skipped")
|
|
|
|
|
|
|
|
return startups
|
|
|
|
|
2017-06-20 02:09:28 +01:00
|
|
|
def getdefaultservices(self, service_type):
|
|
|
|
"""
|
|
|
|
Get the list of default services that should be enabled for a
|
|
|
|
node for the given node type.
|
|
|
|
|
|
|
|
:param service_type: service type to get default services for
|
|
|
|
:return: default services
|
2018-06-15 22:03:27 +01:00
|
|
|
:rtype: list[CoreService]
|
2017-06-20 02:09:28 +01:00
|
|
|
"""
|
|
|
|
logger.debug("getting default services for type: %s", service_type)
|
|
|
|
results = []
|
2018-06-15 22:03:27 +01:00
|
|
|
defaults = self.defaultservices.get(service_type, [])
|
|
|
|
for name in defaults:
|
|
|
|
logger.debug("checking for service with service manager: %s", name)
|
|
|
|
service = ServiceManager.get(name)
|
|
|
|
if not service:
|
|
|
|
logger.warn("default service %s is unknown", name)
|
|
|
|
else:
|
|
|
|
results.append(service)
|
2017-06-20 02:09:28 +01:00
|
|
|
return results
|
|
|
|
|
2018-06-15 22:03:27 +01:00
|
|
|
def getcustomservice(self, node_id, service_name, default_service=False):
|
2017-06-20 02:09:28 +01:00
|
|
|
"""
|
|
|
|
Get any custom service configured for the given node that matches the specified service name.
|
|
|
|
If no custom service is found, return the specified service.
|
|
|
|
|
2018-06-15 22:03:27 +01:00
|
|
|
:param int node_id: object id to get service from
|
|
|
|
:param str service_name: name of service to retrieve
|
|
|
|
:param bool default_service: True to return default service when custom does not exist, False returns None
|
2017-06-20 02:09:28 +01:00
|
|
|
:return: custom service from the node
|
|
|
|
:rtype: CoreService
|
|
|
|
"""
|
2018-06-15 22:03:27 +01:00
|
|
|
node_services = self.customservices.setdefault(node_id, {})
|
|
|
|
default = None
|
|
|
|
if default_service:
|
|
|
|
default = ServiceManager.get(service_name)
|
|
|
|
return node_services.get(service_name, default)
|
2013-08-29 15:21:13 +01:00
|
|
|
|
2018-06-15 22:03:27 +01:00
|
|
|
def setcustomservice(self, node_id, service_name):
|
2017-06-20 02:09:28 +01:00
|
|
|
"""
|
|
|
|
Store service customizations in an instantiated service object
|
|
|
|
using a list of values that came from a config message.
|
|
|
|
|
2018-06-15 22:03:27 +01:00
|
|
|
:param int node_id: object id to set custom service for
|
|
|
|
:param str service_name: name of service to set
|
|
|
|
:return: nothing
|
2017-06-20 02:09:28 +01:00
|
|
|
"""
|
2018-06-15 22:03:27 +01:00
|
|
|
logger.debug("setting custom service(%s) for node: %s", node_id, service_name)
|
|
|
|
service = self.getcustomservice(node_id, service_name)
|
|
|
|
if not service:
|
|
|
|
service_class = ServiceManager.get(service_name)
|
|
|
|
service = service_class()
|
2017-06-20 02:09:28 +01:00
|
|
|
|
2018-06-15 22:03:27 +01:00
|
|
|
# add the custom service to dict
|
|
|
|
node_services = self.customservices.setdefault(node_id, {})
|
|
|
|
node_services[service.name] = service
|
2017-06-20 02:09:28 +01:00
|
|
|
|
2018-06-15 22:03:27 +01:00
|
|
|
def addservicestonode(self, node, node_type, services=None):
|
2017-06-20 02:09:28 +01:00
|
|
|
"""
|
2018-06-15 22:03:27 +01:00
|
|
|
Add services to a node.
|
2017-06-20 02:09:28 +01:00
|
|
|
|
|
|
|
:param core.coreobj.PyCoreNode node: node to add services to
|
2018-06-15 22:03:27 +01:00
|
|
|
:param str node_type: node type to add services to
|
|
|
|
:param list[str] services: services to add to node
|
2017-06-20 02:09:28 +01:00
|
|
|
:return: nothing
|
|
|
|
"""
|
2018-06-15 22:03:27 +01:00
|
|
|
if not services:
|
|
|
|
logger.info("using default services for node(%s) type(%s)", node.name, node_type)
|
|
|
|
services = self.defaultservices.get(node_type, [])
|
|
|
|
|
|
|
|
logger.info("setting services for node(%s): %s", node.name, services)
|
|
|
|
for service_name in services:
|
|
|
|
service = self.getcustomservice(node.objid, service_name, default_service=True)
|
|
|
|
if not service:
|
|
|
|
logger.warn("unknown service(%s) for node(%s)", service_name, node.name)
|
|
|
|
continue
|
|
|
|
logger.info("adding service to node(%s): %s", node.name, service_name)
|
|
|
|
node.addservice(service)
|
2013-08-29 15:21:13 +01:00
|
|
|
|
2018-06-15 22:03:27 +01:00
|
|
|
def getallconfigs(self):
|
2017-06-20 02:09:28 +01:00
|
|
|
"""
|
|
|
|
Return (nodenum, service) tuples for all stored configs. Used when reconnecting to a
|
|
|
|
session or opening XML.
|
|
|
|
|
|
|
|
:param bool use_clsmap: should a class map be used, default to True
|
|
|
|
:return: list of tuples of node ids and services
|
|
|
|
:rtype: list
|
|
|
|
"""
|
|
|
|
configs = []
|
2018-06-15 22:03:27 +01:00
|
|
|
for node_id in self.customservices.iterkeys():
|
|
|
|
for service in self.customservices[node_id].itervalues():
|
|
|
|
configs.append((node_id, service))
|
2017-06-20 02:09:28 +01:00
|
|
|
return configs
|
2013-08-29 15:21:13 +01:00
|
|
|
|
|
|
|
def getallfiles(self, service):
|
2017-06-20 02:09:28 +01:00
|
|
|
"""
|
|
|
|
Return all customized files stored with a service.
|
2013-08-29 15:21:13 +01:00
|
|
|
Used when reconnecting to a session or opening XML.
|
2017-06-20 02:09:28 +01:00
|
|
|
|
|
|
|
:param CoreService service: service to get files for
|
|
|
|
:return:
|
|
|
|
"""
|
|
|
|
files = []
|
|
|
|
|
2018-06-15 22:03:27 +01:00
|
|
|
if not service.custom:
|
2017-06-20 02:09:28 +01:00
|
|
|
return files
|
|
|
|
|
2018-06-15 22:03:27 +01:00
|
|
|
for filename in service.configs:
|
|
|
|
data = service.configtxt.get(filename)
|
2013-08-29 15:21:13 +01:00
|
|
|
if data is None:
|
|
|
|
continue
|
2017-06-20 02:09:28 +01:00
|
|
|
files.append((filename, data))
|
|
|
|
|
|
|
|
return files
|
2013-08-29 15:21:13 +01:00
|
|
|
|
|
|
|
def bootnodeservices(self, node):
|
2017-06-20 02:09:28 +01:00
|
|
|
"""
|
|
|
|
Start all services on a node.
|
|
|
|
|
2018-02-28 00:28:28 +00:00
|
|
|
:param core.netns.vnode.LxcNode node: node to start services on
|
|
|
|
:return: nothing
|
2017-06-20 02:09:28 +01:00
|
|
|
"""
|
2018-06-20 20:59:07 +01:00
|
|
|
pool = ThreadPool()
|
|
|
|
results = []
|
|
|
|
|
2018-06-15 22:03:27 +01:00
|
|
|
services = sorted(node.services, key=lambda x: x.startindex)
|
2018-06-21 19:20:08 +01:00
|
|
|
boot_paths = self.node_service_dependencies(services)
|
|
|
|
for boot_path in boot_paths:
|
|
|
|
result = pool.apply_async(self.boot_node_dependencies, (node, boot_path, services))
|
2018-06-20 20:59:07 +01:00
|
|
|
results.append(result)
|
|
|
|
|
|
|
|
pool.close()
|
|
|
|
pool.join()
|
|
|
|
for result in results:
|
|
|
|
result.get()
|
2017-06-20 02:09:28 +01:00
|
|
|
|
2018-06-21 19:20:08 +01:00
|
|
|
def boot_node_dependencies(self, node, boot_path, all_services):
|
|
|
|
logger.info("booting node service dependencies: %s", boot_path)
|
|
|
|
for service in boot_path:
|
|
|
|
self.bootnodeservice(node, service, all_services)
|
|
|
|
|
2018-06-20 21:07:43 +01:00
|
|
|
def bootnodeservice(self, node, service, services):
|
2017-06-20 02:09:28 +01:00
|
|
|
"""
|
|
|
|
Start a service on a node. Create private dirs, generate config
|
|
|
|
files, and execute startup commands.
|
|
|
|
|
2018-02-28 00:28:28 +00:00
|
|
|
:param core.netns.vnode.LxcNode node: node to boot services on
|
2017-06-20 02:09:28 +01:00
|
|
|
:param CoreService service: service to start
|
|
|
|
:param list services: service list
|
|
|
|
:return: nothing
|
|
|
|
"""
|
2018-06-15 22:03:27 +01:00
|
|
|
logger.info("starting node(%s) service: %s (%s)", node.name, service.name, service.startindex)
|
2018-06-20 20:59:07 +01:00
|
|
|
|
|
|
|
# create service directories
|
2018-06-15 22:03:27 +01:00
|
|
|
for directory in service.dirs:
|
2018-03-05 17:20:49 +00:00
|
|
|
node.privatedir(directory)
|
2017-06-20 02:09:28 +01:00
|
|
|
|
2018-06-20 20:59:07 +01:00
|
|
|
# create service files
|
|
|
|
self.node_service_files(node, service, services)
|
2017-06-20 02:09:28 +01:00
|
|
|
|
2018-06-20 20:59:07 +01:00
|
|
|
# run startup
|
|
|
|
wait = service.validation_mode == ServiceMode.BLOCKING
|
|
|
|
status = self.node_service_startup(node, service, services, wait)
|
|
|
|
if status:
|
|
|
|
raise ServiceBootError("node(%s) service(%s) error during startup" % (node.name, service.name))
|
2017-06-20 02:09:28 +01:00
|
|
|
|
2018-06-20 20:59:07 +01:00
|
|
|
# wait for time if provided, default to a time previously used to provide a small buffer
|
|
|
|
time.sleep(0.125)
|
|
|
|
if service.validation_timer:
|
|
|
|
time.sleep(service.validation_timer)
|
2017-06-20 02:09:28 +01:00
|
|
|
|
2018-06-20 20:59:07 +01:00
|
|
|
# run validation commands, if present and not timer mode
|
|
|
|
if service.validation_mode != ServiceMode.TIMER:
|
|
|
|
status = self.validatenodeservice(node, service, services)
|
|
|
|
if status:
|
|
|
|
raise ServiceBootError("node(%s) service(%s) failed validation" % (node.name, service.name))
|
2017-06-20 02:09:28 +01:00
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
def copyservicefile(self, node, filename, cfg):
|
2017-06-20 02:09:28 +01:00
|
|
|
"""
|
|
|
|
Given a configured service filename and config, determine if the
|
2013-08-29 15:21:13 +01:00
|
|
|
config references an existing file that should be copied.
|
|
|
|
Returns True for local files, False for generated.
|
2017-06-20 02:09:28 +01:00
|
|
|
|
2018-02-28 00:28:28 +00:00
|
|
|
:param core.netns.vnode.LxcNode node: node to copy service for
|
2017-06-20 02:09:28 +01:00
|
|
|
:param str filename: file name for a configured service
|
|
|
|
:param str cfg: configuration string
|
|
|
|
:return: True if successful, False otherwise
|
|
|
|
:rtype: bool
|
|
|
|
"""
|
2013-08-29 15:21:13 +01:00
|
|
|
if cfg[:7] == 'file://':
|
|
|
|
src = cfg[7:]
|
|
|
|
src = src.split('\n')[0]
|
2018-03-02 17:15:52 +00:00
|
|
|
src = utils.expand_corepath(src, node.session, node)
|
2013-08-29 15:21:13 +01:00
|
|
|
# TODO: glob here
|
2017-06-20 02:09:28 +01:00
|
|
|
node.nodefilecopy(filename, src, mode=0644)
|
2013-08-29 15:21:13 +01:00
|
|
|
return True
|
|
|
|
return False
|
|
|
|
|
|
|
|
def validatenodeservices(self, node):
|
2017-06-20 02:09:28 +01:00
|
|
|
"""
|
|
|
|
Run validation commands for all services on a node.
|
|
|
|
|
2018-02-28 00:28:28 +00:00
|
|
|
:param core.netns.vnode.LxcNode node: node to validate services for
|
2017-06-20 02:09:28 +01:00
|
|
|
:return: nothing
|
|
|
|
"""
|
2018-06-20 20:59:07 +01:00
|
|
|
services = sorted(node.services, key=lambda x: x.startindex)
|
2018-06-15 22:03:27 +01:00
|
|
|
for service in services:
|
|
|
|
self.validatenodeservice(node, service, services)
|
2013-08-29 15:21:13 +01:00
|
|
|
|
2017-06-20 02:09:28 +01:00
|
|
|
def validatenodeservice(self, node, service, services):
|
|
|
|
"""
|
|
|
|
Run the validation command(s) for a service.
|
|
|
|
|
2018-02-28 00:28:28 +00:00
|
|
|
:param core.netns.vnode.LxcNode node: node to validate service for
|
2017-06-20 02:09:28 +01:00
|
|
|
:param CoreService service: service to validate
|
|
|
|
:param list services: services for node
|
|
|
|
:return: service validation status
|
|
|
|
:rtype: int
|
|
|
|
"""
|
2018-06-20 20:59:07 +01:00
|
|
|
logger.info("validating node(%s) service(%s): %s", node.name, service.name, service.startindex)
|
|
|
|
cmds = service.validate
|
|
|
|
if not service.custom:
|
|
|
|
cmds = service.getvalidate(node, services)
|
2017-06-20 02:09:28 +01:00
|
|
|
|
|
|
|
status = 0
|
2018-06-20 20:59:07 +01:00
|
|
|
for cmd in cmds:
|
2018-06-21 19:20:08 +01:00
|
|
|
logger.info("validating service(%s) using: %s", service.name, cmd)
|
2018-06-15 22:03:27 +01:00
|
|
|
try:
|
2018-06-20 20:59:07 +01:00
|
|
|
node.check_cmd(cmd)
|
2018-06-21 19:20:08 +01:00
|
|
|
except CoreCommandError as e:
|
|
|
|
logger.exception("node(%s) service(%s) validate command failed", node.name, service.name)
|
2018-06-15 22:03:27 +01:00
|
|
|
status = -1
|
2017-06-20 02:09:28 +01:00
|
|
|
|
2014-03-05 16:28:32 +00:00
|
|
|
return status
|
2017-06-20 02:09:28 +01:00
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
def stopnodeservices(self, node):
|
2017-06-20 02:09:28 +01:00
|
|
|
"""
|
|
|
|
Stop all services on a node.
|
|
|
|
|
|
|
|
:param core.netns.nodes.CoreNode node: node to stop services on
|
|
|
|
:return: nothing
|
|
|
|
"""
|
2018-06-15 22:03:27 +01:00
|
|
|
services = sorted(node.services, key=lambda x: x.startindex)
|
|
|
|
for service in services:
|
|
|
|
self.stopnodeservice(node, service)
|
2017-06-20 02:09:28 +01:00
|
|
|
|
|
|
|
def stopnodeservice(self, node, service):
|
|
|
|
"""
|
|
|
|
Stop a service on a node.
|
|
|
|
|
2018-02-28 00:28:28 +00:00
|
|
|
:param core.netns.vnode.LxcNode node: node to stop a service on
|
2017-06-20 02:09:28 +01:00
|
|
|
:param CoreService service: service to stop
|
|
|
|
:return: status for stopping the services
|
|
|
|
:rtype: str
|
|
|
|
"""
|
2018-06-20 20:59:07 +01:00
|
|
|
status = 0
|
2018-06-15 22:03:27 +01:00
|
|
|
for args in service.shutdown:
|
|
|
|
try:
|
|
|
|
node.check_cmd(args)
|
|
|
|
except CoreCommandError:
|
|
|
|
logger.exception("error running stop command %s", args)
|
2018-06-20 20:59:07 +01:00
|
|
|
status = -1
|
2014-03-05 16:28:32 +00:00
|
|
|
return status
|
2013-08-29 15:21:13 +01:00
|
|
|
|
2018-06-15 22:03:27 +01:00
|
|
|
def getservicefile(self, service_name, node, filename, services):
|
2017-06-20 02:09:28 +01:00
|
|
|
"""
|
|
|
|
Send a File Message when the GUI has requested a service file.
|
2013-08-29 15:21:13 +01:00
|
|
|
The file data is either auto-generated or comes from an existing config.
|
2017-06-20 02:09:28 +01:00
|
|
|
|
2018-06-15 22:03:27 +01:00
|
|
|
:param str service_name: service to get file from
|
2018-02-28 00:28:28 +00:00
|
|
|
:param core.netns.vnode.LxcNode node: node to get service file from
|
2017-06-20 02:09:28 +01:00
|
|
|
:param str filename: file name to retrieve
|
2018-06-15 22:03:27 +01:00
|
|
|
:param list[str] services: list of services associated with node
|
2017-06-20 02:09:28 +01:00
|
|
|
:return: file message for node
|
|
|
|
"""
|
2018-06-15 22:03:27 +01:00
|
|
|
# get service to get file from
|
|
|
|
service = self.getcustomservice(node.objid, service_name, default_service=True)
|
|
|
|
if not service:
|
|
|
|
raise ValueError("invalid service: %s", service_name)
|
|
|
|
|
|
|
|
# get service for node
|
|
|
|
node_services = []
|
|
|
|
for service_name in services:
|
|
|
|
node_service = self.getcustomservice(node.objid, service_name, default_service=True)
|
|
|
|
if not node_service:
|
|
|
|
logger.warn("unknown service: %s", service)
|
|
|
|
continue
|
|
|
|
node_services.append(node_service)
|
|
|
|
|
|
|
|
# retrieve config files for default/custom service
|
|
|
|
if service.custom:
|
|
|
|
config_files = service.configs
|
2013-08-29 15:21:13 +01:00
|
|
|
else:
|
2018-06-15 22:03:27 +01:00
|
|
|
config_files = service.getconfigfilenames(node.objid, node_services)
|
|
|
|
|
|
|
|
if filename not in config_files:
|
|
|
|
raise ValueError("unknown service(%s) config file: %s", service_name, filename)
|
2017-06-20 02:09:28 +01:00
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
# get the file data
|
2018-06-15 22:03:27 +01:00
|
|
|
data = service.configtxt.get(filename)
|
2013-08-29 15:21:13 +01:00
|
|
|
if data is None:
|
2018-06-20 20:59:07 +01:00
|
|
|
data = "%s" % service.generateconfig(node, filename, node_services)
|
2013-08-29 15:21:13 +01:00
|
|
|
else:
|
|
|
|
data = "%s" % data
|
2017-06-20 02:09:28 +01:00
|
|
|
|
2018-06-15 22:03:27 +01:00
|
|
|
filetypestr = "service:%s" % service.name
|
2017-07-11 23:51:56 +01:00
|
|
|
return FileData(
|
|
|
|
message_type=MessageFlags.ADD.value,
|
|
|
|
node=node.objid,
|
|
|
|
name=filename,
|
|
|
|
type=filetypestr,
|
|
|
|
data=data
|
|
|
|
)
|
2017-06-20 02:09:28 +01:00
|
|
|
|
2018-06-15 22:03:27 +01:00
|
|
|
def setservicefile(self, node_id, service_name, filename, data):
|
2017-06-20 02:09:28 +01:00
|
|
|
"""
|
|
|
|
Receive a File Message from the GUI and store the customized file
|
2013-08-29 15:21:13 +01:00
|
|
|
in the service config. The filename must match one from the list of
|
|
|
|
config files in the service.
|
2017-06-20 02:09:28 +01:00
|
|
|
|
2018-06-15 22:03:27 +01:00
|
|
|
:param int node_id: node id to set service file
|
|
|
|
:param str service_name: service name to set file for
|
2017-06-20 02:09:28 +01:00
|
|
|
:param str filename: file name to set
|
|
|
|
:param data: data for file to set
|
|
|
|
:return: nothing
|
|
|
|
"""
|
2018-06-15 22:03:27 +01:00
|
|
|
# attempt to set custom service, if needed
|
|
|
|
self.setcustomservice(node_id, service_name)
|
|
|
|
|
|
|
|
# retrieve custom service
|
2018-06-20 20:59:07 +01:00
|
|
|
service = self.getcustomservice(node_id, service_name)
|
|
|
|
if service is None:
|
2018-06-15 22:03:27 +01:00
|
|
|
logger.warn("received filename for unknown service: %s", service_name)
|
2013-08-29 15:21:13 +01:00
|
|
|
return
|
2018-06-15 22:03:27 +01:00
|
|
|
|
|
|
|
# validate file being set is valid
|
2018-06-20 20:59:07 +01:00
|
|
|
cfgfiles = service.configs
|
2013-08-29 15:21:13 +01:00
|
|
|
if filename not in cfgfiles:
|
2018-06-15 22:03:27 +01:00
|
|
|
logger.warn("received unknown file '%s' for service '%s'", filename, service_name)
|
2013-08-29 15:21:13 +01:00
|
|
|
return
|
2018-06-15 22:03:27 +01:00
|
|
|
|
|
|
|
# set custom service file data
|
2018-06-20 20:59:07 +01:00
|
|
|
service.configtxt[filename] = data
|
2018-06-15 22:03:27 +01:00
|
|
|
|
2018-06-20 20:59:07 +01:00
|
|
|
def node_service_startup(self, node, service, services, wait=False):
|
2018-06-15 22:03:27 +01:00
|
|
|
"""
|
|
|
|
Startup a node service.
|
|
|
|
|
|
|
|
:param PyCoreNode node: node to reconfigure service for
|
|
|
|
:param CoreService service: service to reconfigure
|
|
|
|
:param list[CoreService] services: node services
|
2018-06-20 20:59:07 +01:00
|
|
|
:param bool wait: determines if we should wait to validate startup
|
2018-06-15 22:03:27 +01:00
|
|
|
:return: status of startup
|
2018-06-20 20:59:07 +01:00
|
|
|
:rtype: int
|
2018-06-15 22:03:27 +01:00
|
|
|
"""
|
|
|
|
|
2018-06-20 20:59:07 +01:00
|
|
|
cmds = service.startup
|
|
|
|
if not service.custom:
|
2018-06-15 22:03:27 +01:00
|
|
|
cmds = service.getstartup(node, services)
|
|
|
|
|
2018-06-20 20:59:07 +01:00
|
|
|
status = 0
|
|
|
|
for cmd in cmds:
|
2018-06-15 22:03:27 +01:00
|
|
|
try:
|
2018-06-20 20:59:07 +01:00
|
|
|
if wait:
|
|
|
|
node.check_cmd(cmd)
|
|
|
|
else:
|
|
|
|
node.cmd(cmd, wait=False)
|
2018-06-15 22:03:27 +01:00
|
|
|
except CoreCommandError:
|
|
|
|
logger.exception("error starting command")
|
2018-06-20 20:59:07 +01:00
|
|
|
status = -1
|
2018-06-15 22:03:27 +01:00
|
|
|
return status
|
|
|
|
|
2018-06-20 20:59:07 +01:00
|
|
|
def node_service_files(self, node, service, services):
|
|
|
|
"""
|
|
|
|
Creates node service files.
|
|
|
|
|
|
|
|
:param PyCoreNode node: node to reconfigure service for
|
|
|
|
:param CoreService service: service to reconfigure
|
|
|
|
:param list[CoreService] services: node services
|
|
|
|
:return: nothing
|
|
|
|
"""
|
|
|
|
# get values depending on if custom or not
|
|
|
|
file_names = service.configs
|
|
|
|
if not service.custom:
|
|
|
|
file_names = service.getconfigfilenames(node.objid, services)
|
|
|
|
|
|
|
|
for file_name in file_names:
|
|
|
|
logger.info("generating service config: %s", file_name)
|
|
|
|
if service.custom:
|
|
|
|
cfg = service.configtxt.get(file_name)
|
|
|
|
if cfg is None:
|
|
|
|
cfg = service.generateconfig(node, file_name, services)
|
|
|
|
|
|
|
|
# cfg may have a file:/// url for copying from a file
|
|
|
|
try:
|
|
|
|
if self.copyservicefile(node, file_name, cfg):
|
|
|
|
continue
|
|
|
|
except IOError:
|
|
|
|
logger.exception("error copying service file: %s", file_name)
|
|
|
|
continue
|
|
|
|
else:
|
|
|
|
cfg = service.generateconfig(node, file_name, services)
|
|
|
|
|
|
|
|
node.nodefile(file_name, cfg)
|
|
|
|
|
2018-06-15 22:03:27 +01:00
|
|
|
def node_service_reconfigure(self, node, service, services):
|
|
|
|
"""
|
|
|
|
Reconfigure a node service.
|
|
|
|
|
|
|
|
:param PyCoreNode node: node to reconfigure service for
|
|
|
|
:param CoreService service: service to reconfigure
|
|
|
|
:param list[CoreService] services: node services
|
2017-06-20 02:09:28 +01:00
|
|
|
:return: nothing
|
|
|
|
"""
|
2018-06-20 20:59:07 +01:00
|
|
|
file_names = service.configs
|
|
|
|
if not service.custom:
|
|
|
|
file_names = service.getconfigfilenames(node.objid, services)
|
2017-06-20 02:09:28 +01:00
|
|
|
|
2018-06-20 20:59:07 +01:00
|
|
|
for file_name in file_names:
|
|
|
|
if file_name[:7] == "file:///":
|
2018-06-15 22:03:27 +01:00
|
|
|
# TODO: implement this
|
|
|
|
raise NotImplementedError
|
2017-06-20 02:09:28 +01:00
|
|
|
|
2018-06-20 20:59:07 +01:00
|
|
|
cfg = service.configtxt.get(file_name)
|
2018-06-15 22:03:27 +01:00
|
|
|
if cfg is None:
|
2018-06-20 20:59:07 +01:00
|
|
|
cfg = service.generateconfig(node, file_name, services)
|
2017-06-20 02:09:28 +01:00
|
|
|
|
2018-06-20 20:59:07 +01:00
|
|
|
node.nodefile(file_name, cfg)
|
2017-06-20 02:09:28 +01:00
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
|
|
|
|
class CoreService(object):
|
2017-06-20 02:09:28 +01:00
|
|
|
"""
|
|
|
|
Parent class used for defining services.
|
|
|
|
"""
|
2013-08-29 15:21:13 +01:00
|
|
|
# service name should not include spaces
|
2018-06-15 22:03:27 +01:00
|
|
|
name = None
|
2018-06-14 20:50:48 +01:00
|
|
|
|
2018-06-19 17:19:49 +01:00
|
|
|
# executables that must exist for service to run
|
|
|
|
executables = ()
|
|
|
|
|
2018-06-20 02:36:53 +01:00
|
|
|
# sets service requirements that must be started prior to this service starting
|
|
|
|
dependencies = ()
|
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
# group string allows grouping services together
|
2018-06-15 22:03:27 +01:00
|
|
|
group = None
|
2018-06-14 20:50:48 +01:00
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
# list name(s) of services that this service depends upon
|
2018-06-15 22:03:27 +01:00
|
|
|
depends = ()
|
2018-06-14 20:50:48 +01:00
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
# private, per-node directories required by this service
|
2018-06-15 22:03:27 +01:00
|
|
|
dirs = ()
|
2018-06-14 20:50:48 +01:00
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
# config files written by this service
|
2018-06-15 22:03:27 +01:00
|
|
|
configs = ()
|
2018-06-14 20:50:48 +01:00
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
# index used to determine start order with other services
|
2018-06-15 22:03:27 +01:00
|
|
|
startindex = 0
|
2018-06-14 20:50:48 +01:00
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
# time in seconds after runtime to run startup commands
|
2018-06-15 22:03:27 +01:00
|
|
|
starttime = 0
|
2018-06-14 20:50:48 +01:00
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
# list of startup commands
|
2018-06-15 22:03:27 +01:00
|
|
|
startup = ()
|
2018-06-14 20:50:48 +01:00
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
# list of shutdown commands
|
2018-06-15 22:03:27 +01:00
|
|
|
shutdown = ()
|
2018-06-14 20:50:48 +01:00
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
# list of validate commands
|
2018-06-15 22:03:27 +01:00
|
|
|
validate = ()
|
2018-06-14 20:50:48 +01:00
|
|
|
|
2018-06-20 20:59:07 +01:00
|
|
|
# validation mode, used to determine startup success
|
|
|
|
validation_mode = ServiceMode.NON_BLOCKING
|
|
|
|
|
|
|
|
# time to wait for determining if service started successfully
|
|
|
|
validation_timer = 0
|
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
# metadata associated with this service
|
2018-06-15 22:03:27 +01:00
|
|
|
meta = None
|
2018-06-14 20:50:48 +01:00
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
# custom configuration text
|
2018-06-15 22:03:27 +01:00
|
|
|
configtxt = {}
|
|
|
|
custom = False
|
|
|
|
custom_needed = False
|
2013-08-29 15:21:13 +01:00
|
|
|
|
|
|
|
def __init__(self):
|
2017-06-20 02:09:28 +01:00
|
|
|
"""
|
|
|
|
Services are not necessarily instantiated. Classmethods may be used
|
|
|
|
against their config. Services are instantiated when a custom
|
|
|
|
configuration is used to override their default parameters.
|
|
|
|
"""
|
2018-06-15 22:03:27 +01:00
|
|
|
self.custom = True
|
|
|
|
self.dirs = self.__class__.dirs
|
|
|
|
self.configs = self.__class__.configs
|
|
|
|
self.startindex = self.__class__.startindex
|
|
|
|
self.startup = self.__class__.startup
|
|
|
|
self.shutdown = self.__class__.shutdown
|
|
|
|
self.validate = self.__class__.validate
|
|
|
|
self.meta = self.__class__.meta
|
|
|
|
self.starttime = self.__class__.starttime
|
|
|
|
self.configtxt = self.__class__.configtxt
|
2017-06-20 02:09:28 +01:00
|
|
|
|
2017-08-08 00:40:39 +01:00
|
|
|
@classmethod
|
|
|
|
def on_load(cls):
|
|
|
|
pass
|
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
@classmethod
|
2018-06-14 20:50:48 +01:00
|
|
|
def getconfigfilenames(cls, node_id, services):
|
2017-06-20 02:09:28 +01:00
|
|
|
"""
|
|
|
|
Return the tuple of configuration file filenames. This default method
|
|
|
|
returns the cls._configs tuple, but this method may be overriden to
|
|
|
|
provide node-specific filenames that may be based on other services.
|
|
|
|
|
2018-06-14 20:50:48 +01:00
|
|
|
:param int node_id: node id to get config file names for
|
2017-06-20 02:09:28 +01:00
|
|
|
:param list services: node services
|
|
|
|
:return: class configuration files
|
|
|
|
:rtype: tuple
|
|
|
|
"""
|
2018-06-15 22:03:27 +01:00
|
|
|
return cls.configs
|
2017-06-20 02:09:28 +01:00
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
@classmethod
|
2017-06-20 02:09:28 +01:00
|
|
|
def generateconfig(cls, node, filename, services):
|
|
|
|
"""
|
|
|
|
Generate configuration file given a node object. The filename is
|
|
|
|
provided to allow for multiple config files. The other services are
|
|
|
|
provided to allow interdependencies (e.g. zebra and OSPF).
|
|
|
|
Return the configuration string to be written to a file or sent
|
|
|
|
to the GUI for customization.
|
|
|
|
|
2018-02-28 00:28:28 +00:00
|
|
|
:param core.netns.vnode.LxcNode node: node to generate config for
|
2017-06-20 02:09:28 +01:00
|
|
|
:param str filename: file name to generate config for
|
|
|
|
:param list services: services for node
|
|
|
|
:return: nothing
|
|
|
|
"""
|
2013-08-29 15:21:13 +01:00
|
|
|
raise NotImplementedError
|
2017-06-20 02:09:28 +01:00
|
|
|
|
2013-08-29 15:21:13 +01:00
|
|
|
@classmethod
|
2017-06-20 02:09:28 +01:00
|
|
|
def getstartup(cls, node, services):
|
|
|
|
"""
|
|
|
|
Return the tuple of startup commands. This default method
|
|
|
|
returns the cls._startup tuple, but this method may be
|
|
|
|
overridden to provide node-specific commands that may be
|
|
|
|
based on other services.
|
|
|
|
|
2018-02-28 00:28:28 +00:00
|
|
|
:param core.netns.vnode.LxcNode node: node to get startup for
|
2017-06-20 02:09:28 +01:00
|
|
|
:param list services: services for node
|
|
|
|
:return: startup commands
|
|
|
|
:rtype: tuple
|
|
|
|
"""
|
2018-06-15 22:03:27 +01:00
|
|
|
return cls.startup
|
2013-08-29 15:21:13 +01:00
|
|
|
|
|
|
|
@classmethod
|
2017-06-20 02:09:28 +01:00
|
|
|
def getvalidate(cls, node, services):
|
|
|
|
"""
|
|
|
|
Return the tuple of validate commands. This default method
|
|
|
|
returns the cls._validate tuple, but this method may be
|
|
|
|
overriden to provide node-specific commands that may be
|
|
|
|
based on other services.
|
|
|
|
|
2018-02-28 00:28:28 +00:00
|
|
|
:param core.netns.vnode.LxcNode node: node to validate
|
2017-06-20 02:09:28 +01:00
|
|
|
:param list services: services for node
|
|
|
|
:return: validation commands
|
|
|
|
:rtype: tuple
|
|
|
|
"""
|
2018-06-15 22:03:27 +01:00
|
|
|
return cls.validate
|