mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 17:44:41 +00:00
dhcp watchers: strip trailing and leading dots from hostname
This commit is contained in:
parent
2b89ff975f
commit
60fcb48d23
@ -58,7 +58,7 @@ def run_watcher(target_filename, default_domain, watch_file, service_pid):
|
||||
for lease in dhcpdleases.watch():
|
||||
if 'ends' in lease and lease['ends'] > time.time() \
|
||||
and 'client-hostname' in lease and 'address' in lease and lease['client-hostname']:
|
||||
if all(hostname_pattern.match(part) for part in lease['client-hostname'].strip().split('.')):
|
||||
if all(hostname_pattern.match(part) for part in lease['client-hostname'].strip('.').split('.')):
|
||||
address = ipaddress.ip_address(lease['address'])
|
||||
lease['domain'] = default_domain
|
||||
cached_leases[lease['address']] = lease
|
||||
|
||||
@ -145,7 +145,7 @@ def run_watcher(target_filename, default_domain, watch_file, config):
|
||||
for lease in dhcpdleases.watch():
|
||||
if 'ends' in lease and lease['ends'] > time.time() \
|
||||
and 'client-hostname' in lease and 'address' in lease and lease['client-hostname']:
|
||||
if all(hostname_pattern.match(part) for part in lease['client-hostname'].strip().split('.')):
|
||||
if all(hostname_pattern.match(part) for part in lease['client-hostname'].strip('.').split('.')):
|
||||
address = ipaddress.ip_address(lease['address'])
|
||||
lease['domain'] = default_domain
|
||||
for lease_config in lease_configs:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user