changeset 97:cf918d581da5

Enable admin to hide all nodes when the service is queried using disco items.
author Ralph Meijer <ralphm@ik.nu>
date Tue, 23 Nov 2004 17:05:21 +0000 (2004-11-23)
parents f289c3e1dd0a
children b9c449f4c167
files idavoll/idavoll.py idavoll/pubsub.py idavoll/tap.py
diffstat 3 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/idavoll/idavoll.py	Tue Nov 23 16:36:58 2004 +0000
+++ b/idavoll/idavoll.py	Tue Nov 23 17:05:21 2004 +0000
@@ -140,7 +140,9 @@
 
     bs = b.BackendService(st)
 
-    component.IService(bs).setServiceParent(sm)
+    c = component.IService(bs)
+    c.setServiceParent(sm)
+    c.hide_nodes = config["hide-nodes"]
 
     bsc = b.PublishService()
     bsc.setServiceParent(bs)
--- a/idavoll/pubsub.py	Tue Nov 23 16:36:58 2004 +0000
+++ b/idavoll/pubsub.py	Tue Nov 23 17:05:21 2004 +0000
@@ -117,6 +117,10 @@
 
 class ComponentServiceFromService(Service):
 
+    def __init__(self, backend):
+        Service.__init__(self, backend)
+        self.hide_nodes = False
+
     def get_disco_info(self, node):
         info = []
 
@@ -141,7 +145,7 @@
             return d
 
     def get_disco_items(self, node):
-        if node:
+        if node or self.hide_nodes:
             return defer.succeed([])
         
         d = self.backend.get_nodes()
--- a/idavoll/tap.py	Tue Nov 23 16:36:58 2004 +0000
+++ b/idavoll/tap.py	Tue Nov 23 17:05:21 2004 +0000
@@ -14,7 +14,10 @@
 		('dbname', None, 'pubsub'),
 	]
 
-	optFlags = [('verbose', 'v', 'Show traffic')]
+	optFlags = [
+		('verbose', 'v', 'Show traffic'),
+		('hide-nodes', None, 'Hide all nodes for disco')
+	]
 	
 	def postOptions(self):
 		if self['backend'] not in ['pgsql', 'memory']: