/usr/lib/python3/dist-packages/provisioningserver/dhcp/__init__.py is in python3-maas-provisioningserver 2.0.0~beta3+bzr4941-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 | # Copyright 2012-2016 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Monitored service driver."""
__all__ = [
"DHCPv4Server",
"DHCPv6Server",
]
from abc import (
ABCMeta,
abstractproperty,
)
from provisioningserver.path import get_path
# Location of the DHCPv4 configuration file.
DHCPv4_CONFIG_FILE = '/var/lib/maas/dhcpd.conf'
# Location of the DHCPv4 interfaces file.
DHCPv4_INTERFACES_FILE = '/var/lib/maas/dhcpd-interfaces'
# Location of the DHCPv6 configuration file.
DHCPv6_CONFIG_FILE = '/var/lib/maas/dhcpd6.conf'
# Location of the DHCPv6 interfaces file.
DHCPv6_INTERFACES_FILE = '/var/lib/maas/dhcpd6-interfaces'
# Message to put in the DHCP config file when the DHCP server gets stopped.
DISABLED_DHCP_SERVER = "# DHCP server stopped and disabled."
class DHCPServer(metaclass=ABCMeta):
"""Represents the settings for a DHCP server.
:cvar descriptive_name: A name to use for this server in human-readable
texts.
:cvar template_basename: The base filename for the template to use when
generating configuration for this server.
:cvar interfaces_filename: The full path and filename for the server's
interfaces file.
:cvar config_filename: The full path and filename for the server's
configuration file.
:ivar omapi_key: The OMAPI secret key for the server.
"""
descriptive_name = abstractproperty()
template_basename = abstractproperty()
interfaces_filename = abstractproperty()
config_filename = abstractproperty()
dhcp_service = abstractproperty()
ipv6 = abstractproperty()
def __init__(self, omapi_key):
super(DHCPServer, self).__init__()
self.omapi_key = omapi_key
class DHCPv4Server(DHCPServer):
"""Represents the settings for a DHCPv4 server.
See `DHCPServer`.
"""
descriptive_name = "DHCPv4"
template_basename = 'dhcpd.conf.template'
interfaces_filename = get_path(DHCPv4_INTERFACES_FILE)
config_filename = get_path(DHCPv4_CONFIG_FILE)
dhcp_service = "dhcpd"
ipv6 = False
class DHCPv6Server(DHCPServer):
"""Represents the settings for a DHCPv6 server.
See `DHCPServer`.
"""
descriptive_name = "DHCPv6"
template_basename = 'dhcpd6.conf.template'
interfaces_filename = get_path(DHCPv6_INTERFACES_FILE)
config_filename = get_path(DHCPv6_CONFIG_FILE)
dhcp_service = "dhcpd6"
ipv6 = True
|