summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2019-08-26 19:58:04 +0200
committerDaniil Baturin <daniil@baturin.org>2019-08-27 08:16:28 +0200
commit3a6ce1c83b5615bd8eee153a74c5eab9f919ad55 (patch)
tree49e607c296c721fe081d4392ae282be1c0c29771 /python
parent43b0bbbc9b5b00b3e91dde7e7cffe8dc8497b8ce (diff)
downloadvyos-1x-3a6ce1c83b5615bd8eee153a74c5eab9f919ad55.tar.gz
vyos-1x-3a6ce1c83b5615bd8eee153a74c5eab9f919ad55.zip
T1598: add a vyos-hostsd operation for retrieving name servers by tag.
Diffstat (limited to 'python')
-rw-r--r--python/vyos/hostsd_client.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/python/vyos/hostsd_client.py b/python/vyos/hostsd_client.py
index e2f05071b..f009aba98 100644
--- a/python/vyos/hostsd_client.py
+++ b/python/vyos/hostsd_client.py
@@ -30,6 +30,8 @@ class Client(object):
reply = json.loads(reply_msg)
if 'error' in reply:
raise VyOSHostsdError(reply['error'])
+ else:
+ return reply["data"]
except zmq.error.Again:
raise VyOSHostsdError("Could not connect to vyos-hostsd")
@@ -60,3 +62,8 @@ class Client(object):
def delete_name_servers(self, tag):
msg = {'type': 'name_servers', 'op': 'delete', 'tag': tag}
self._communicate(msg)
+
+ def get_name_servers(self, tag):
+ msg = {'type': 'name_servers', 'op': 'get', 'tag': tag}
+ return self._communicate(msg)
+