/usr/lib/python3/dist-packages/provisioningserver/server.py is in python3-maas-provisioningserver 2.4.0~beta2-6865-gec43e47e6-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | # Copyright 2018 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Entrypoint for the maas rackd service."""
# Install the asyncio reactor with uvloop. This must be done before any other
# twisted code is imported.
import asyncio
import sys
from twisted.internet import asyncioreactor
try:
import uvloop
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
except ImportError:
pass
asyncioreactor.install()
from twisted.python import usage
from twisted.scripts._twistd_unix import ServerOptions, UnixApplicationRunner
# Load the available MAAS plugins.
twistd_plugins = []
try:
from provisioningserver.plugin import ProvisioningServiceMaker
except ImportError:
pass
else:
# Rackd service that twisted will spawn.
twistd_plugins.append(
ProvisioningServiceMaker(
"maas-rackd", "The MAAS Rack Controller daemon."))
try:
from maasserver.plugin import (
RegionAllInOneServiceMaker,
RegionMasterServiceMaker,
RegionWorkerServiceMaker,
)
except ImportError:
pass
else:
# Regiond services that twisted could spawn.
twistd_plugins.append(
RegionMasterServiceMaker(
"maas-regiond-master",
"The MAAS Region Controller master process."))
twistd_plugins.append(
RegionWorkerServiceMaker(
"maas-regiond-worker",
"The MAAS Region Controller worker process."))
twistd_plugins.append(
RegionAllInOneServiceMaker(
"maas-regiond-all",
"The MAAS Region Controller all-in-one process."))
class Options(ServerOptions):
"""Override the plugins path for the server options."""
@staticmethod
def _getPlugins(interface):
return twistd_plugins
def runService(service):
"""Run the `service`."""
config = Options()
args = [
'--logger=provisioningserver.logger.EventLogger',
'--nodaemon', '--pidfile=',
]
args += sys.argv[1:]
args += [service]
try:
config.parseOptions(args)
except usage.error as exc:
print(config)
print("%s: %s" % (sys.argv[0], exc))
else:
UnixApplicationRunner(config).run()
def run():
"""Run the maas-rackd service."""
runService('maas-rackd')
|