changed some logging from info to debug, removed startindex and depends from services

This commit is contained in:
Blake J. Harnden 2018-06-22 08:16:59 -07:00
parent 0aca9d7809
commit 37517c45f4
18 changed files with 35 additions and 104 deletions

View file

@ -12,10 +12,8 @@ class Bird(CoreService):
name = "bird"
executables = ("bird",)
group = "BIRD"
depends = ()
dirs = ("/etc/bird",)
configs = ("/etc/bird/bird.conf",)
startindex = 35
startup = ("bird -c %s" % (configs[0]),)
shutdown = ("killall bird",)
validate = ("pidof bird",)
@ -78,7 +76,7 @@ protocol device {
# Generate protocol specific configurations
for s in node.services:
if cls.name not in s.depends:
if cls.name not in s.dependencies:
continue
cfg += s.generatebirdconfig(node)
@ -95,10 +93,8 @@ class BirdService(CoreService):
executables = ("bird",)
group = "BIRD"
dependencies = ("bird",)
depends = ("bird",)
dirs = ()
configs = ()
startindex = 40
startup = ()
shutdown = ()
meta = "The config file for this service can be found in the bird service."

View file

@ -104,7 +104,7 @@ from core.service import ServiceManager
try:
from docker import Client
except ImportError:
logger.warns("missing python docker bindings")
logger.warn("missing python docker bindings")
class DockerService(CoreService):
@ -115,10 +115,8 @@ class DockerService(CoreService):
name = "Docker"
executables = ("docker",)
group = "Docker"
depends = ()
dirs = ('/var/lib/docker/containers/', '/run/shm', '/run/resolvconf',)
configs = ('docker.sh',)
startindex = 50
startup = ('sh docker.sh',)
shutdown = ('service docker stop',)
# Container image to start

View file

@ -15,10 +15,8 @@ class NrlService(CoreService):
"""""
name = None
group = "ProtoSvc"
depends = ()
dirs = ()
configs = ()
startindex = 45
startup = ()
shutdown = ()
@ -49,7 +47,6 @@ class MgenSinkService(NrlService):
name = "MGEN_Sink"
executables = ("mgen",)
configs = ("sink.mgen",)
startindex = 5
startup = ("mgen input sink.mgen",)
validate = ("pidof mgen",)
shutdown = ("killall mgen",)
@ -581,15 +578,11 @@ class MgenActor(NrlService):
executables = ("mgen",)
# you can create your own group here
group = "ProtoSvc"
# list of other services this service depends on
depends = ()
# per-node directories
dirs = ()
# generated files (without a full path this file goes in the node's dir,
# e.g. /tmp/pycore.12345/n1.conf/)
configs = ('start_mgen_actor.sh',)
# this controls the starting order vs other enabled services
startindex = 50
# list of startup commands, also may be generated during startup
startup = ("sh start_mgen_actor.sh",)
# list of validation commands
@ -625,7 +618,6 @@ class Arouted(NrlService):
name = "arouted"
executables = ("arouted",)
configs = ("startarouted.sh",)
startindex = NrlService.startindex + 10
startup = ("sh startarouted.sh",)
shutdown = ("pkill arouted",)
validate = ("pidof arouted",)

View file

@ -18,7 +18,6 @@ class Zebra(CoreService):
"quaggaboot.sh",
"/usr/local/etc/quagga/vtysh.conf"
)
startindex = 35
startup = ("sh quaggaboot.sh zebra",)
shutdown = ("killall zebra",)
validate = ("pidof zebra",)
@ -66,7 +65,7 @@ class Zebra(CoreService):
want_ipv4 = False
want_ipv6 = False
for s in node.services:
if cls.name not in s.depends:
if cls.name not in s.dependencies:
continue
ifccfg = s.generatequaggaifcconfig(node, ifc)
if s.ipv4_routing:
@ -92,7 +91,7 @@ class Zebra(CoreService):
cfg += "!\n"
for s in node.services:
if cls.name not in s.depends:
if cls.name not in s.dependencies:
continue
cfg += s.generatequaggaconfig(node)
return cfg
@ -222,10 +221,8 @@ class QuaggaService(CoreService):
name = None
group = "Quagga"
dependencies = ("zebra",)
depends = ("zebra",)
dirs = ()
configs = ()
startindex = 40
startup = ()
shutdown = ()
meta = "The config file for this service can be found in the Zebra service."

View file

@ -12,7 +12,6 @@ class SdnService(CoreService):
Parent class for SDN services.
"""
group = "SDN"
startindex = 50
@classmethod
def generateconfig(cls, node, filename):
@ -23,10 +22,8 @@ class OvsService(SdnService):
name = "OvsService"
executables = ("ovs-ofctl", "ovs-vsctl")
group = "SDN"
depends = ()
dirs = ("/etc/openvswitch", "/var/run/openvswitch", "/var/log/openvswitch")
configs = ('OvsService.sh',)
startindex = 50
startup = ('sh OvsService.sh',)
shutdown = ('killall ovs-vswitchd', 'killall ovsdb-server')
@ -98,10 +95,8 @@ class RyuService(SdnService):
name = "ryuService"
executables = ("ryu-manager",)
group = "SDN"
depends = ()
dirs = ()
configs = ('ryuService.sh',)
startindex = 50
startup = ('sh ryuService.sh',)
shutdown = ('killall ryu-manager',)

View file

@ -12,7 +12,6 @@ class VPNClient(CoreService):
name = "VPNClient"
group = "Security"
configs = ('vpnclient.sh',)
startindex = 60
startup = ('sh vpnclient.sh',)
shutdown = ("killall openvpn",)
validate = ("pidof openvpn",)
@ -39,7 +38,6 @@ class VPNServer(CoreService):
name = "VPNServer"
group = "Security"
configs = ('vpnserver.sh',)
startindex = 50
startup = ('sh vpnserver.sh',)
shutdown = ("killall openvpn",)
validate = ("pidof openvpn",)
@ -67,7 +65,6 @@ class IPsec(CoreService):
name = "IPsec"
group = "Security"
configs = ('ipsec.sh',)
startindex = 60
startup = ('sh ipsec.sh',)
shutdown = ("killall racoon",)
custom_needed = True
@ -95,7 +92,6 @@ class Firewall(CoreService):
name = "Firewall"
group = "Security"
configs = ('firewall.sh',)
startindex = 20
startup = ('sh firewall.sh',)
custom_needed = True

View file

@ -10,11 +10,9 @@ UCARP_ETC = "/usr/local/etc/ucarp"
class Ucarp(CoreService):
name = "ucarp"
group = "Utility"
depends = ( )
dirs = (UCARP_ETC,)
configs = (
UCARP_ETC + "/default.sh", UCARP_ETC + "/default-up.sh", UCARP_ETC + "/default-down.sh", "ucarpboot.sh",)
startindex = 65
startup = ("sh ucarpboot.sh",)
shutdown = ("killall ucarp",)
validate = ("pidof ucarp",)

View file

@ -18,10 +18,8 @@ class UtilService(CoreService):
"""
name = None
group = "Utility"
depends = ()
dirs = ()
configs = ()
startindex = 80
startup = ()
shutdown = ()
@ -33,7 +31,6 @@ class UtilService(CoreService):
class IPForwardService(UtilService):
name = "IPForward"
configs = ("ipforward.sh",)
startindex = 5
startup = ("sh ipforward.sh",)
@classmethod
@ -574,7 +571,6 @@ class PcapService(UtilService):
name = "pcap"
configs = ("pcap.sh",)
dirs = ()
startindex = 1
startup = ("sh pcap.sh start",)
shutdown = ("sh pcap.sh stop",)
validate = ("pidof tcpdump",)
@ -693,5 +689,4 @@ class UserDefinedService(UtilService):
Dummy service allowing customization of anything.
"""
name = "UserDefined"
startindex = 50
meta = "Customize this service to do anything upon startup."

View file

@ -14,10 +14,8 @@ class XorpRtrmgr(CoreService):
name = "xorp_rtrmgr"
executables = ("xorp_rtrmgr",)
group = "XORP"
depends = ()
dirs = ("/etc/xorp",)
configs = ("/etc/xorp/config.boot",)
startindex = 35
startup = ("xorp_rtrmgr -d -b %s -l /var/log/%s.log -P /var/run/%s.pid" % (configs[0], name, name),)
shutdown = ("killall xorp_rtrmgr",)
validate = ("pidof xorp_rtrmgr",)
@ -41,7 +39,7 @@ class XorpRtrmgr(CoreService):
for s in node.services:
try:
s.depends.index(cls.name)
s.dependencies.index(cls.name)
cfg += s.generatexorpconfig(node)
except ValueError:
logger.exception("error getting value from service: %s", cls.name)
@ -79,10 +77,8 @@ class XorpService(CoreService):
executables = ("xorp_rtrmgr",)
group = "XORP"
dependencies = ("xorp_rtrmgr",)
depends = ("xorp_rtrmgr",)
dirs = ()
configs = ()
startindex = 40
startup = ()
shutdown = ()
meta = "The config file for this service can be found in the xorp_rtrmgr service."