[kupfer] grouping: new HostServiceLeaf for ordinary services



commit 95d0a28ec9eb427247785eabb0964daaeb6144dc
Author: Karol BÄ?dkowski <karol bedkowsk+gh gmail com>
Date:   Sat Jan 9 22:00:31 2010 +0100

    grouping: new HostServiceLeaf for ordinary services

 kupfer/obj/hosts.py |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/kupfer/obj/hosts.py b/kupfer/obj/hosts.py
index 8629af2..cc1a5db 100644
--- a/kupfer/obj/hosts.py
+++ b/kupfer/obj/hosts.py
@@ -12,6 +12,11 @@ __author__ = ("Ulrik Sverdrup <ulrik sverdrup gmail com>, "
 
 HOST_NAME_KEY = "HOST_NAME"
 HOST_ADDRESS_KEY = "HOST_ADDRESS"
+HOST_SERVICE_NAME_KEY = "HOST_SERVICE_NAME"
+HOST_SERVICE_PORT_KEY = "HOST_SERVICE_PORT"
+HOST_SERVICE_USER_KEY = "HOST_SERVICE_USER"
+HOST_SERVICE_PASS_KEY = "HOST_SERVICE_PASS"
+
 
 class HostLeaf(GroupingLeaf):
 	grouping_slots = (HOST_NAME_KEY, HOST_ADDRESS_KEY)
@@ -20,3 +25,21 @@ class HostLeaf(GroupingLeaf):
 		return "computer"
 
 
+class HostServiceLeaf(HostLeaf):
+	''' Leaf dedicated for well known services like ftp, ssh, vnc '''
+	def __init__(self, name, address, service, description, port=None, 
+			user=None, password=None ):
+		slots = {
+			HOST_NAME_KEY: name,
+			HOST_ADDRESS_KEY: address,
+			HOST_SERVICE_NAME_KEY: service,
+			HOST_SERVICE_PORT_KEY: port,
+			HOST_SERVICE_USER_KEY: user,
+			HOST_SERVICE_PASS_KEY: password,
+		}
+		HostLeaf.__init__(self, slots, name or address)
+		self._description = description
+
+	def get_description(self):
+		return self._description
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]