summaryrefslogtreecommitdiff
path: root/src/conf_mode/host_name.py
diff options
context:
space:
mode:
authorzdc <zdc@users.noreply.github.com>2019-11-17 19:10:30 +0200
committerJohn Estabrook <jestabro@sentrium.io>2019-11-19 13:37:15 -0600
commit509ce7571a4617b2e8e1f5fc75e99689769c3997 (patch)
tree8ab3706efaeba844e2fb2765153a5c0a25d66dcd /src/conf_mode/host_name.py
parent87411adf066d36685b0f53cc38610505590cd5a5 (diff)
downloadvyos-1x-509ce7571a4617b2e8e1f5fc75e99689769c3997.tar.gz
vyos-1x-509ce7571a4617b2e8e1f5fc75e99689769c3997.zip
dns: T1786: add proper processing of 'system disable-dhcp-nameservers'
(cherry picked from commit 4e4f1dbd745952a24d70c3e2d7dc495d675dff34)
Diffstat (limited to 'src/conf_mode/host_name.py')
-rwxr-xr-xsrc/conf_mode/host_name.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/conf_mode/host_name.py b/src/conf_mode/host_name.py
index bb1ec9597..47cf232e9 100755
--- a/src/conf_mode/host_name.py
+++ b/src/conf_mode/host_name.py
@@ -66,7 +66,7 @@ def get_config():
hosts['nameserver'] = conf.return_values("system name-server")
if conf.exists("system disable-dhcp-nameservers"):
- hosts['no_dhcp_ns'] = conf.exists('system disable-dhcp-nameservers')
+ hosts['no_dhcp_ns'] = True
# system static-host-mapping
hosts['static_host_mapping'] = []
@@ -135,6 +135,10 @@ def apply(config):
try:
client = vyos.hostsd_client.Client()
+ # Check if disable-dhcp-nameservers is configured, and if yes - delete DNS servers added by DHCP
+ if config['no_dhcp_ns']:
+ client.delete_name_servers('dhcp-.+')
+
client.set_host_name(config['hostname'], config['domain_name'], config['domain_search'])
client.delete_name_servers(tag)