diff options
-rw-r--r-- | interface-definitions/dns-domain-name.xml | 2 | ||||
-rwxr-xr-x | src/conf_mode/host_name.py | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/interface-definitions/dns-domain-name.xml b/interface-definitions/dns-domain-name.xml index 7b8497c09..054979787 100644 --- a/interface-definitions/dns-domain-name.xml +++ b/interface-definitions/dns-domain-name.xml @@ -3,7 +3,7 @@ <interfaceDefinition> <node name="system"> <children> - <leafNode name="name-server"> + <leafNode name="name-server" owner="${vyos_conf_scripts_dir}/host_name.py"> <properties> <help>Domain Name Server (DNS)</help> <priority>400</priority> diff --git a/src/conf_mode/host_name.py b/src/conf_mode/host_name.py index a0ed815ae..c5268df2a 100755 --- a/src/conf_mode/host_name.py +++ b/src/conf_mode/host_name.py @@ -116,7 +116,12 @@ def get_config(arguments): for search in conf.return_values("system domain-search domain"): hosts['domain_search'].append(search) - hosts['nameserver'] = conf.return_values("system name-server") + if conf.exists("system name-server"): + if not isinstance(conf.return_values("system name-server"), list): + hosts['nameserver'] = conf.return_values("system name-server").replace("'", "").split() + else: + hosts['nameserver'] = conf.return_values("system name-server") + hosts['no_dhcp_ns'] = conf.exists('system disable-dhcp-nameservers') return hosts |