summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaple Wang <maple.feng.wang@hotmail.com>2020-04-18 01:17:48 +0800
committerDaniil Baturin <daniil@vyos.io>2020-06-19 02:40:06 +0300
commit4281a42d732f764909b4b863146a00070e3d18a7 (patch)
tree2c47365e088e10a00fffe1735f81b78f50f1f39c
parent860aac39df003dea4fe360798ccba9e2eb1a7364 (diff)
downloadvyos-1x-4281a42d732f764909b4b863146a00070e3d18a7.tar.gz
vyos-1x-4281a42d732f764909b4b863146a00070e3d18a7.zip
[T2311] name servers via cmdline can't take effect
Please refer to https://phabricator.vyos.net/T2311
-rwxr-xr-xsrc/services/vyos-hostsd13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/services/vyos-hostsd b/src/services/vyos-hostsd
index 5fb7a68ab..343b3e2d2 100755
--- a/src/services/vyos-hostsd
+++ b/src/services/vyos-hostsd
@@ -25,6 +25,7 @@ import traceback
import re
import zmq
+import collections
import jinja2
@@ -67,8 +68,18 @@ resolv_tmpl_source = """
### Autogenerated by VyOS ###
### Do not edit, your changes will get overwritten ###
+# name server from static configuration
{% for ns in name_servers -%}
+{%- if name_servers[ns]['tag'] == "static" %}
nameserver {{ns}}
+{%- endif %}
+{% endfor -%}
+
+{% for ns in name_servers -%}
+{%- if name_servers[ns]['tag'] != "static" %}
+# name server from {{name_servers[ns]['tag']}}
+nameserver {{ns}}
+{%- endif %}
{% endfor -%}
{%- if domain_name %}
@@ -98,7 +109,7 @@ resolv_tmpl = jinja2.Template(resolv_tmpl_source)
# and re-created without having to track what needs
# to be changed
STATE = {
- "name_servers": {},
+ "name_servers": collections.OrderedDict({}),
"hosts": {},
"host_name": "vyos",
"domain_name": "",