data.py
author Tero Marttila <terom@fixme.fi>
Sun, 12 Jul 2009 00:43:36 +0300
changeset 6 57e8168ba8c4
parent 2 e66102ab7048
permissions -rw-r--r--
use FQDN for zone hosts
1
2223ade4f259 continue the overengineering effort, we are now able to generate dhcpd.conf files
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     1
"""
2223ade4f259 continue the overengineering effort, we are now able to generate dhcpd.conf files
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     2
    Functions to load data from various sources
2223ade4f259 continue the overengineering effort, we are now able to generate dhcpd.conf files
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     3
"""
2223ade4f259 continue the overengineering effort, we are now able to generate dhcpd.conf files
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     4
2223ade4f259 continue the overengineering effort, we are now able to generate dhcpd.conf files
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     5
import imp
2223ade4f259 continue the overengineering effort, we are now able to generate dhcpd.conf files
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     6
2
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
     7
def load_py (name, path) :
1
2223ade4f259 continue the overengineering effort, we are now able to generate dhcpd.conf files
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     8
    """
2
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
     9
        Load a python file from the given filesystem path, returning the module itself.
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
    10
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
    11
        The "name" of the module must be given, it should be something sane and unique...
1
2223ade4f259 continue the overengineering effort, we are now able to generate dhcpd.conf files
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    12
    """
2223ade4f259 continue the overengineering effort, we are now able to generate dhcpd.conf files
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    13
2
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
    14
    # just load it and return
e66102ab7048 fix up data.load_py, and make conf.File be a ConfObject itself - implement this for dhcp_conf
Tero Marttila <terom@fixme.fi>
parents: 1
diff changeset
    15
    return imp.load_source(name, path)
1
2223ade4f259 continue the overengineering effort, we are now able to generate dhcpd.conf files
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    16