You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gm...@apache.org on 2017/11/01 19:21:05 UTC

qpid-dispatch git commit: DISPATCH-856 Add hostName to router entity. This closes #209

Repository: qpid-dispatch
Updated Branches:
  refs/heads/master ec6bcacdf -> 1a29a1006


DISPATCH-856 Add hostName to router entity. This closes #209


Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/1a29a100
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/1a29a100
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/1a29a100

Branch: refs/heads/master
Commit: 1a29a1006da3118ea9bee27d85123653304c363d
Parents: ec6bcac
Author: Ernest Allen <ea...@redhat.com>
Authored: Mon Oct 16 08:41:49 2017 -0400
Committer: Ganesh Murthy <gm...@redhat.com>
Committed: Wed Nov 1 15:17:40 2017 -0400

----------------------------------------------------------------------
 python/qpid_dispatch/management/qdrouter.json     | 4 ++++
 python/qpid_dispatch_internal/management/agent.py | 5 +++++
 2 files changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/1a29a100/python/qpid_dispatch/management/qdrouter.json
----------------------------------------------------------------------
diff --git a/python/qpid_dispatch/management/qdrouter.json b/python/qpid_dispatch/management/qdrouter.json
index 6329a07..69c7bce 100644
--- a/python/qpid_dispatch/management/qdrouter.json
+++ b/python/qpid_dispatch/management/qdrouter.json
@@ -397,6 +397,10 @@
                     "type": "string",
                     "description": "Software Version"
                 },
+                "hostName": {
+                    "type": "string",
+                    "description": "hostName of machine on which router is running"
+                },
                 "helloInterval": {
                     "type": "integer",
                     "default": 1,

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/1a29a100/python/qpid_dispatch_internal/management/agent.py
----------------------------------------------------------------------
diff --git a/python/qpid_dispatch_internal/management/agent.py b/python/qpid_dispatch_internal/management/agent.py
index cd5ec7d..b752eb1 100644
--- a/python/qpid_dispatch_internal/management/agent.py
+++ b/python/qpid_dispatch_internal/management/agent.py
@@ -63,6 +63,7 @@ data that may be updated in other threads.
 """
 
 import traceback, json, pstats
+import socket
 from itertools import ifilter, chain
 from traceback import format_exc
 from threading import Lock
@@ -241,6 +242,10 @@ class RouterEntity(EntityAdapter):
         return self.attributes.get('id')
 
     def create(self):
+        try:
+            self.attributes[u"hostName"] = socket.gethostbyaddr(socket.gethostname())[0]
+        except:
+            self.attributes[u"hostName"] = ''
         self._qd.qd_dispatch_configure_router(self._dispatch, self)
 
     def __str__(self):


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org