summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-07-05 12:30:12 +0200
committerGitHub <noreply@github.com>2022-07-05 12:30:12 +0200
commit459f8ea10227b5644083ddcf8a0e8b63faa22313 (patch)
tree964aeb5f7540862890d0c602b6b0e470dec0130e /src
parentcac6da1e3038cba22735eafd9f8b4ec13359a2d7 (diff)
parenteaaaa797fa9dac621b964f1bd02fab3b9eebe55e (diff)
downloadvyos-1x-459f8ea10227b5644083ddcf8a0e8b63faa22313.tar.gz
vyos-1x-459f8ea10227b5644083ddcf8a0e8b63faa22313.zip
Merge pull request #1391 from c-po/t4510-static-host-equuleus
hosts: T2683: Allow multiple entries for static-host-mapping (equuleus)
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/host_name.py2
-rwxr-xr-xsrc/services/vyos-hostsd2
-rwxr-xr-xsrc/utils/vyos-hostsd-client3
3 files changed, 4 insertions, 3 deletions
diff --git a/src/conf_mode/host_name.py b/src/conf_mode/host_name.py
index a7135911d..87bad0dc6 100755
--- a/src/conf_mode/host_name.py
+++ b/src/conf_mode/host_name.py
@@ -79,7 +79,7 @@ def get_config(config=None):
# system static-host-mapping
for hn in conf.list_nodes(['system', 'static-host-mapping', 'host-name']):
hosts['static_host_mapping'][hn] = {}
- hosts['static_host_mapping'][hn]['address'] = conf.return_value(['system', 'static-host-mapping', 'host-name', hn, 'inet'])
+ hosts['static_host_mapping'][hn]['address'] = conf.return_values(['system', 'static-host-mapping', 'host-name', hn, 'inet'])
hosts['static_host_mapping'][hn]['aliases'] = conf.return_values(['system', 'static-host-mapping', 'host-name', hn, 'alias'])
return hosts
diff --git a/src/services/vyos-hostsd b/src/services/vyos-hostsd
index 4c4bb036e..f4b1d0fc2 100755
--- a/src/services/vyos-hostsd
+++ b/src/services/vyos-hostsd
@@ -317,7 +317,7 @@ hosts_add_schema = op_type_schema.extend({
'data': {
str: {
str: {
- 'address': str,
+ 'address': [str],
'aliases': [str]
}
}
diff --git a/src/utils/vyos-hostsd-client b/src/utils/vyos-hostsd-client
index d4d38315a..a0515951a 100755
--- a/src/utils/vyos-hostsd-client
+++ b/src/utils/vyos-hostsd-client
@@ -129,7 +129,8 @@ try:
params = h.split(",")
if len(params) < 2:
raise ValueError("Malformed host entry")
- entry['address'] = params[1]
+ # Address needs to be a list because of changes made in T2683
+ entry['address'] = [params[1]]
entry['aliases'] = params[2:]
data[params[0]] = entry
client.add_hosts({args.tag: data})