[Cluster-devel] conga/luci/site/luci/Extensions HelperFunction ...
rmccabe at sourceware.org
rmccabe at sourceware.org
Mon Sep 24 21:19:45 UTC 2007
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2007-09-24 21:19:43
Modified files:
luci/site/luci/Extensions: HelperFunctions.py LuciZopeAsync.py
PropsObject.py ResourceHandler.py
StorageReport.py Variable.py
conga_constants.py conga_ssl.py
conga_storage_constants.py
ricci_communicator.py
ricci_defines.py storage_adapters.py
Log message:
More cleanup.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/HelperFunctions.py.diff?cvsroot=cluster&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciZopeAsync.py.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/PropsObject.py.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ResourceHandler.py.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/StorageReport.py.diff?cvsroot=cluster&r1=1.27&r2=1.28
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/Variable.py.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/conga_constants.py.diff?cvsroot=cluster&r1=1.43&r2=1.44
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/conga_ssl.py.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/conga_storage_constants.py.diff?cvsroot=cluster&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_communicator.py.diff?cvsroot=cluster&r1=1.29&r2=1.30
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/ricci_defines.py.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/storage_adapters.py.diff?cvsroot=cluster&r1=1.12&r2=1.13
--- conga/luci/site/luci/Extensions/HelperFunctions.py 2007/08/08 21:00:07 1.9
+++ conga/luci/site/luci/Extensions/HelperFunctions.py 2007/09/24 21:19:42 1.10
@@ -79,8 +79,8 @@
def get_system_info(self, system_list):
mutex = threading.RLock()
- hive = [] # workers
- ss = {} # storage systems (will store riccis and then use them to retrieve real info)
+ hive = [] # workers
+ ss = {} # storage systems (will store riccis and then use them to retrieve real info)
hosts = [] # hostnames
for system in system_list:
--- conga/luci/site/luci/Extensions/LuciZopeAsync.py 2007/08/08 21:00:07 1.1
+++ conga/luci/site/luci/Extensions/LuciZopeAsync.py 2007/09/24 21:19:42 1.2
@@ -38,7 +38,7 @@
pyobj_to_xml(i, element[i], xml_elem)
else:
xml_elem = None
- elif type(element) in [ types.ListType, types.TupleType ]:
+ elif type(element) in ( types.ListType, types.TupleType ):
if len(element) > 0:
xml_elem = root.createElement('list')
xml_elem.setAttribute('name', str(element_name))
--- conga/luci/site/luci/Extensions/PropsObject.py 2007/07/27 16:43:47 1.7
+++ conga/luci/site/luci/Extensions/PropsObject.py 2007/09/24 21:19:42 1.8
@@ -11,41 +11,42 @@
import xml.dom
class PropsObject:
+ def __init__(self):
+ self.__vars = {}
- def __init__(self):
- self.__vars = {}
-
- def add_prop(self, variable):
- self.__vars[variable.get_name()] = variable
- def get_prop(self, name):
- if name in self.__vars:
- return self.__vars[name].get_value()
- else:
- return None
-
- def get_props(self):
- return self.__vars
-
- def export_xml(self, doc, parent_node):
- props = doc.createElement(str(PROPS_TAG))
- parent_node.appendChild(props)
- for var in self.__vars:
- props.appendChild(self.__vars[var].export_xml(doc))
- return props
-
- def import_xml(self, parent_node):
- props = None
- for node in parent_node.childNodes:
- if node.nodeType == xml.dom.Node.ELEMENT_NODE:
- if node.nodeName == str(PROPS_TAG):
- props = node
- if props is None:
- return self
- for node in props.childNodes:
- try:
- var = parse_variable(node)
- self.__vars[var.get_name()] = var
- except:
- continue
- return self
+ def add_prop(self, variable):
+ self.__vars[variable.get_name()] = variable
+ def get_prop(self, name):
+ if name in self.__vars:
+ return self.__vars[name].get_value()
+ else:
+ return None
+
+ def get_props(self):
+ return self.__vars
+
+ def export_xml(self, doc, parent_node):
+ props = doc.createElement(str(PROPS_TAG))
+ parent_node.appendChild(props)
+ for var in self.__vars:
+ props.appendChild(self.__vars[var].export_xml(doc))
+ return props
+
+ def import_xml(self, parent_node):
+ props = None
+ for node in parent_node.childNodes:
+ if node.nodeType == xml.dom.Node.ELEMENT_NODE:
+ if node.nodeName == str(PROPS_TAG):
+ props = node
+
+ if props is None:
+ return self
+
+ for node in props.childNodes:
+ try:
+ var = parse_variable(node)
+ self.__vars[var.get_name()] = var
+ except:
+ continue
+ return self
--- conga/luci/site/luci/Extensions/ResourceHandler.py 2007/09/18 21:49:46 1.3
+++ conga/luci/site/luci/Extensions/ResourceHandler.py 2007/09/24 21:19:42 1.4
@@ -684,7 +684,7 @@
try:
dbtype = form['DBTYPE'].strip()
- if not dbtype in [ 'ORA', 'DB6', 'ADA' ]:
+ if not dbtype in ( 'ORA', 'DB6', 'ADA' ):
raise Exception, 'You gave an invalid database type: %s' % dbtype
res.addAttribute('DBTYPE', dbtype)
except Exception, e:
@@ -699,7 +699,7 @@
res.removeAttribute('DBJ2EE_ONLY')
# Optional string parameters
- for param in [ 'DIR_EXECUTABLE', 'NETSERVICENAME', 'DIR_BOOTSTRAP', 'DIR_SECSTORE' ]:
+ for param in ( 'DIR_EXECUTABLE', 'NETSERVICENAME', 'DIR_BOOTSTRAP', 'DIR_SECSTORE' ):
try:
pval = form[param].strip()
if not pval:
@@ -721,7 +721,7 @@
res.addAttribute('InstanceName', rname)
# Optional string parameters
- for param in [ 'DIR_EXECUTABLE', 'DIR_PROFILE', 'START_PROFILE' ]:
+ for param in ( 'DIR_EXECUTABLE', 'DIR_PROFILE', 'START_PROFILE' ):
try:
pval = form[param].strip()
if not pval:
--- conga/luci/site/luci/Extensions/StorageReport.py 2007/09/24 19:48:34 1.27
+++ conga/luci/site/luci/Extensions/StorageReport.py 2007/09/24 21:19:42 1.28
@@ -1624,7 +1624,7 @@
value = var.getAttribute('value')
d_units = ''
- if name in ['size', 'extent_size', 'block_size', 'size_free', 'partition_begin']:
+ if name in ('size', 'extent_size', 'block_size', 'size_free', 'partition_begin' ):
d_units = 'bytes'
if 'percent' in name:
d_units = '%'
@@ -1686,7 +1686,7 @@
d_value = str(value)
hidden = False
- if var_type == 'hidden' or name in ['partition_begin', 'snapshot']:
+ if var_type == 'hidden' or name in ( 'partition_begin', 'snapshot' ):
hidden = True
if name == 'removable':
--- conga/luci/site/luci/Extensions/Variable.py 2007/06/25 16:03:38 1.5
+++ conga/luci/site/luci/Extensions/Variable.py 2007/09/24 21:19:42 1.6
@@ -14,268 +14,271 @@
VARIABLE_TYPE_STRING_SEL, VARIABLE_TYPE_XML
def parse_variable(node):
- if node.nodeType != xml.dom.Node.ELEMENT_NODE:
- raise Exception, 'not a variable'
- if node.nodeName != str(VARIABLE_TAG):
- raise Exception, 'not a variable'
-
- attrs_dir = {}
- attrs = node.attributes
- for attrName in attrs.keys():
- attrNode = attrs.get(attrName)
- attrValue = attrNode.nodeValue
- attrs_dir[attrName.strip()] = attrValue
- if ('name' not in attrs_dir) or ('type' not in attrs_dir):
- raise Exception, 'incomplete variable'
- if (attrs_dir['type'] != VARIABLE_TYPE_LIST_INT and attrs_dir['type'] != VARIABLE_TYPE_LIST_STR and attrs_dir['type'] != VARIABLE_TYPE_LIST_XML and attrs_dir['type'] != VARIABLE_TYPE_XML) and ('value' not in attrs_dir):
- raise Exception, 'incomplete variable'
-
- mods = {}
- for mod in attrs_dir:
- if mod not in ['name', 'value', 'type']:
- mods[mod] = attrs_dir[mod]
-
- value = ''
- if attrs_dir['type'] == VARIABLE_TYPE_LIST_STR:
- value = []
- for entry in node.childNodes:
- v = None
- if entry.nodeType == xml.dom.Node.ELEMENT_NODE and entry.nodeName == str(VARIABLE_TYPE_LISTENTRY):
- attrs = entry.attributes
- for attrName in attrs.keys():
- attrNode = attrs.get(attrName)
- attrValue = attrNode.nodeValue
- if attrName == 'value':
- v = attrValue
- else:
- continue
- if v is None:
- raise Exception, 'invalid listentry'
- value.append(v)
- return VariableList(attrs_dir['name'], value, mods, VARIABLE_TYPE_LIST_STR)
- elif attrs_dir['type'] == VARIABLE_TYPE_LIST_XML:
- value = []
- for kid in node.childNodes:
- if kid.nodeType == xml.dom.Node.ELEMENT_NODE:
- value.append(kid)#.cloneNode(True))
- return VariableList(attrs_dir['name'], value, mods, VARIABLE_TYPE_LIST_XML)
- elif attrs_dir['type'] == VARIABLE_TYPE_XML:
- for kid in node.childNodes:
- if kid.nodeType == xml.dom.Node.ELEMENT_NODE:
- value = kid#.cloneNode(True)
- break
- elif attrs_dir['type'] == VARIABLE_TYPE_INT:
- value = int(attrs_dir['value'])
- elif attrs_dir['type'] == VARIABLE_TYPE_INT_SEL:
- value = int(attrs_dir['value'])
- if 'valid_values' not in mods:
- raise Exception, 'missing valid_values'
- elif attrs_dir['type'] == VARIABLE_TYPE_FLOAT:
- value = float(attrs_dir['value'])
- elif attrs_dir['type'] == VARIABLE_TYPE_STRING:
- value = attrs_dir['value']
- elif attrs_dir['type'] == VARIABLE_TYPE_STRING_SEL:
- value = attrs_dir['value']
- if 'valid_values' not in mods:
- raise Exception, 'missing valid_values'
- elif attrs_dir['type'] == VARIABLE_TYPE_BOOL:
- value = (attrs_dir['value'] == 'true')
- else:
- raise Exception, 'invalid variable'
+ if node.nodeType != xml.dom.Node.ELEMENT_NODE:
+ raise Exception, 'not a variable'
- return Variable(attrs_dir['name'], value, mods)
+ if node.nodeName != str(VARIABLE_TAG):
+ raise Exception, 'not a variable'
+ attrs_dir = {}
+ attrs = node.attributes
+ for attrName in attrs.keys():
+ attrNode = attrs.get(attrName)
+ attrValue = attrNode.nodeValue
+ attrs_dir[attrName.strip()] = attrValue
+
+ if ('name' not in attrs_dir) or ('type' not in attrs_dir):
+ raise Exception, 'incomplete variable'
+
+ if attrs_dir['type'] not in ( VARIABLE_TYPE_LIST_INT, VARIABLE_TYPE_LIST_STR, VARIABLE_TYPE_LIST_XML, VARIABLE_TYPE_XML) and 'value' not in attrs_dir:
+ raise Exception, 'incomplete variable'
+
+ mods = {}
+ for mod in attrs_dir:
+ if mod not in ( 'name', 'value', 'type' ):
+ mods[mod] = attrs_dir[mod]
+
+ value = ''
+ if attrs_dir['type'] == VARIABLE_TYPE_LIST_STR:
+ value = []
+ for entry in node.childNodes:
+ v = None
+ if entry.nodeType == xml.dom.Node.ELEMENT_NODE and entry.nodeName == str(VARIABLE_TYPE_LISTENTRY):
+ attrs = entry.attributes
+ for attrName in attrs.keys():
+ attrNode = attrs.get(attrName)
+ attrValue = attrNode.nodeValue
+ if attrName == 'value':
+ v = attrValue
+ else:
+ continue
+ if v is None:
+ raise Exception, 'invalid listentry'
+ value.append(v)
+ return VariableList(attrs_dir['name'], value, mods, VARIABLE_TYPE_LIST_STR)
+ elif attrs_dir['type'] == VARIABLE_TYPE_LIST_XML:
+ value = []
+ for kid in node.childNodes:
+ if kid.nodeType == xml.dom.Node.ELEMENT_NODE:
+ value.append(kid)#.cloneNode(True))
+ return VariableList(attrs_dir['name'], value, mods, VARIABLE_TYPE_LIST_XML)
+ elif attrs_dir['type'] == VARIABLE_TYPE_XML:
+ for kid in node.childNodes:
+ if kid.nodeType == xml.dom.Node.ELEMENT_NODE:
+ value = kid#.cloneNode(True)
+ break
+ elif attrs_dir['type'] == VARIABLE_TYPE_INT:
+ value = int(attrs_dir['value'])
+ elif attrs_dir['type'] == VARIABLE_TYPE_INT_SEL:
+ value = int(attrs_dir['value'])
+ if 'valid_values' not in mods:
+ raise Exception, 'missing valid_values'
+ elif attrs_dir['type'] == VARIABLE_TYPE_FLOAT:
+ value = float(attrs_dir['value'])
+ elif attrs_dir['type'] == VARIABLE_TYPE_STRING:
+ value = attrs_dir['value']
+ elif attrs_dir['type'] == VARIABLE_TYPE_STRING_SEL:
+ value = attrs_dir['value']
+ if 'valid_values' not in mods:
+ raise Exception, 'missing valid_values'
+ elif attrs_dir['type'] == VARIABLE_TYPE_BOOL:
+ value = (attrs_dir['value'] == 'true')
+ else:
+ raise Exception, 'invalid variable'
+ return Variable(attrs_dir['name'], value, mods)
-class Variable:
- def __init__(self, name, value, mods={}):
- self.__name = str(name)
- self.__mods = mods
- self.__value = None
- self.__type = None
- self.set_value(value)
-
- def get_name(self):
- return self.__name
-
- def get_value(self):
- return self.__value
-
- def set_value(self, value):
- if self.__is_bool(value):
- self.__type = VARIABLE_TYPE_BOOL
- self.__value = value
-
- elif self.__is_int(value):
- self.__type = VARIABLE_TYPE_INT
- self.__value = int(value)
-
- elif self.__is_float(value):
- self.__type = VARIABLE_TYPE_FLOAT
- self.__value = float(value)
-
- elif self.__is_list(value):
- raise Exception, "lists not implemented"
- if self.__is_int(value[0]):
- self.__type = VARIABLE_TYPE_LIST_INT
- self.__value = value
- elif self.__is_string(value[0]):
- self.__type = VARIABLE_TYPE_LIST_STR
- self.__value = value
- else:
- raise Exception, "not valid list type"
- elif self.__is_xml(value):
- self.__type = VARIABLE_TYPE_XML
- self.__value = value
-
- else:
- self.__value = str(value)
- self.__type = VARIABLE_TYPE_STRING
-
- def type(self):
- if 'valid_values' in self.__mods:
- if self.__type == VARIABLE_TYPE_INT:
- return VARIABLE_TYPE_INT_SEL
- elif self.__type == VARIABLE_TYPE_STRING:
- return VARIABLE_TYPE_STRING_SEL
- return self.__type
-
- def get_modifiers(self):
- return self.__mods
- def set_modifier(self, mod_name, mod_value):
- self.__mods[mod_name] = mod_value
- return
-
- def export_xml(self, doc):
- elem = doc.createElement(VARIABLE_TAG)
- elem.setAttribute('name', self.__name)
- elem.setAttribute('type', self.type())
- if not self.__is_list(self.__value):
- if self.__is_bool(self.__value):
- if self.__value:
- elem.setAttribute('value', 'true')
- else:
- elem.setAttribute('value', 'false')
- elif self.__is_xml(self.__value):
- elem.appendChild(self.__value)
- else:
- elem.setAttribute('value', str(self.__value))
- else:
- raise Exception, "lists not implemented"
- l = self.__value
- for i in xrange(len(l)):
- x = l[i]
- e2 = doc.createElement(VARIABLE_TYPE_LISTENTRY)
- e2.setAttribute('type', str(self.__get_type(x)))
- e2.setAttribute('value', str(x))
- e2.setAttribute('list_index', str(i))
- elem.appendChild(e2)
- for mod in self.__mods:
- elem.setAttribute(str(mod), str(self.__mods[mod]))
- return elem
- def __get_type(self, value):
- if self.__is_bool(value):
- return VARIABLE_TYPE_BOOL
- elif self.__is_int(value):
- return VARIABLE_TYPE_INT
- elif self.__is_float(value):
- return VARIABLE_TYPE_FLOAT
- elif self.__is_list(value):
- if self.__is_int(value[0]):
- return VARIABLE_TYPE_LIST_INT
- elif self.__is_string(value[0]):
- return VARIABLE_TYPE_LIST_STR
- else:
- raise Exception, "not valid list type"
- elif self.__is_xml(value):
- return VARIABLE_TYPE_XML
- else:
- return VARIABLE_TYPE_STRING
-
-
-
-
- def __is_xml(self, value):
- try:
- value.toxml()
- return True
- except:
- return False
- def __is_bool(self, value):
- try:
- if value.__class__ == bool().__class__:
- return True
- return False
- except:
- return False
- def __is_int(self, value):
- try:
- int(value)
- return True
- except:
- return False
- def __is_float(self, value):
- try:
- float(value)
- return True
- except:
- return False
- def __is_string(self, var):
- if self.__is_int(var):
- return False
- elif self.__is_float(var):
- return False
- return True
- def __is_list(self, value):
- try:
- if value.__class__ == [].__class__:
- return True
- except:
- pass
- return False
+class Variable:
+ def __init__(self, name, value, mods={}):
+ self.__name = str(name)
+ self.__mods = mods
+ self.__value = None
+ self.__type = None
+ self.set_value(value)
+
+ def get_name(self):
+ return self.__name
+
+ def get_value(self):
+ return self.__value
+
+ def set_value(self, value):
+ if self.__is_bool(value):
+ self.__type = VARIABLE_TYPE_BOOL
+ self.__value = value
+ elif self.__is_int(value):
+ self.__type = VARIABLE_TYPE_INT
+ self.__value = int(value)
+ elif self.__is_float(value):
+ self.__type = VARIABLE_TYPE_FLOAT
+ self.__value = float(value)
+ elif self.__is_list(value):
+ raise Exception, "lists not implemented"
+ if self.__is_int(value[0]):
+ self.__type = VARIABLE_TYPE_LIST_INT
+ self.__value = value
+ elif self.__is_string(value[0]):
+ self.__type = VARIABLE_TYPE_LIST_STR
+ self.__value = value
+ else:
+ raise Exception, "not valid list type"
+ elif self.__is_xml(value):
+ self.__type = VARIABLE_TYPE_XML
+ self.__value = value
+ else:
+ self.__value = str(value)
+ self.__type = VARIABLE_TYPE_STRING
+
+ def type(self):
+ if 'valid_values' in self.__mods:
+ if self.__type == VARIABLE_TYPE_INT:
+ return VARIABLE_TYPE_INT_SEL
+ elif self.__type == VARIABLE_TYPE_STRING:
+ return VARIABLE_TYPE_STRING_SEL
+ return self.__type
+
+ def get_modifiers(self):
+ return self.__mods
+
+ def set_modifier(self, mod_name, mod_value):
+ self.__mods[mod_name] = mod_value
+ return
+
+ def export_xml(self, doc):
+ elem = doc.createElement(VARIABLE_TAG)
+ elem.setAttribute('name', self.__name)
+ elem.setAttribute('type', self.type())
+ if not self.__is_list(self.__value):
+ if self.__is_bool(self.__value):
+ if self.__value:
+ elem.setAttribute('value', 'true')
+ else:
+ elem.setAttribute('value', 'false')
+ elif self.__is_xml(self.__value):
+ elem.appendChild(self.__value)
+ else:
+ elem.setAttribute('value', str(self.__value))
+ else:
+ raise Exception, "lists not implemented"
+ l = self.__value
+ for i in xrange(len(l)):
+ x = l[i]
+ e2 = doc.createElement(VARIABLE_TYPE_LISTENTRY)
+ e2.setAttribute('type', str(self.__get_type(x)))
+ e2.setAttribute('value', str(x))
+ e2.setAttribute('list_index', str(i))
+ elem.appendChild(e2)
+ for mod in self.__mods:
+ elem.setAttribute(str(mod), str(self.__mods[mod]))
+ return elem
+
+ def __get_type(self, value):
+ if self.__is_bool(value):
+ return VARIABLE_TYPE_BOOL
+ elif self.__is_int(value):
+ return VARIABLE_TYPE_INT
+ elif self.__is_float(value):
+ return VARIABLE_TYPE_FLOAT
+ elif self.__is_list(value):
+ if self.__is_int(value[0]):
+ return VARIABLE_TYPE_LIST_INT
+ elif self.__is_string(value[0]):
+ return VARIABLE_TYPE_LIST_STR
+ else:
+ raise Exception, "not valid list type"
+ elif self.__is_xml(value):
+ return VARIABLE_TYPE_XML
+ else:
+ return VARIABLE_TYPE_STRING
+
+ def __is_xml(self, value):
+ try:
+ value.toxml()
+ return True
+ except:
+ return False
+
+ def __is_bool(self, value):
+ try:
+ if value.__class__ == bool().__class__:
+ return True
+ return False
+ except:
+ return False
+
+ def __is_int(self, value):
+ try:
+ int(value)
+ return True
+ except:
+ return False
+
+ def __is_float(self, value):
+ try:
+ float(value)
+ return True
+ except:
+ return False
+
+ def __is_string(self, var):
+ if self.__is_int(var):
+ return False
+ elif self.__is_float(var):
+ return False
+ return True
+
+ def __is_list(self, value):
+ try:
+ if value.__class__ == [].__class__:
+ return True
+ except:
+ pass
+ return False
class VariableList(Variable):
- def __init__(self, name, value, mods, list_type):
- if list_type != VARIABLE_TYPE_LIST_STR and list_type != VARIABLE_TYPE_LIST_XML:
- raise Exception, 'invalid list type'
- #if ! self.__is_list(value):
- # raise Exception, 'value not a list'
- self.__name = name
- self.__mods = mods
- self.__type = list_type
- self.__value = value
-
- def get_name(self):
- return self.__name
-
- def get_value(self):
- return self.__value
- def set_value(self, value):
- raise Exception, 'VariableList.set_value() not implemented'
-
- def type(self):
- return self.__type
-
- def get_modifiers(self):
- return self.__mods
- def set_modifier(self, mod_name, mod_value):
- self.__mods[mod_name] = mod_value
- return
-
- def export_xml(self, doc):
- elem = doc.createElement(VARIABLE_TAG)
- elem.setAttribute('name', self.__name)
- elem.setAttribute('type', self.type())
-
- l = self.get_value()
- for x in l:
- if self.type() == VARIABLE_TYPE_LIST_XML:
- elem.appendChild(x)#.cloneNode(True))
- else:
- e2 = doc.createElement(VARIABLE_TYPE_LISTENTRY)
- e2.setAttribute('value', str(x))
- elem.appendChild(e2)
- for mod in self.__mods:
- elem.setAttribute(str(mod), str(self.__mods[mod]))
- return elem
+ def __init__(self, name, value, mods, list_type):
+ if list_type != VARIABLE_TYPE_LIST_STR and list_type != VARIABLE_TYPE_LIST_XML:
+ raise Exception, 'invalid list type'
+ #if ! self.__is_list(value):
+ # raise Exception, 'value not a list'
+ self.__name = name
+ self.__mods = mods
+ self.__type = list_type
+ self.__value = value
+
+ def get_name(self):
+ return self.__name
+
+ def get_value(self):
+ return self.__value
+
+ def set_value(self, value):
+ raise Exception, 'VariableList.set_value() not implemented'
+
+ def type(self):
+ return self.__type
+
+ def get_modifiers(self):
+ return self.__mods
+
+ def set_modifier(self, mod_name, mod_value):
+ self.__mods[mod_name] = mod_value
+ return
+
+ def export_xml(self, doc):
+ elem = doc.createElement(VARIABLE_TAG)
+ elem.setAttribute('name', self.__name)
+ elem.setAttribute('type', self.type())
+
+ l = self.get_value()
+ for x in l:
+ if self.type() == VARIABLE_TYPE_LIST_XML:
+ elem.appendChild(x)#.cloneNode(True))
+ else:
+ e2 = doc.createElement(VARIABLE_TYPE_LISTENTRY)
+ e2.setAttribute('value', str(x))
+ elem.appendChild(e2)
+ for mod in self.__mods:
+ elem.setAttribute(str(mod), str(self.__mods[mod]))
+ return elem
--- conga/luci/site/luci/Extensions/conga_constants.py 2007/08/08 21:00:07 1.43
+++ conga/luci/site/luci/Extensions/conga_constants.py 2007/09/24 21:19:42 1.44
@@ -122,7 +122,7 @@
START_NODE = 6
RICCI_CONNECT_FAILURE = (-1000)
-RICCI_CONNECT_FAILURE_MSG = 'Currently unable to reach the ricci agent on this node. '
+RICCI_CONNECT_FAILURE_MSG = 'Currently unable to reach the ricci agent on this node. '
# cluster/node create error messages
CLUNODE_CREATE_ERRORS = [
--- conga/luci/site/luci/Extensions/conga_ssl.py 2007/06/25 16:03:39 1.3
+++ conga/luci/site/luci/Extensions/conga_ssl.py 2007/09/24 21:19:42 1.4
@@ -16,36 +16,35 @@
# timeouts are in seconds (int)
class SSLSocket:
+ def __init__(self, hostname, port, timeout):
+ self.__id = -1
+ self.__id = conga_ssl_lib.connect(hostname, port, timeout)
+ self.__hostname = hostname
+
+ def __del__(self):
+ self.disconnect()
+
+ def disconnect(self):
+ if self.__id != -1:
+ conga_ssl_lib.disconnect(self.__id)
+ self.__id = -1
+
+ def peer_fingerprint(self):
+ return conga_ssl_lib.peer_fingerprint(self.__id)
+
+ def trusted(self):
+ return conga_ssl_lib.trusted(self.__id) == 1
+
+ def trust(self):
+ if self.trusted():
+ return True
+ return conga_ssl_lib.trust(self.__id, self.__hostname) == 1
- def __init__(self,
- hostname,
- port,
- timeout):
- self.__id = -1
- self.__id = conga_ssl_lib.connect(hostname, port, timeout)
- self.__hostname = hostname
-
- def __del__(self):
- self.disconnect()
-
- def disconnect(self):
- if self.__id != -1:
- conga_ssl_lib.disconnect(self.__id)
- self.__id = -1
-
- def peer_fingerprint(self):
- return conga_ssl_lib.peer_fingerprint(self.__id)
-
- def trusted(self):
- return conga_ssl_lib.trusted(self.__id) == 1
- def trust(self):
- if self.trusted():
- return True
- return conga_ssl_lib.trust(self.__id, self.__hostname) == 1
- def untrust(self):
- return conga_ssl_lib.untrust(self.__id) == 1
-
- def send(self, msg, timeout):
- conga_ssl_lib.send(self.__id, msg, timeout)
- def recv(self, timeout):
- return conga_ssl_lib.recv(self.__id, timeout)
+ def untrust(self):
+ return conga_ssl_lib.untrust(self.__id) == 1
+
+ def send(self, msg, timeout):
+ conga_ssl_lib.send(self.__id, msg, timeout)
+
+ def recv(self, timeout):
+ return conga_ssl_lib.recv(self.__id, timeout)
--- conga/luci/site/luci/Extensions/conga_storage_constants.py 2007/06/25 16:03:39 1.9
+++ conga/luci/site/luci/Extensions/conga_storage_constants.py 2007/09/24 21:19:42 1.10
@@ -11,174 +11,156 @@
## request vars ##
-PAGETYPE = "pagetype"
-CLUNAME = "clustername"
+PAGETYPE = 'pagetype'
+CLUNAME = 'clustername'
STONAME = 'storagename'
-
-# storage pagetypes #
-
PT_MAPPER_ID = 'mapper_id'
PT_MAPPER_TYPE = 'mapper_type'
PT_PATH = 'bd_path'
-STORAGESYS = "0"
-STORAGE_CONFIG = "43"
-STORAGE = "44"
-CLUSTER_STORAGE = "45"
-
STORAGE_COMMIT_CHANGES = 'commit_changes'
-
-VIEW_MAPPERS = '51'
-VIEW_MAPPER = '52'
-
-VIEW_BDS = '61'
-VIEW_BD = '62'
-
-
-CREATE_MAPPER = '101'
-ADD_SOURCES = '102'
-
-
-
-# pretty names
-
-PRETTY_MAPPER_INFO = {MAPPER_SYS_TYPE : ('Hard Drives', 'Hard Drive', 'BUG: source not defined'),
- MAPPER_VG_TYPE : ('Volume Group', 'Logical Volume', 'Physical Volume'),
- MAPPER_PT_TYPE : ('Partition Table', 'Partition', 'Disk'),
- MAPPER_MDRAID_TYPE : ('Software RAID', 'Volume', 'Disk'),
- MAPPER_ATARAID_TYPE : ('ATA-RAID', 'Volume', 'Disk'),
- MAPPER_MULTIPATH_TYPE : ('Multipath', 'Multipath', 'Path'),
- MAPPER_CRYPTO_TYPE : ('Encryption', 'Volume', 'Device'),
- MAPPER_iSCSI_TYPE : ('iSCSI', 'Volume', 'BUG: source not defined')}
+# storage pagetypes #
+STORAGESYS = '0'
+STORAGE_CONFIG = '43'
+STORAGE = '44'
+CLUSTER_STORAGE = '45'
+VIEW_MAPPERS = '51'
+VIEW_MAPPER = '52'
+VIEW_BDS = '61'
+VIEW_BD = '62'
+CREATE_MAPPER = '101'
+ADD_SOURCES = '102'
+
+# mapper pretty names
+PRETTY_MAPPER_INFO = {
+ MAPPER_SYS_TYPE: ( 'Hard Drives', 'Hard Drive', 'BUG: source not defined' ),
+ MAPPER_VG_TYPE: ( 'Volume Group', 'Logical Volume', 'Physical Volume' ),
+ MAPPER_PT_TYPE: ( 'Partition Table', 'Partition', 'Disk' ),
+ MAPPER_MDRAID_TYPE: ( 'Software RAID', 'Volume', 'Disk' ),
+ MAPPER_ATARAID_TYPE: ( 'ATA-RAID', 'Volume', 'Disk' ),
+ MAPPER_MULTIPATH_TYPE: ( 'Multipath', 'Multipath', 'Path' ),
+ MAPPER_CRYPTO_TYPE: ( 'Encryption', 'Volume', 'Device' ),
+ MAPPER_iSCSI_TYPE: ( 'iSCSI', 'Volume', 'BUG: source not defined' )
+}
def get_pretty_mapper_info(mapper_type):
- try:
- return PRETTY_MAPPER_INFO[mapper_type]
- except:
- return ('Mapper ' + mapper_type, mapper_type + '\s target', mapper_type + '\s source')
-
-PRETTY_PROP_NAMES = {'active' : "Active",
- 'attrs' : 'Attributes',
- 'bd' : "Block Device",
- 'block_count' : "Number of Blocks",
- 'block_size' : "Block Size",
- 'bootable' : "Bootable",
- 'cluster_name' : "Cluster Name",
- 'clustered' : "Clustered",
- 'dir_index' : "Use Hashed Binary Trees",
- 'disklabel' : "Partition Table Type",
- 'extents_free' : "Free Extents",
- 'extent_size' : "Extent Size",
- 'extents_total' : "Total Extents",
- 'extents_used' : "Used Extents",
- 'failed' : "Failed",
- 'format' : "Format",
- 'fstab' : "List in /etc/fstab",
- 'fstabpoint' : "/etc/fstab Mountpoint",
- 'gfs_fsname' : "Unique GFS Name",
- 'has_journal' : "Journaling Enabled - ext3",
- 'journals_num' : "Number Of Journals",
- 'journal_size' : "Journal Size",
- 'label' : "Label",
- 'level' : "Level",
- 'locking_protocol' : "Locking Protocol",
- 'lvname' : "Logical Volume Name",
- 'max_lvs' : "Maximum Logical Volumes",
- 'max_pvs' : "Maximum Physical Volumes",
- 'max_sources' : "Maximum Disks",
- 'min_sources' : "Minimum Disks",
- 'mirrored' : "Mirrored",
- 'model' : "Model",
- 'mount' : "Mount",
- 'mountable' : "Mountable",
- 'mountpoint' : "Mountpoint",
- 'num_devices' : "Number of Devices",
- 'num_spares' : "Number of Spares",
- 'partition_begin' : "Partition Begin",
- 'partition_num' : "Partition Number",
- 'partition_type' : "Partition Type",
- 'path' : "Path",
- 'raid' : "Raid",
- 'raid_level' : "Raid Level",
- 'removable' : "Removable",
- 'scsi_bus' : "SCSI Address",
- 'scsi_id' : "SCSI ID",
- 'size' : "Size",
- 'size_free' : "Unused",
- 'snapshot' : "Snapshot",
- 'snapshot_origin' : "Snapshot Origin",
- 'snapshots' : "Snapshots",
- 'snapshot_usage_percent' : "Snapshot Usage",
- 'state' : "State",
- 'swapon' : "Active Swap",
- 'type' : "Type",
- 'uuid' : "UUID",
- 'vendor' : "Vendor",
- 'vgname' : "Volume Group Name"}
-
-def get_pretty_prop_name(name):
- try:
- return PRETTY_PROP_NAMES[name]
- except:
- return name
-
-PRETTY_FS_NAMES = {'ext' : "Linux Extended FS",
- 'swap' : "Swap",
- 'gfs1' : "GFS1 - Global FS v.1",
- 'gfs2' : "GFS2 - Global FS v.2",
- 'minix' : "Minix FS",
- 'ufs' : "Unix Fast FS",
- 'xfs' : "SGI XFS",
- 'isofs' : "ISO 9660 CD-ROM FS",
- 'cramfs' : "Cram FS",
- 'raiserfs' : "Reiser FS",
- 'jffs' : "Journalled Flash FS v.1",
- 'jffs2' : "Journalled Flash FS v.2",
- 'squashfs' : "Squash FS",
- 'vfat' : "MS vfat FS",
- 'msdos' : "MS-DOS FS",
- 'affs' : "Amiga FS",
- 'befs' : "BeOS FS",
- 'bfs' : "SCO UnixWare BFS",
- 'jfs' : "Journaled Filesystem (JFS)",
- 'efs' : "efs",
- 'freevxfs' : "Veritas Filesystem (VxFS)",
- 'hfsplus' : "Macintosh extended FS",
- 'hfs' : "Macintosh FS",
- 'ncpfs' : "ncpfs",
- 'ocfs2' : "Oracle Clustered FS v.2",
- 'relayfs' : "Relay FS",
- 'udf' : "Universal Disk Format"}
+ return PRETTY_MAPPER_INFO.get(mapper_type) or \
+ ( 'Mapper ' + mapper_type, mapper_type + '\s target', mapper_type + '\s source' )
-def get_pretty_fs_name(name):
- try:
- return PRETTY_FS_NAMES[name]
- except:
- return name
+PRETTY_PROP_NAMES = {
+ 'active': 'Active',
+ 'attrs': 'Attributes',
+ 'bd': 'Block Device',
+ 'block_count': 'Number of Blocks',
+ 'block_size': 'Block Size',
+ 'bootable': 'Bootable',
+ 'cluster_name': 'Cluster Name',
+ 'clustered': 'Clustered',
+ 'dir_index': 'Use Hashed Binary Trees',
+ 'disklabel': 'Partition Table Type',
+ 'extents_free': 'Free Extents',
+ 'extent_size': 'Extent Size',
+ 'extents_total': 'Total Extents',
+ 'extents_used': 'Used Extents',
+ 'failed': 'Failed',
+ 'format': 'Format',
+ 'fstab': 'List in /etc/fstab',
+ 'fstabpoint': '/etc/fstab Mountpoint',
+ 'gfs_fsname': 'Unique GFS Name',
+ 'has_journal': 'Journaling Enabled - ext3',
+ 'journals_num': 'Number of Journals',
+ 'journal_size': 'Journal Size',
+ 'label': 'Label',
+ 'level': 'Level',
+ 'locking_protocol': 'Locking Protocol',
+ 'lvname': 'Logical Volume Name',
+ 'max_lvs': 'Maximum Logical Volumes',
+ 'max_pvs': 'Maximum Physical Volumes',
+ 'max_sources': 'Maximum Disks',
+ 'min_sources': 'Minimum Disks',
+ 'mirrored': 'Mirrored',
+ 'model': 'Model',
+ 'mount': 'Mount',
+ 'mountable': 'Mountable',
+ 'mountpoint': 'Mountpoint',
+ 'num_devices': 'Number of Devices',
+ 'num_spares': 'Number of Spares',
+ 'partition_begin': 'Partition Begin',
+ 'partition_num': 'Partition Number',
+ 'partition_type': 'Partition Type',
+ 'path': 'Path',
+ 'raid': 'Raid',
+ 'raid_level': 'Raid Level',
+ 'removable': 'Removable',
+ 'scsi_bus': 'SCSI Address',
+ 'scsi_id': 'SCSI ID',
+ 'size': 'Size',
+ 'size_free': 'Unused',
+ 'snapshot': 'Snapshot',
+ 'snapshot_origin': 'Snapshot Origin',
+ 'snapshots': 'Snapshots',
+ 'snapshot_usage_percent': 'Snapshot Usage',
+ 'state': 'State',
+ 'swapon': 'Active Swap',
+ 'type': 'Type',
+ 'uuid': 'UUID',
+ 'vendor': 'Vendor',
+ 'vgname': 'Volume Group Name'
+}
+def get_pretty_prop_name(name):
+ return PRETTY_PROP_NAMES.get(name) or name
+PRETTY_FS_NAMES = {
+ 'ext': 'Linux Extended FS',
+ 'swap': 'Swap',
+ 'gfs1': 'GFS1 - Global FS v.1',
+ 'gfs2': 'GFS2 - Global FS v.2',
+ 'minix': 'Minix FS',
+ 'ufs': 'Unix Fast FS',
+ 'xfs': 'SGI XFS',
+ 'isofs': 'ISO 9660 CD-ROM FS',
+ 'cramfs': 'Cram FS',
+ 'reiserfs': 'Reiser FS',
+ 'jffs': 'Journalled Flash FS v.1',
+ 'jffs2': 'Journalled Flash FS v.2',
+ 'squashfs': 'Squash FS',
+ 'vfat': 'MS vfat FS',
+ 'msdos': 'MS-DOS FS',
+ 'affs': 'Amiga FS',
+ 'befs': 'BeOS FS',
+ 'bfs': 'SCO UnixWare BFS',
+ 'jfs': 'Journaled Filesystem (JFS)',
+ 'efs': 'efs',
+ 'freevxfs': 'Veritas Filesystem (VxFS)',
+ 'hfsplus': 'Macintosh extended FS',
+ 'hfs': 'Macintosh FS',
+ 'ncpfs': 'ncpfs',
+ 'ocfs2': 'Oracle Clustered FS v.2',
+ 'relayfs': 'Relay FS',
+ 'udf': 'Universal Disk Format'
+}
+def get_pretty_fs_name(name):
+ return PRETTY_FS_NAMES.get(name) or name
# icons
-
-MAPPER_ICONS = {MAPPER_SYS_TYPE : ('', 'icon_bd_ide.png', ''),
- MAPPER_VG_TYPE : ('icon_mapper_VG.png', 'icon_bd_LV.png', 'icon_content_PV.png'),
- MAPPER_PT_TYPE : ('icon_mapper_PT.png', 'icon_bd_partition.png', ''),
- MAPPER_MDRAID_TYPE : ('icon_mapper_raid.png', 'icon_bd_raid.png', ''),
- MAPPER_ATARAID_TYPE : ('icon_mapper_raid.png', 'icon_bd_raid.png', ''),
- MAPPER_MULTIPATH_TYPE : ('icon_mapper_multipath.png', 'icon_bd_multipath.png', ''),
- MAPPER_CRYPTO_TYPE : ('icon_mapper_crypto.png', 'icon_bd_crypto.png', ''),
- MAPPER_iSCSI_TYPE : ('', 'icon_bd_net.png', '')}
+MAPPER_ICONS = {
+ MAPPER_SYS_TYPE: ( '', 'icon_bd_ide.png', ''),
+ MAPPER_VG_TYPE: ( 'icon_mapper_VG.png', 'icon_bd_LV.png', 'icon_content_PV.png'),
+ MAPPER_PT_TYPE: ( 'icon_mapper_PT.png', 'icon_bd_partition.png', ''),
+ MAPPER_MDRAID_TYPE: ( 'icon_mapper_raid.png', 'icon_bd_raid.png', ''),
+ MAPPER_ATARAID_TYPE: ( 'icon_mapper_raid.png', 'icon_bd_raid.png', ''),
+ MAPPER_MULTIPATH_TYPE: ( 'icon_mapper_multipath.png', 'icon_bd_multipath.png', ''),
+ MAPPER_CRYPTO_TYPE: ( 'icon_mapper_crypto.png', 'icon_bd_crypto.png', ''),
+ MAPPER_iSCSI_TYPE: ( '', 'icon_bd_net.png', '')
+}
def get_mapper_icons(mapper_type):
- try:
- return MAPPER_ICONS[mapper_type]
- except:
- return ('', '', '')
-
+ return MAPPER_ICONS.get(mapper_type) or ('', '', '')
-def get_fs_icon(fstype):
- # all fss have the same icon
- return 'icon_content_FS.png'
+def get_fs_icon(dummy):
+ # all fss have the same icon
+ return 'icon_content_FS.png'
--- conga/luci/site/luci/Extensions/ricci_communicator.py 2007/07/12 22:35:40 1.29
+++ conga/luci/site/luci/Extensions/ricci_communicator.py 2007/09/24 21:19:42 1.30
@@ -21,10 +21,10 @@
self.__hostname = hostname
self.__port = port
- self.__timeout_init = 4
- self.__timeout_auth = 4
+ self.__timeout_init = 4
+ self.__timeout_auth = 4
self.__timeout_short = 6
- self.__timeout_long = 600
+ self.__timeout_long = 600
self.__privkey_file = '%sprivkey.pem' % CERTS_DIR_PATH
self.__cert_file = '%scacert.pem' % CERTS_DIR_PATH
@@ -497,7 +497,7 @@
raise RicciError, 'Not an XML batch node'
total = 0
- last = 0
+ last = 0
for node in batch_xml.childNodes:
if node.nodeType == Node.ELEMENT_NODE:
if node.nodeName == 'module':
@@ -536,8 +536,8 @@
# -1 - undefined error occured (msg not necesarily very informative)
# 0 - no error (msg is empty string)
# >0 - predefined error has occured
-# (check respective API, msg will be fully descriptive)
-# * error_msg: error message
+# (check respective API, msg will be fully descriptive)
+# * error_msg: error message
def extract_module_status(batch_xml, module_num=1):
if batch_xml.nodeName != 'batch':
--- conga/luci/site/luci/Extensions/ricci_defines.py 2007/06/25 16:03:39 1.2
+++ conga/luci/site/luci/Extensions/ricci_defines.py 2007/09/24 21:19:42 1.3
@@ -5,74 +5,64 @@
# GNU General Public License as published by the
# Free Software Foundation.
-REQUEST_TAG = 'request'
-RESPONSE_TAG = 'response'
+REQUEST_TAG = 'request'
+RESPONSE_TAG = 'response'
-FUNC_CALL_TAG = 'function_call'
-FUNC_RESP_TAG = 'function_response'
-SEQUENCE_TAG = 'sequence'
+FUNC_CALL_TAG = 'function_call'
+FUNC_RESP_TAG = 'function_response'
+SEQUENCE_TAG = 'sequence'
+
+VARIABLE_TAG = 'var'
+
+VARIABLE_TYPE_INT = 'int'
+VARIABLE_TYPE_INT_SEL = 'int_select'
+VARIABLE_TYPE_BOOL = 'boolean'
+VARIABLE_TYPE_STRING = 'string'
+VARIABLE_TYPE_STRING_SEL = 'string_select'
+VARIABLE_TYPE_XML = 'xml'
+
+VARIABLE_TYPE_LIST_INT = 'list_int'
+VARIABLE_TYPE_LIST_STR = 'list_str'
+VARIABLE_TYPE_LIST_XML = 'list_xml'
+
+VARIABLE_TYPE_LISTENTRY = 'listentry'
+VARIABLE_TYPE_FLOAT = 'float'
+
+BD_TYPE = 'block_device'
+BD_HD_TYPE = 'hard_drive'
+BD_LV_TYPE = 'logical_volume'
+BD_PARTITION_TYPE = 'partition'
+
+BD_TEMPLATE = 'block_device_template'
+
+MAPPER_TYPE = 'mapper'
+MAPPER_SYS_TYPE = 'hard_drives'
+MAPPER_VG_TYPE = 'volume_group'
+MAPPER_PT_TYPE = 'partition_table'
+MAPPER_MDRAID_TYPE = 'mdraid'
+MAPPER_ATARAID_TYPE = 'ataraid'
+MAPPER_MULTIPATH_TYPE = 'multipath'
+MAPPER_CRYPTO_TYPE = 'crypto'
+MAPPER_iSCSI_TYPE = 'iSCSI'
+
+SYSTEM_PREFIX = ':%s' % MAPPER_SYS_TYPE
+VG_PREFIX = ':%s' % MAPPER_VG_TYPE
+PT_PREFIX = ':%s' % MAPPER_PT_TYPE
+MDRAID_PREFIX = ':%s' % MAPPER_MDRAID_TYPE
+
+MAPPER_SOURCES_TAG = 'sources'
+MAPPER_TARGETS_TAG = 'targets'
+MAPPER_MAPPINGS_TAG = 'mappings'
+MAPPER_NEW_SOURCES_TAG = 'new_sources'
+MAPPER_NEW_TARGETS_TAG = 'new_targets'
+
+CONTENT_TYPE = 'content'
+CONTENT_FS_TYPE = 'filesystem'
+CONTENT_NONE_TYPE = 'none'
+CONTENT_MS_TYPE = 'mapper_source'
+CONTENT_HIDDEN_TYPE = 'hidden'
-VARIABLE_TAG = 'var'
+SOURCE_PV_TYPE = 'physical_volume'
+SOURCE_PT_TYPE = 'partition_table_source'
-VARIABLE_TYPE_INT = 'int'
-VARIABLE_TYPE_INT_SEL = 'int_select'
-VARIABLE_TYPE_BOOL = 'boolean'
-VARIABLE_TYPE_STRING = 'string'
-VARIABLE_TYPE_STRING_SEL = 'string_select'
-VARIABLE_TYPE_XML = 'xml'
-
-VARIABLE_TYPE_LIST_INT = 'list_int'
-VARIABLE_TYPE_LIST_STR = 'list_str'
-VARIABLE_TYPE_LIST_XML = 'list_xml'
-
-VARIABLE_TYPE_LISTENTRY = 'listentry'
-VARIABLE_TYPE_FLOAT = 'float'
-
-
-BD_TYPE = 'block_device'
-BD_HD_TYPE = 'hard_drive'
-BD_LV_TYPE = 'logical_volume'
-BD_PARTITION_TYPE = 'partition'
-
-BD_TEMPLATE = 'block_device_template'
-
-
-MAPPER_TYPE = 'mapper'
-MAPPER_SYS_TYPE = 'hard_drives'
-MAPPER_VG_TYPE = 'volume_group'
-MAPPER_PT_TYPE = 'partition_table'
-MAPPER_MDRAID_TYPE = 'mdraid'
-MAPPER_ATARAID_TYPE = 'ataraid'
-MAPPER_MULTIPATH_TYPE = 'multipath'
-MAPPER_CRYPTO_TYPE = 'crypto'
-MAPPER_iSCSI_TYPE = 'iSCSI'
-
-
-SYSTEM_PREFIX = ':%s' % MAPPER_SYS_TYPE
-VG_PREFIX = ':%s' % MAPPER_VG_TYPE
-PT_PREFIX = ':%s' % MAPPER_PT_TYPE
-MDRAID_PREFIX = ':%s' % MAPPER_MDRAID_TYPE
-
-
-MAPPER_SOURCES_TAG = 'sources'
-MAPPER_TARGETS_TAG = 'targets'
-MAPPER_MAPPINGS_TAG = 'mappings'
-MAPPER_NEW_SOURCES_TAG = 'new_sources'
-MAPPER_NEW_TARGETS_TAG = 'new_targets'
-
-
-
-CONTENT_TYPE = 'content'
-CONTENT_FS_TYPE = 'filesystem'
-CONTENT_NONE_TYPE = 'none'
-CONTENT_MS_TYPE = 'mapper_source'
-CONTENT_HIDDEN_TYPE = 'hidden'
-
-
-
-SOURCE_PV_TYPE = 'physical_volume'
-SOURCE_PT_TYPE = 'partition_table_source'
-
-
-
-PROPS_TAG = 'properties'
+PROPS_TAG = 'properties'
--- conga/luci/site/luci/Extensions/storage_adapters.py 2007/09/24 19:48:34 1.12
+++ conga/luci/site/luci/Extensions/storage_adapters.py 2007/09/24 21:19:42 1.13
@@ -136,7 +136,7 @@
srs_p['absolute_url'] = '%s?%s=%s&%s=%s&%s=%s' \
% (url, PAGETYPE, VIEW_MAPPERS, STONAME, hostname, PT_MAPPER_TYPE, mapper_type)
srs_p['Description'] = pretty_names_desc
- if pagetype_req in [ VIEW_MAPPERS, VIEW_MAPPER, ADD_SOURCES, CREATE_MAPPER, VIEW_BD ] and mapper_type_req == mapper_type:
+ if pagetype_req in ( VIEW_MAPPERS, VIEW_MAPPER, ADD_SOURCES, CREATE_MAPPER, VIEW_BD ) and mapper_type_req == mapper_type:
srs_p['show_children'] = True
else:
srs_p['show_children'] = False
@@ -181,7 +181,7 @@
% (url, PAGETYPE, VIEW_MAPPER, STONAME, hostname, PT_MAPPER_TYPE, mapper_type, PT_MAPPER_ID, sr_id)
sr['Description'] = pretty_name_desc
- if pagetype_req in [ VIEW_MAPPER, ADD_SOURCES, VIEW_BD ] and mapper_id_req == sr_id:
+ if pagetype_req in ( VIEW_MAPPER, ADD_SOURCES, VIEW_BD ) and mapper_id_req == sr_id:
sr['currentItem'] = True
else:
sr['currentItem'] = False
More information about the Cluster-devel
mailing list