~lutostag/ubuntu/utopic/maas/1.5.2

« back to all changes in this revision

Viewing changes to src/provisioningserver/dhcp/config.py

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez, Dustin Kirkland, Andres Rodriguez
  • Date: 2014-01-31 09:38:51 UTC
  • mfrom: (1.2.21)
  • Revision ID: package-import@ubuntu.com-20140131093851-0jd8i9q57uxqxk3i
Tags: 1.5+bzr1909-0ubuntu1
* New upstream release.

[ Dustin Kirkland ]
* debian/maas-region-controller-min.postinst: Fix typo in sed. Remove
  double quotes. (LP: #1274448)

[ Andres Rodriguez ]
* debian/control: Add depends on python-crochet.
* Get rid of dfsg on the versioning as we no longer strip any code from
  the orig tarball.
  - debian/rules: Do not strip any files out of the tarball.
* debian/patches/*: Refreshed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
 
34
34
 
35
35
def get_config(**params):
36
 
    """Return a DHCP config file based on the supplied parameters.
37
 
 
38
 
    :param subnet: The base subnet declaration. e.g. 192.168.1.0
39
 
    :param subnet_mask: The mask for the above subnet, e.g. 255.255.255.0
40
 
    :param broadcast_address: The broadcast IP address for the subnet,
41
 
        e.g. 192.168.1.255
42
 
    :param dns_servers: One or more IP addresses of the DNS server for the
43
 
        subnet
44
 
    :param ntp_server: IP address of the NTP server for the nodes
45
 
    :param domain_name: name that will be appended to the client's hostname to
46
 
        form a fully-qualified domain-name
47
 
    :param gateway: The router/gateway IP address for the subnet.
48
 
    :param low_range: The first IP address in the range of IP addresses to
49
 
        allocate
50
 
    :param high_range: The last IP address in the range of IP addresses to
51
 
        allocate
52
 
    """
 
36
    """Return a DHCP config file based on the supplied parameters."""
53
37
    template_file = locate_config(TEMPLATES_DIR, 'dhcpd.conf.template')
54
38
    params['bootloader'] = compose_bootloader_path()
55
39
    params['platform_codename'] = linux_distribution()[2]
57
41
    try:
58
42
        template = tempita.Template.from_filename(
59
43
            template_file, encoding="UTF-8")
60
 
        return template.substitute(params)
61
 
    except NameError as error:
 
44
        return template.substitute(**params)
 
45
    except (KeyError, NameError) as error:
62
46
        raise DHCPConfigError(*error.args)