Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Helper class that can simplyfy most of the tasks when managing ISC-DHCP configuration stored in a LDAP tree.

Modifying existing configuration

Example:

import ldap
from pydhcp_ldap_schema import DHCPEntry

con = ldap.initialize('ldap://localhost')
con.bind_s('user', 'pass')

subNet = DHCPEntry.ldap_load(con, 'cn=192.168.1.0,cn=DHCP Config,dc=example,dc=com')
print subNet['dhcpNetMask']      # prints ['24']
subNet['dhcpNetMask'] = ['25']   # set new value

subNet.ldap_modify(con)          # automatic change detection and commit if nessesery

con.unbind_s()

Creating new nodes

Add fresh configuration:

import ldap
from pydhcp_ldap_schema import DHCPEntry

con = ldap.initialize('ldap://localhost')
con.bind_s('user', 'pass')

service = DHCPEntry(['top', 'dhcpService'], cn=['DHCP Config'])
service.ldap_add(con, 'cn=DHCP Config,dc=example,dc=com')       # create base entry

dhcpServer = DHCPEntry(['top', 'dhcpServer'], cn=['dhcp.local'])
dhcpServer['dhcpServiceDN'] = [service.dn]

service.subobjects.insert_entry(dhcpServer)   # DN will be calculated

dhcpServer.ldap_add(con)

# and most important subnet declaration

subnet = DHCPEntry(['top', 'dhcpSubnet'], cn=['192.168.1.0'])
subnet['dhcpNetMask'] = ['24']

service.subobjects.insert_entry(subnet)

subnet.ldap_add(con)

# Now you can start DHCPd server

con.unbind_s()

Metadata

Release files for pydhcp-ldap-schema 0.1beta

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydhcp-ldap-schema 0.1beta
File Size Uploaded
pydhcp-ldap-schema-0.1beta.tar.gz 6.5 kB Details

Release files / pydhcp-ldap-schema-0.1beta.tar.gz

Download URL pydhcp-ldap-schema-0.1beta.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5968a137b7be33c7e052d49965cf3f29d602960ed66a3bfa0aff32656adadbc2
BLAKE2b-256 checksum
How to use checksums
15cb716c36081b9ae822bd6e382ef9a0ebe41441174e882cb8b6ccaf5875507d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1beta This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page