1- """Module to provide LDAP access for our DHCP stuff"""
1+ """Module to provide LDAP access for our DHCP stuff. """
22
33
44import re
1313
1414
1515class ISCDhcpLdapConfig :
16- """Initial class to connect to our LDAP"""
16+ """Initial class to connect to our LDAP. """
1717
1818 def __init__ (self , dhcp_config ):
19- """Initialize the dhcp configuration credentials and URI"""
19+ """Initialize the dhcp configuration credentials and URI. """
2020 self .dhcp_config = dhcp_config
2121
2222 @staticmethod
@@ -33,7 +33,7 @@ def __get_server_connection():
3333 return conn
3434
3535 def save (self ):
36- """Saves a DHCP entry for a single node in an LDAP database"""
36+ """Save a DHCP entry for a single node in an LDAP database. """
3737 conn = self .__get_server_connection ()
3838
3939 dhcp_statements = ["fixed-address %s;" % self .dhcp_config .ip_address ,
@@ -61,7 +61,7 @@ def save(self):
6161
6262 @staticmethod
6363 def get_all_db_entries ():
64- """Method to get all entries from our DB"""
64+ """Return all IPs? from our DB. """
6565 conn = ISCDhcpLdapConfig .__get_server_connection ()
6666
6767 entry_generator = conn .extend .standard .paged_search (
@@ -81,7 +81,7 @@ def get_all_db_entries():
8181
8282 @staticmethod
8383 def __get_dn_by_ipv4 (ip_address , multi = False ):
84- """Get a DN for a certain entry based on the provided ipv4 address"""
84+ """Get a DN for a certain entry based on the provided ipv4 address. """
8585 conn = ISCDhcpLdapConfig .__get_server_connection ()
8686 conn .search (
8787 search_base = config ['DHCPConfig' ].get ('ldap_client_base_dn' ),
@@ -111,7 +111,7 @@ def __get_dn_by_ipv4(ip_address, multi=False):
111111
112112 @staticmethod
113113 def __get_dn_by_mac (mac_address , multi = False ):
114- """Get a DN for a certain entry based on the provided MAC address"""
114+ """Get a DN for a certain entry based on the provided MAC address. """
115115 conn = ISCDhcpLdapConfig .__get_server_connection ()
116116 conn .search (
117117 search_base = config ['DHCPConfig' ].get ('ldap_client_base_dn' ),
@@ -141,7 +141,7 @@ def __get_dn_by_mac(mac_address, multi=False):
141141
142142 @staticmethod
143143 def __get_dhcp_config (distinguished_name ):
144- """Gets a LDAP object based on the provided DN"""
144+ """Get a LDAP object based on the provided DN. """
145145 # pylint: disable-msg=too-many-locals
146146 from marmoset .dhcp import DhcpConfig
147147
@@ -198,7 +198,7 @@ def __get_dhcp_config(distinguished_name):
198198
199199 @staticmethod
200200 def get_by_ip (ip_address ):
201- """Gets a config based on the provided IP"""
201+ """Get a config based on the provided IP. """
202202 distinguished_name = ISCDhcpLdapConfig .__get_dn_by_ipv4 (ip_address )
203203
204204 if distinguished_name is None :
@@ -208,7 +208,7 @@ def get_by_ip(ip_address):
208208
209209 @staticmethod
210210 def get_by_mac (mac_address ):
211- """Gets a config based on the provided MAC"""
211+ """Get a config based on the provided MAC. """
212212 distinguished_name = ISCDhcpLdapConfig .__get_dn_by_mac (mac_address )
213213
214214 if distinguished_name is None :
@@ -218,7 +218,7 @@ def get_by_mac(mac_address):
218218
219219 @staticmethod
220220 def remove_by_ipv4 (ipv4 ):
221- """Remove an entry based on the IP"""
221+ """Remove an entry based on the IP. """
222222 dn_list = ISCDhcpLdapConfig .__get_dn_by_ipv4 (ipv4 , multi = True )
223223
224224 for distinguished_name in dn_list :
@@ -230,7 +230,7 @@ def remove_by_ipv4(ipv4):
230230
231231 @staticmethod
232232 def remove_by_mac (mac ):
233- """Remove an entry based on the MAC"""
233+ """Remove an entry based on the MAC. """
234234 dn_list = ISCDhcpLdapConfig .__get_dn_by_mac (mac , multi = True )
235235
236236 for distinguished_name in dn_list :
0 commit comments