r5243 - in trunk/cumin/python/cumin: . messaging
by tmckay@fedoraproject.org
Author: tmckay
Date: 2012-03-06 18:11:26 +0000 (Tue, 06 Mar 2012)
New Revision: 5243
Modified:
trunk/cumin/python/cumin/messaging/broker.py
trunk/cumin/python/cumin/messaging/brokergroup.py
trunk/cumin/python/cumin/widgets.py
Log:
Dead code removal.
Remove class BrokerGroupInput, BrokerSetEngroupForm, BrokerGroupInputSet
Modified: trunk/cumin/python/cumin/messaging/broker.py
===================================================================
--- trunk/cumin/python/cumin/messaging/broker.py 2012-03-06 18:09:23 UTC (rev 5242)
+++ trunk/cumin/python/cumin/messaging/broker.py 2012-03-06 18:11:26 UTC (rev 5243)
@@ -264,45 +264,6 @@
return fmt_link(href, name, class_)
-# XXX
-
-from brokergroup import BrokerGroupInputSet
-class BrokerSetEngroupForm(CuminTaskForm):
- def __init__(self, app, name, task):
- super(BrokerSetEngroupForm, self).__init__(app, name, task)
-
- item = BrokerParameter(app, "item")
- self.object = ListParameter(app, "broker", item)
- self.add_parameter(self.object)
-
- self.__groups = BrokerGroupInputSet(app, "group")
- self.add_child(self.__groups)
-
- def render_content(self, session):
- obj = self.object.get(session)
- if len(obj) == 0:
- return "Please select one or more brokers first"
- else:
- return "%s?%s" % (self.task.get_description(session, obj),
- self.__groups.render(session))
-
- def do_process(self, session):
- super(BrokerSetEngroupForm, self).do_process(session)
- # initialize which groups are already checked
- # for this set of brokers
- brokers = self.object.get(session)
- broker_ids = [x.id for x in brokers]
- mappings = BrokerGroupMapping.select()
- groups = [BrokerGroup.get(x.brokerGroupID) for x in mappings if x.brokerID in broker_ids]
- self.__groups.param.set(session, groups)
-
- def process_submit(self, session):
- brokers = self.object.get(session)
- groups = self.__groups.get(session)
- if len(brokers):
- self.task.invoke(session, brokers, groups)
- self.task.exit_with_redirect(session)
-
class TopBrokerSet(CuminTable):
def __init__(self, app, name):
super(TopBrokerSet, self).__init__(app, name)
Modified: trunk/cumin/python/cumin/messaging/brokergroup.py
===================================================================
--- trunk/cumin/python/cumin/messaging/brokergroup.py 2012-03-06 18:09:23 UTC (rev 5242)
+++ trunk/cumin/python/cumin/messaging/brokergroup.py 2012-03-06 18:11:26 UTC (rev 5243)
@@ -52,27 +52,6 @@
invoc.end()
-class BrokerGroupInputSet(CheckboxInputSet):
- def __init__(self, app, name):
- super(BrokerGroupInputSet, self).__init__(app, name, None)
-
- item = BrokerGroupParameter(app, "item")
- self.param = ListParameter(app, "param", item)
- self.add_parameter(self.param)
-
- def do_get_items(self, session, *args):
- return BrokerGroup.select()
-
- def render_item_value(self, session, group):
- return group.id
-
- def render_item_content(self, session, group):
- return group.name
-
- def render_item_checked_attr(self, session, group):
- if group in self.param.get(session):
- return "checked=\"checked\""
-
class BrokerGroupFrame(ObjectFrame):
def __init__(self, app, name):
cls = app.model.com_redhat_cumin.BrokerGroup
Modified: trunk/cumin/python/cumin/widgets.py
===================================================================
--- trunk/cumin/python/cumin/widgets.py 2012-03-06 18:09:23 UTC (rev 5242)
+++ trunk/cumin/python/cumin/widgets.py 2012-03-06 18:11:26 UTC (rev 5243)
@@ -810,23 +810,6 @@
def get_bounds(self, session):
return self.paginator.get_bounds(session)
-class BrokerGroupInput(OptionInputSet):
- def __init__(self, app, name):
- super(BrokerGroupInput, self).__init__(app, name, None)
-
- self.param = BrokerGroupParameter(app, "param")
- self.add_parameter(self.param)
-
- def do_get_items(self, session):
- return []
- #return list(BrokerGroup.select()) #XXX avoid list()ing this?
-
- def render_item_value(self, session, group):
- return group.id
-
- def render_item_content(self, session, group):
- return group.name
-
class CheckboxInputColumn(FormInput, ItemTableColumn):
def __init__(self, app, name, item_param):
super(CheckboxInputColumn, self).__init__(app, name, None)
12 years, 2 months
r5242 - trunk/cumin/python/cumin/messaging
by tmckay@fedoraproject.org
Author: tmckay
Date: 2012-03-06 18:09:23 +0000 (Tue, 06 Mar 2012)
New Revision: 5242
Modified:
trunk/cumin/python/cumin/messaging/exchange.py
Log:
Dead code removal.
Remove class ExchangeInputSet
Modified: trunk/cumin/python/cumin/messaging/exchange.py
===================================================================
--- trunk/cumin/python/cumin/messaging/exchange.py 2012-03-06 18:06:10 UTC (rev 5241)
+++ trunk/cumin/python/cumin/messaging/exchange.py 2012-03-06 18:09:23 UTC (rev 5242)
@@ -115,26 +115,6 @@
self.enable_csv_export(exchange)
-class ExchangeInputSet(RadioInputSet):
- def __init__(self, app, name):
- super(ExchangeInputSet, self).__init__(app, name)
-
- param = ExchangeParameter(app, "param")
- self.add_parameter(param)
- self.set_parameter(param)
-
- def do_get_items(self, session, vhost):
- return sorted_by(vhost.exchanges)
-
- def render_item_value(self, session, exchange):
- return exchange.id
-
- def render_item_content(self, session, exchange):
- return xml_escape(exchange.name) or "<em>Default</em>"
-
- def render_item_checked_attr(self, session, exchange):
- return exchange is self.param.get(session) and "checked=\"checked\""
-
class ExchangeTypeField(RadioItemSetField):
def __init__(self, app, name):
param = SymbolParameter(app, "param")
12 years, 2 months
r5241 - trunk/wooly/python/wooly
by tmckay@fedoraproject.org
Author: tmckay
Date: 2012-03-06 18:06:10 +0000 (Tue, 06 Mar 2012)
New Revision: 5241
Modified:
trunk/wooly/python/wooly/table.py
Log:
Dead code removal.
Remove class NewCheckboxColumn
Modified: trunk/wooly/python/wooly/table.py
===================================================================
--- trunk/wooly/python/wooly/table.py 2012-03-06 18:00:06 UTC (rev 5240)
+++ trunk/wooly/python/wooly/table.py 2012-03-06 18:06:10 UTC (rev 5241)
@@ -303,29 +303,6 @@
def render_href(self, session, record):
return self.parent.render_cell_href(session, record)
-class NewCheckboxColumn(TableColumn):
- def __init__(self, app, name):
- super(NewCheckboxColumn, self).__init__(app, name)
-
- #self.selection = selection # XXX huh?
-
- self.header = CheckboxColumnHeader(app, "header")
- self.replace_child(self.header)
-
- #self.cell = CheckboxColumnCell(app, "cell", selection)
- #self.replace_child(self.cell)
-
- self.sortable = False
- self.width = "1%"
-
- def init(self):
- super(NewCheckboxColumn, self).init()
-
- assert self.selection, self
-
- def render_cell_value(self, session, record):
- pass
-
class CheckboxColumnHeader(TableColumnHeader):
def render_name(self, session):
return self.parent.selection.path
12 years, 2 months
r5240 - trunk/cumin/python/cumin/grid
by tmckay@fedoraproject.org
Author: tmckay
Date: 2012-03-06 18:00:06 +0000 (Tue, 06 Mar 2012)
New Revision: 5240
Modified:
trunk/cumin/python/cumin/grid/submission.py
Log:
Dead code removal.
Remove class TemplateField
Modified: trunk/cumin/python/cumin/grid/submission.py
===================================================================
--- trunk/cumin/python/cumin/grid/submission.py 2012-03-06 16:36:12 UTC (rev 5239)
+++ trunk/cumin/python/cumin/grid/submission.py 2012-03-06 18:00:06 UTC (rev 5240)
@@ -543,29 +543,6 @@
self.task.exit_with_redirect(session, scheduler)
- class TemplateField(FormField):
- def __init__(self, app, name):
- super(JobSubmitForm.TemplateField, self).__init__(app, name)
-
- param = Parameter(app, "param")
- self.add_parameter(param)
-
- self.input = self.TemplateSet(app, "inputs", param)
- self.add_child(self.input)
-
- def render_title(self, session):
- return "Template"
-
- class TemplateSet(OptionInputSet):
- def do_get_items(self, session):
- return ("Standard scene render", "Experimental")
-
- def render_item_value(self, session, item):
- return item
-
- def render_item_content(self, session, item):
- return item
-
class CommandField(MultilineStringField):
def render_title(self, session):
return "Command"
12 years, 2 months
r5239 - trunk/cumin/python/cumin/grid
by tmckay@fedoraproject.org
Author: tmckay
Date: 2012-03-06 16:36:12 +0000 (Tue, 06 Mar 2012)
New Revision: 5239
Modified:
trunk/cumin/python/cumin/grid/tags.py
Log:
Dead code removal.
Remove class TagSelectField
Modified: trunk/cumin/python/cumin/grid/tags.py
===================================================================
--- trunk/cumin/python/cumin/grid/tags.py 2012-03-06 15:16:02 UTC (rev 5238)
+++ trunk/cumin/python/cumin/grid/tags.py 2012-03-06 16:36:12 UTC (rev 5239)
@@ -580,55 +580,6 @@
def render_form_class(self, session):
return " ".join((super(RemoveTags, self).render_form_class(session), "mform"))
-class TagSelectField(FormField):
- '''
- This specialized FormField can be used to give the user a text box
- such that when the user enters text, they will be greeted with
- a set of tags that match their text entry, or "No matches"
-
- **** If we decide against this sort of interface, this class can be removed
- '''
- def __init__(self, app, name, form, param):
- super(TagSelectField, self).__init__(app, name)
-
- self.org_param = param
- self.param = self.TagSearchInputSet(app, "tag_set", param)
- self.add_child(self.param)
-
- def get(self, session):
- return self.org_param.get(session)
-
- def render_title(self, session):
- return "Tag"
-
- def render_inputs(self, session):
- return self.param.render(session)
-
- def validate(self, session):
- if self.required:
- val = self.get(session)
- if not val:
- error = FormError("The %s is required" % self.render_title(session))
- self.form.errors.add(session, error)
-
- class TagSearchInputSet(IncrementalSearchInput):
- def do_get_items(self, session):
- items = fetchItems(self, session, WBTypes.TAGS)
- tags_string = ""
- tags = list()
-
- for i, tag in enumerate(items):
- tags.append(str(tag))
-
- return tags
-
- def render_item_content(self, session, tag):
- return tag or "<em>Default</em>"
-
- def render_item_value(self, session, tag):
- return tag
-
-
class EditNodeTagsForm(ObjectFrameTaskForm):
'''
This form is designed to allow the editing of tags for any single node
12 years, 2 months
r5238 - in trunk: cumin/python/cumin cumin/python/cumin/grid cumin/python/cumin/inventory cumin/python/cumin/messaging rosemary/python/rosemary wooly/python/wooly
by tmckay@fedoraproject.org
Author: tmckay
Date: 2012-03-06 15:16:02 +0000 (Tue, 06 Mar 2012)
New Revision: 5238
Modified:
trunk/cumin/python/cumin/grid/dashboard.py
trunk/cumin/python/cumin/grid/job.py
trunk/cumin/python/cumin/grid/limit.py
trunk/cumin/python/cumin/grid/negotiator.py
trunk/cumin/python/cumin/grid/quota.py
trunk/cumin/python/cumin/grid/scheduler.py
trunk/cumin/python/cumin/grid/submission.py
trunk/cumin/python/cumin/grid/tags.py
trunk/cumin/python/cumin/inventory/system.py
trunk/cumin/python/cumin/messaging/binding.py
trunk/cumin/python/cumin/messaging/brokerlink.py
trunk/cumin/python/cumin/messaging/connection.py
trunk/cumin/python/cumin/messaging/exchange.py
trunk/cumin/python/cumin/messaging/queue.py
trunk/cumin/python/cumin/model.py
trunk/cumin/python/cumin/objectframe.py
trunk/cumin/python/cumin/objectselector.py
trunk/cumin/python/cumin/stat.py
trunk/cumin/python/cumin/util.py
trunk/cumin/python/cumin/widgets.py
trunk/rosemary/python/rosemary/model.py
trunk/wooly/python/wooly/table.py
trunk/wooly/python/wooly/util.py
trunk/wooly/python/wooly/widgets.py
Log:
Add xml_escape calls around all entities that are displayed on screen when values originate from forms or from data
sources outside of Cumin source code.
BZ438142
Modified: trunk/cumin/python/cumin/grid/dashboard.py
===================================================================
--- trunk/cumin/python/cumin/grid/dashboard.py 2012-03-05 19:28:47 UTC (rev 5237)
+++ trunk/cumin/python/cumin/grid/dashboard.py 2012-03-06 15:16:02 UTC (rev 5238)
@@ -15,7 +15,7 @@
from cumin.objectselector import ObjectSelector, MonitorSelfStatColumn, ObjectTableColumn, ObjectTable,\
ObjectLinkColumn, CsvStatsExporter, ExportButton, MonitorSelfAgeColumn
from cumin.parameters import YoungestAttribute
-from cumin.util import rgb_to_string
+from cumin.util import rgb_to_string, xml_escape
strings = StringCatalog(__file__)
log = logging.getLogger("cumin.dashboard")
@@ -566,10 +566,11 @@
def get_item_unit(self, session, item):
return item.unit
- def render_formatted_value(self, session, item, value):
+ def render_formatted_value(self, session, item, value, escape=False):
if item is self.PERCENT_COLUMN:
return "%0.02f%%" % value
- return super(DashboardCapacitySlotSummary, self).render_formatted_value(session, item, value)
+ return super(DashboardCapacitySlotSummary,
+ self).render_formatted_value(session, item, value, escape)
def render_html_title(self, session, item):
if item is self.PERCENT_COLUMN:
@@ -716,7 +717,7 @@
return record[1]
def render_item_value(self, session, item):
- return self.get_item_value(session, item)
+ return xml_escape(self.get_item_value(session, item))
def render_html_title(self, session, item):
(_, (name, value)) = item
Modified: trunk/cumin/python/cumin/grid/job.py
===================================================================
--- trunk/cumin/python/cumin/grid/job.py 2012-03-05 19:28:47 UTC (rev 5237)
+++ trunk/cumin/python/cumin/grid/job.py 2012-03-06 15:16:02 UTC (rev 5238)
@@ -14,7 +14,8 @@
from cumin.formats import fmt_datetime, fmt_link
from wooly import Widget, Parameter, Attribute
-from wooly.util import StringCatalog, Writer, escape_amp, escape_entity
+from wooly.util import StringCatalog, Writer, escape_amp, escape_entity,\
+ xml_escape
from wooly.forms import Form, FormButton, StringField
from wooly.widgets import ModeSet, PropertySet, TemplateRenderer, Notice
from wooly.template import WidgetTemplate
@@ -325,7 +326,7 @@
def get_item_content(self, session, item):
# item here is the unicode job id
- return item
+ return xml_escape(item)
class JobSelectionHold(JobObjectSelectorTask):
def __init__(self, app, selector, verb):
Modified: trunk/cumin/python/cumin/grid/limit.py
===================================================================
--- trunk/cumin/python/cumin/grid/limit.py 2012-03-05 19:28:47 UTC (rev 5237)
+++ trunk/cumin/python/cumin/grid/limit.py 2012-03-06 15:16:02 UTC (rev 5238)
@@ -79,7 +79,11 @@
def render_text_align(self, session):
return "right"
- class MaxColumn(ObjectTableColumn):
+ class MaxColumn(ObjectTableColumn):
+ def __init__(self, app, name, attr):
+ super(LimitTable.MaxColumn, self).__init__(app, name, attr)
+ self.do_escape = False
+
def render_text_align(self, session):
return "right"
Modified: trunk/cumin/python/cumin/grid/negotiator.py
===================================================================
--- trunk/cumin/python/cumin/grid/negotiator.py 2012-03-05 19:28:47 UTC (rev 5237)
+++ trunk/cumin/python/cumin/grid/negotiator.py 2012-03-06 15:16:02 UTC (rev 5238)
@@ -185,8 +185,11 @@
info = self.get_config_for_groups(session, config, [group])
return info[group][config]
except:
- return "<em>loading</em>"
+ return self.loading_indicator()
+ def loading_indicator(self):
+ return "<em>loading</em>"
+
def get_unclaimed_dyn_quota(self, session, groups):
info = self.get_config_info(session)
total = 0.0
Modified: trunk/cumin/python/cumin/grid/quota.py
===================================================================
--- trunk/cumin/python/cumin/grid/quota.py 2012-03-05 19:28:47 UTC (rev 5237)
+++ trunk/cumin/python/cumin/grid/quota.py 2012-03-06 15:16:02 UTC (rev 5238)
@@ -7,6 +7,7 @@
ObjectQmfTable
from cumin.qmfadapter import ObjectQmfAdapter
from cumin.widgets import StaticColumnHeader
+from cumin.util import xml_escape
from wooly.template import WidgetTemplate
from wooly.util import StringCatalog, Writer
@@ -29,6 +30,7 @@
self.negotiator = negotiator
self.task = task
self.user_task = None
+ self.do_escape = False
def render_title(self, session, *args):
return self.title
@@ -176,6 +178,7 @@
self.expand = expand
self.group_helper = group_helper
+ self.do_escape = False
def get_class_list(self, session):
return ["expand"]
@@ -225,6 +228,10 @@
self.header = StaticColumnHeader(app, "header")
self.replace_child(self.header)
+ # Turn off escape in the parent because although we
+ # have to escape here, it's based on context
+ self.do_escape = False
+
def render_cell_content(self, session, group):
if session.page == self.app.export_page:
return group
@@ -234,16 +241,17 @@
parts = group.split('.')
indent = len(parts) - 1
user = parts[indent]
- return "<span style='padding-left: %dem;'>%s</span>" % (indent, user)
+ return "<span style='padding-left: %dem;'>%s</span>" %\
+ (indent, xml_escape(user))
- return group
+ return xml_escape(group)
class DynamicColumn(QmfGroupColumn):
def __init__(self, app, name, attr, getter, negotiator, task, group_helper):
super(QuotaSelector.DynamicColumn, self).__init__(app, name, attr, getter, negotiator, task)
self.group_helper = group_helper
-
+
def render_cell_content(self, session, group):
value = self.group_helper.get_config_value(session, group, "GROUP_QUOTA_DYNAMIC")
self.task.form.group_leader.set(session, group)
@@ -251,11 +259,13 @@
try:
fval = float(value)
except ValueError:
- return value
+ if value == self.group_helper.loading_indicator():
+ return value
+ return xml_escape(value)
except:
if isinstance(value, Exception):
content = "<span class='QuotaError'>error</span>"
- val = len(value.args) > 0 and value.args[0] or ""
+ val = len(value.args) > 0 and xml_escape(value.args[0]) or ""
if session.page == self.app.export_page:
return val
return fmt_link("#", content, "", "", val)
@@ -282,18 +292,19 @@
try:
fval = float(value)
except ValueError:
- return value
+ if value == self.group_helper.loading_indicator():
+ return value
+ return xml_escape(value)
except:
if isinstance(value, Exception):
content = "<span class='QuotaError'>error</span>"
- val = len(value.args) > 0 and value.args[0] or ""
+ val = len(value.args) > 0 and xml_escape(value.args[0]) or ""
if session.page == self.app.export_page:
return val
return fmt_link("#", content, "", "", val)
if session.page == self.app.export_page:
return value
-
content = "%s" % str(round(fval, 2))
return content
Modified: trunk/cumin/python/cumin/grid/scheduler.py
===================================================================
--- trunk/cumin/python/cumin/grid/scheduler.py 2012-03-05 19:28:47 UTC (rev 5237)
+++ trunk/cumin/python/cumin/grid/scheduler.py 2012-03-06 15:16:02 UTC (rev 5238)
@@ -123,7 +123,7 @@
"MonitorSelfImageSize","MonitorSelfRegisteredSocketCount",
"MonitorSelfResidentSetSize","MonitorSelfTime")
- def render_formatted_value(self, session, item, value):
+ def render_formatted_value(self, session, item, value, escape=False):
def fmt_b(value):
return value is not None and fmt_bytes(value) or None
@@ -147,14 +147,14 @@
elif format == "KiB":
return fmt_kb(value)
name = self.get_item_name(session, item)
- # Since condor.xml doesn't have a unit for this, we will improvise a bit.
- # In a perfect world, this might use the same Rosemary code that Negotiator uses
+ # Since condor.xml doesn't have a unit for this, we improvise a bit.
+ # This could perhaps use the same Rosemary code as Negotiator.
if(name in ["MonitorSelfAge"]):
return fmt_timestamp_ddhhmmss(value)
except:
pass
- return CuminStatistic.fmt_value(value)
+ return CuminStatistic.fmt_value(value, escape)
def get_item_name(self, session, item):
the_item, _ = item
Modified: trunk/cumin/python/cumin/grid/submission.py
===================================================================
--- trunk/cumin/python/cumin/grid/submission.py 2012-03-05 19:28:47 UTC (rev 5237)
+++ trunk/cumin/python/cumin/grid/submission.py 2012-03-06 15:16:02 UTC (rev 5238)
@@ -10,6 +10,7 @@
ObjectTableColumn, ObjectTable
from cumin.task import TaskLink, Task, ObjectTaskForm
from cumin.parameters import ObjectAttribute
+from cumin.util import xml_escape
from rosemary.sqlfilter import SqlFilter
from rosemary.sqlquery import SqlInnerJoin
@@ -60,7 +61,7 @@
def render_auxtitle(self, session):
sch = self.get_scheduler(session)
- return "Scheduler '%s'" % sch.Name
+ return "Scheduler '%s'" % xml_escape(sch.Name)
class SubmissionData(ObjectSqlAdapter):
def __init__(self, app):
@@ -215,7 +216,7 @@
def render_help(self, session):
return "This text will identify the submission"
-
+
def validate(self, session):
super(JobDescriptionField, self).validate(session)
@@ -224,6 +225,10 @@
error = FormError("Double quotes are not allowed in submission descriptions")
self.form.errors.add(session, error)
+ elif xml_escape(des) != des:
+ error = FormError("XML special characters are not allowed in submission descriptions")
+ self.form.errors.add(session, error)
+
class JobSchedulerField(ScalarField):
def __init__(self, app, name):
super(JobSchedulerField, self).__init__(app, name, None)
@@ -281,7 +286,7 @@
return item._id
def render_item_content(self, session, item):
- return item.Name
+ return xml_escape(item.Name)
def render_item_selected_attr(self, session, item):
if item._id == self.param.get(session):
Modified: trunk/cumin/python/cumin/grid/tags.py
===================================================================
--- trunk/cumin/python/cumin/grid/tags.py 2012-03-05 19:28:47 UTC (rev 5237)
+++ trunk/cumin/python/cumin/grid/tags.py 2012-03-06 15:16:02 UTC (rev 5238)
@@ -18,6 +18,7 @@
from cumin.task import TaskLink, Task, ObjectTaskForm
from cumin.widgets import *
from cumin.stat import *
+from cumin.util import xml_escape
from sage.wallaby.wallabyoperations import WallabyOperations, WBTypes
from sage.util import *
@@ -103,7 +104,10 @@
wallaby_features = self.app.wallaby.get_data(WBTypes.FEATURES)
for i, tag in enumerate(wallaby_tags):
- data.append({'Tag':str(escape_entity(tag.name)), 'Features':", ".join(tag.features), 'NumHosts':len(self.app.wallaby.get_node_names(tag)), 'Host':self.app.wallaby.get_node_names(tag)} )
+ data.append({'Tag':str(escape_entity(tag.name)),
+ 'Features':", ".join(tag.features),
+ 'NumHosts':len(self.app.wallaby.get_node_names(tag)),
+ 'Host':self.app.wallaby.get_node_names(tag)} )
except:
log.debug("Problem adapting wallaby response", exc_info=True)
@@ -117,7 +121,10 @@
if results:
for result in results:
#Tag goes in the 0 and 1 column, 0 for checkbox value, 1 for the column value
- records.append([result['Tag'], result['Tag'], result['Features'], result['NumHosts'], result['Host']])
+ records.append([result['Tag'],
+ result['Tag'],
+ result['Features'],
+ result['NumHosts'], result['Host']])
return records
@@ -139,7 +146,9 @@
wallaby_nodes = self.app.wallaby.get_data(WBTypes.NODES)
data = []
for i, node in enumerate(wallaby_nodes):
- data.append({'Host':node.name, 'Tags':self.app.wallaby.get_tag_names(node), 'Checkin':node.last_checkin})
+ data.append({'Host':node.name,
+ 'Tags':self.app.wallaby.get_tag_names(node),
+ 'Checkin':node.last_checkin})
return data
@@ -161,7 +170,7 @@
def render_title(self, session):
obj = self.object.get(session)
if obj is not None:
- return obj.name
+ return xml_escape(obj.name)
else:
return ""
@@ -243,7 +252,7 @@
retval = ""
try:
obj = self.tag.get(session)
- retval = ", ".join(self.app.wallaby.get_node_names(obj))
+ retval = xml_escape(", ".join(self.app.wallaby.get_node_names(obj)))
except Exception, e:
log.debug("Exception in rendering tag hosts, tags probably not loaded yet: %s", e.message)
return retval
@@ -252,7 +261,7 @@
retval = ""
try:
obj = self.tag.get(session)
- retval = ", ".join(obj.features)
+ retval = xml_escape(", ".join(obj.features))
except Exception, e:
log.debug("Exception in rendering tag features, tags probably not loaded yet: %s", e.message)
return retval
@@ -278,7 +287,7 @@
def get_title(self, session):
retval = ""
try:
- retval = "Tag '%s'" % self.object.get(session).name
+ retval = "Tag '%s'" % xml_escape(self.object.get(session).name)
except Exception, e:
pass
return retval
@@ -338,10 +347,10 @@
def render_cell_content(self, session, data):
feature_list = data[2]
features = truncate_text(feature_list, 70, True)
- return features
+ return features
def render_cell_title(self, session, data):
- return data[2]
+ return data[2]
class HostCountColumn(ObjectTableColumn):
def render_cell_content(self, session, data):
@@ -861,7 +870,7 @@
if not value or value =="":
value = "No hosts currently selected"
value = truncate_text(value, 50, True)
- return value
+ return xml_escape(value)
def render_title(self, session):
return "Current hosts"
@@ -980,7 +989,7 @@
value = ""
tag_obj = self.app.wallaby.get_tag_by_name(tag)
if tag_obj is not None:
- value = ", ".join(tag_obj.features)
+ value = xml_escape(", ".join(tag_obj.features))
if not value or value == "":
value = "No features currently selected"
value = truncate_text(value, 50, True)
@@ -1265,7 +1274,7 @@
log.debug("Remove node tags failed", exc_info=True)
def get_item_content(self, session, item):
- return item
+ return xml_escape(item)
def fetchItems(self, session, type):
'''
@@ -1275,7 +1284,7 @@
item_list = list()
for item in wallaby_items:
- item_list.append(str(item.name))
+ item_list.append(xml_escape(str(item.name)))
item_list.sort()
return item_list
Modified: trunk/cumin/python/cumin/inventory/system.py
===================================================================
--- trunk/cumin/python/cumin/inventory/system.py 2012-03-05 19:28:47 UTC (rev 5237)
+++ trunk/cumin/python/cumin/inventory/system.py 2012-03-06 15:16:02 UTC (rev 5238)
@@ -14,7 +14,7 @@
from wooly import Session, Widget
from wooly.datatable import *
-from wooly.util import StringCatalog
+from wooly.util import StringCatalog, xml_escape
strings = StringCatalog(__file__)
@@ -107,7 +107,7 @@
stat, value = item
if stat.name in self.fmt_as_bytes:
return fmt_bytes(value*1024)
- return CuminStatistic.fmt_value(value)
+ return CuminStatistic.fmt_value(value, escape=True)
class SystemStats(Widget):
def __init__(self, app, name, system):
@@ -194,7 +194,7 @@
tags = []
tags_string = ", ".join(tags)
- return tags_string
+ return xml_escape(tags_string)
def do_render(self, session, *args):
if self.defer_enabled and not getattr(session, "background", None):
Modified: trunk/cumin/python/cumin/messaging/binding.py
===================================================================
--- trunk/cumin/python/cumin/messaging/binding.py 2012-03-05 19:28:47 UTC (rev 5237)
+++ trunk/cumin/python/cumin/messaging/binding.py 2012-03-06 15:16:02 UTC (rev 5238)
@@ -16,6 +16,7 @@
from wooly.parameters import DictParameter, StringParameter, ListParameter,\
IntegerParameter
from wooly.util import StringCatalog, Writer
+from cumin.util import xml_escape
strings = StringCatalog(__file__)
log = logging.getLogger("cumin.messaging.exchange")
@@ -80,7 +81,7 @@
def render_content(self, session):
# binding doesn't have a name, use the binding key
obj = self.object.get(session)
- return obj.bindingKey
+ return xml_escape(obj.bindingKey)
class BindingRemove(ObjectFrameTask):
def __init__(self, app, frame):
@@ -468,11 +469,11 @@
def render_n_value(self, session, i):
names = self.names.get(session)
- return len(names) > i and names[i] or ""
+ return len(names) > i and xml_escape(names[i]) or ""
def render_v_value(self, session, i):
values = self.values.get(session)
- return len(values) > i and values[i] or ""
+ return len(values) > i and xml_escape(values[i]) or ""
def get_exchange(self, session):
exchange_string = self.exchange.get(session)
Modified: trunk/cumin/python/cumin/messaging/brokerlink.py
===================================================================
--- trunk/cumin/python/cumin/messaging/brokerlink.py 2012-03-05 19:28:47 UTC (rev 5237)
+++ trunk/cumin/python/cumin/messaging/brokerlink.py 2012-03-06 15:16:02 UTC (rev 5238)
@@ -37,7 +37,7 @@
class BrokerLinkRemoveForm(ObjectFrameTaskForm):
def render_content(self, session):
obj = self.object.get(session)
- return obj.host
+ return xml_escape(obj.host)
class BrokerLinkRemove(ObjectFrameTask):
def __init__(self, app, frame):
@@ -185,13 +185,14 @@
if not self.param.get(session):
self.param.set(session, exchange.id)
exchanges.append(exchange)
+
return exchanges
def render_item_value(self, session, exchange):
return exchange.id
def render_item_content(self, session, exchange):
- return exchange.name
+ return xml_escape(exchange.name)
def render_item_checked_attr(self, session, exchange):
if self.param.get(session) == exchange.id:
Modified: trunk/cumin/python/cumin/messaging/connection.py
===================================================================
--- trunk/cumin/python/cumin/messaging/connection.py 2012-03-05 19:28:47 UTC (rev 5237)
+++ trunk/cumin/python/cumin/messaging/connection.py 2012-03-06 15:16:02 UTC (rev 5238)
@@ -101,8 +101,8 @@
def get_item_content(self, session, item):
args = (item.remoteProcessName, item.remotePid)
if args[1] is None:
- return item.address
- return "%s (%i)" % args
+ return xml_escape(item.address)
+ return xml_escape("%s (%i)" % args)
class ConnectionProcessColumn(ObjectTableColumn):
def __init__(self, app, name, attr, pid_attr):
Modified: trunk/cumin/python/cumin/messaging/exchange.py
===================================================================
--- trunk/cumin/python/cumin/messaging/exchange.py 2012-03-05 19:28:47 UTC (rev 5237)
+++ trunk/cumin/python/cumin/messaging/exchange.py 2012-03-06 15:16:02 UTC (rev 5238)
@@ -94,7 +94,7 @@
return "Remove"
def get_item_content(self, session, item):
- return item.name or "Default exchange"
+ return xml_escape(item.name) or "Default exchange"
def do_invoke(self, invoc, exchange):
session = self.app.model.get_session_by_object(exchange)
@@ -130,7 +130,7 @@
return exchange.id
def render_item_content(self, session, exchange):
- return exchange.name or "<em>Default</em>"
+ return xml_escape(exchange.name) or "<em>Default</em>"
def render_item_checked_attr(self, session, exchange):
return exchange is self.param.get(session) and "checked=\"checked\""
Modified: trunk/cumin/python/cumin/messaging/queue.py
===================================================================
--- trunk/cumin/python/cumin/messaging/queue.py 2012-03-05 19:28:47 UTC (rev 5237)
+++ trunk/cumin/python/cumin/messaging/queue.py 2012-03-06 15:16:02 UTC (rev 5238)
@@ -593,7 +593,7 @@
return queue_list
def render_item_content(self, session, queue):
- return queue.name or "<em>Default</em>"
+ return xml_escape(queue.name) or "<em>Default</em>"
def render_item_value(self, session, queue):
return queue._id
@@ -694,7 +694,7 @@
return "Source Queue"
def render_inputs(self, session):
- return self.get(session)
+ return xml_escape(self.get(session))
def get(self, session):
queue = self.form.object.get(session)
Modified: trunk/cumin/python/cumin/model.py
===================================================================
--- trunk/cumin/python/cumin/model.py 2012-03-05 19:28:47 UTC (rev 5237)
+++ trunk/cumin/python/cumin/model.py 2012-03-06 15:16:02 UTC (rev 5238)
@@ -8,7 +8,7 @@
from cumin.formats import fmt_datetime, fmt_dict, fmt_none_brief, fmt_none,\
fmt_duration
-from cumin.util import calc_rate, JobStatusInfo, secs
+from cumin.util import calc_rate, JobStatusInfo, secs, xml_escape
from cumin.sqladapter import SqlAdapter
from rosemary.sqlfilter import SqlComparisonFilter
from rosemary.sqlquery import SqlQueryOptions
@@ -438,14 +438,20 @@
def get_title(self, session):
return self.name
- def format_value(self, session, value):
- return CuminStatistic.fmt_value(value)
+ def format_value(self, session, value, escape=False):
+ return CuminStatistic.fmt_value(value, escape)
@classmethod
- def fmt_value(cls, value):
+ def fmt_value(cls, value, escape=False):
try:
+ # Don't want to escape the None case because
+ # the formatter produces xml, and we don't
+ # need to escape the number cases either.
return cls.formatters[type(value)](value)
except KeyError:
+ # But we do optionally want to escape the string cases
+ if escape:
+ return xml_escape(value)
return value
class MetaData(object):
Modified: trunk/cumin/python/cumin/objectframe.py
===================================================================
--- trunk/cumin/python/cumin/objectframe.py 2012-03-05 19:28:47 UTC (rev 5237)
+++ trunk/cumin/python/cumin/objectframe.py 2012-03-06 15:16:02 UTC (rev 5238)
@@ -105,8 +105,9 @@
obj = self.object.get(session)
for attr in self.get_attributes(session):
+ # name and title are from rosemary xml files
name = attr.title
- value = obj.get_formatted_value(attr.name)
+ value = obj.get_formatted_value(attr.name, escape=True)
title = attr.description
writer.write(self.entry.render(session, name, value, title))
@@ -296,7 +297,7 @@
return cls
def render_content(self, session, frame):
- return frame.get_title(session)
+ return xml_escape(frame.get_title(session))
class ObjectViewHeading(ObjectViewChild):
def __init__(self, app, name, object):
@@ -309,7 +310,7 @@
retval = self.parent.render_title(session)
if retval is not None and isinstance(retval, str) and len(retval) > 100:
retval = retval[:100] + "..."
- return retval
+ return xml_escape(retval)
class ObjectViewSummary(ObjectViewChild):
def __init__(self, app, name, object):
@@ -479,7 +480,7 @@
return super(ObjectFrameTaskForm, self).render_content(session)
obj = self.object.get(session)
- return obj.get_title()
+ return xml_escape(obj.get_title())
class ObjectFrameTaskFeedbackForm(ObjectFrameTaskForm):
# substitute our submit button because it has feedback when it is clicked
Modified: trunk/cumin/python/cumin/objectselector.py
===================================================================
--- trunk/cumin/python/cumin/objectselector.py 2012-03-05 19:28:47 UTC (rev 5237)
+++ trunk/cumin/python/cumin/objectselector.py 2012-03-06 15:16:02 UTC (rev 5238)
@@ -1,7 +1,7 @@
from cumin.objectframe import ObjectFrame
from cumin.qmfadapter import ObjectQmfAdapter, ObjectQmfField
from cumin.sqladapter import ObjectSqlAdapter, ObjectSqlField
-from cumin.util import Identifiable
+from cumin.util import Identifiable, xml_escape
from rosemary.model import RosemaryClass, RosemaryAttribute, RosemaryReference
from rosemary.sqlfilter import SqlLikeFilter
@@ -489,7 +489,7 @@
pass
def get_item_content(self, session, item):
- return item.get_formatted_value("name")
+ return item.get_formatted_value("name", escape=True)
class ObjectSelectorTaskForm(FoldingFieldSubmitForm):
def __init__(self, app, name, task):
@@ -545,6 +545,7 @@
return self.parent.selection.get(session)
def render_item_content(self, session, item):
+ # already escaped in get_item_content
return self.parent.task.get_item_content(session, item)
def render_item_class(self, session, item):
Modified: trunk/cumin/python/cumin/stat.py
===================================================================
--- trunk/cumin/python/cumin/stat.py 2012-03-05 19:28:47 UTC (rev 5237)
+++ trunk/cumin/python/cumin/stat.py 2012-03-06 15:16:02 UTC (rev 5238)
@@ -14,7 +14,7 @@
from cumin.model import CuminStatistic, SamplesSqlAdapter
from cumin.widgets import StateSwitch
from wooly.template import WidgetTemplate
-from cumin.util import calc_rate, secs, nvl
+from cumin.util import calc_rate, secs, nvl, xml_escape
from cumin.OpenFlashChart import Element, Chart
strings = StringCatalog(__file__)
@@ -54,7 +54,7 @@
def render_item_value(self, session, item):
value = self.get_item_value(session, item)
- return self.render_formatted_value(session, item, value)
+ return self.render_formatted_value(session, item, value, escape=True)
def get_item_unit(self, session, item):
stat, _ = item
@@ -64,7 +64,10 @@
_, value = item
return value
- def render_formatted_value(self, session, item, value):
+ def render_formatted_value(self, session, item, value, escape=False):
+ # Since this routine delegates to CuminStatistic which may produce
+ # xml for None values, we need to handle escaping here and in
+ # CuminStatistic
def fmt_b(value):
return value is not None and fmt_bytes(value) or None
@@ -84,7 +87,7 @@
except:
pass
- return CuminStatistic.fmt_value(value)
+ return CuminStatistic.fmt_value(value, escape)
class NewStatSet(ItemSet):
def __init__(self, app, name):
@@ -112,7 +115,7 @@
def render_item_value(self, session, item):
stat, value = item
- return stat.format_value(session, value)
+ return stat.format_value(session, value, escape=True)
class DurationSwitch(StateSwitch):
def __init__(self, app, name):
Modified: trunk/cumin/python/cumin/util.py
===================================================================
--- trunk/cumin/python/cumin/util.py 2012-03-05 19:28:47 UTC (rev 5237)
+++ trunk/cumin/python/cumin/util.py 2012-03-06 15:16:02 UTC (rev 5238)
@@ -11,14 +11,9 @@
from random import sample
from threading import Thread, Event
from time import mktime, time, sleep
-from xml.sax.saxutils import escape as do_xml_escape
-
from parsley.threadingex import print_threads
+from wooly.util import xml_escape
-def xml_escape(string):
- if string:
- return do_xml_escape(string)
-
def short_id():
return "%08x" % randint(0, sys.maxint)
Modified: trunk/cumin/python/cumin/widgets.py
===================================================================
--- trunk/cumin/python/cumin/widgets.py 2012-03-05 19:28:47 UTC (rev 5237)
+++ trunk/cumin/python/cumin/widgets.py 2012-03-06 15:16:02 UTC (rev 5238)
@@ -61,7 +61,7 @@
def render_user_name(self, session):
login = session.client_session.attributes["login_session"]
- return login.user.name
+ return xml_escape(login.user.name)
def render_logout_href(self, session):
page = self.app.login_page
@@ -1219,10 +1219,13 @@
items = session.get_notifications()
if self.app.notification_timeout > 0:
for i in items:
- # we want the messages to timeout after 3 min, the easiest way is to dismiss it
- # doing it here for now so that both TaskInvocations and Notifications will be handled in the same place.
- # The value for the timeout can be changed via the notification-timeout config
- if not i.dismissed and datetime.now() - i.timestamp >= timedelta(seconds=self.app.notification_timeout):
+ # we want the messages to timeout after 3 min, the easiest way
+ # is to dismiss it doing it here for now so that both
+ # TaskInvocations and Notifications will be handled in the
+ # same place. The value for the timeout can be changed via the
+ # notification-timeout config
+ if not i.dismissed and datetime.now() - i.timestamp >= \
+ timedelta(seconds=self.app.notification_timeout):
i.dismissed = True
items = [x for x in items if not x.dismissed]
return items
@@ -1488,15 +1491,16 @@
super(BaseBindingInput, self).__init__(app, name, field_param)
def render_item_content(self, session, field):
- return field.name or "Default"
+ return xml_escape(field.name) or "Default"
def render_value(self, session):
if self.disabled:
field = self.form.object.get(session)
- return fmt_shorten(field.get_formatted_value("name"), pre=36, post=4)
+ return fmt_shorten(field.get_formatted_value("name", escape=True),
+ pre=36, post=4)
else:
input_value = self.param.get(session)
- return input_value and input_value or ""
+ return input_value and xml_escape(input_value) or ""
def base_get_items(self, session, objects):
obj_list = []
Modified: trunk/rosemary/python/rosemary/model.py
===================================================================
--- trunk/rosemary/python/rosemary/model.py 2012-03-05 19:28:47 UTC (rev 5237)
+++ trunk/rosemary/python/rosemary/model.py 2012-03-06 15:16:02 UTC (rev 5238)
@@ -3,6 +3,7 @@
from sqlquery import *
from sqltype import *
import util
+from cumin.util import xml_escape
log = logging.getLogger("rosemary.model")
@@ -833,10 +834,12 @@
for attr in ("name", "Name"):
if hasattr(self, attr):
- return self.get_formatted_value(attr)
+ return self.get_formatted_value(attr, escape=True)
- def get_formatted_value(self, attr):
+ def get_formatted_value(self, attr, escape=False):
value = self.get_value(attr)
+ if escape:
+ value = xml_escape(value)
formatter = None
if attr in self._class._properties_by_name:
formatter = self._class._properties_by_name[attr].formatter
Modified: trunk/wooly/python/wooly/table.py
===================================================================
--- trunk/wooly/python/wooly/table.py 2012-03-05 19:28:47 UTC (rev 5237)
+++ trunk/wooly/python/wooly/table.py 2012-03-06 15:16:02 UTC (rev 5238)
@@ -114,6 +114,7 @@
self.visible = True
self.width = None
self.static_header = False
+ self.do_escape = True
def render_class(self, session):
tokens = list()
@@ -171,8 +172,23 @@
def render_header_link_class(self, session):
pass
+ def do_render_cell_content(self, session, record):
+ r = self.render_cell_content(session, record)
+ if self.do_escape:
+ return xml_escape(r)
+ return r
+
def render_cell_content(self, session, record):
pass
+
+ def do_render_cell_title(self, session, record):
+ r = self.render_cell_title(session, record)
+ if self.do_escape:
+ return xml_escape(r)
+ return r
+
+ def render_cell_title(self, session, record):
+ pass
class TableColumnCss(TableChild):
def __init__(self, app, name):
@@ -242,11 +258,11 @@
return self.parent.render_class(session)
def render_content(self, session, record):
- return self.parent.render_cell_content(session, record)
+ return self.parent.do_render_cell_content(session, record)
def render_cell_title(self, session, record):
#gives us the title="" attribute for each table cell
- return self.parent.render_cell_title(session, record)
+ return self.parent.do_render_cell_title(session, record)
class TableHeader(TableChild):
def render_colspan(self, session):
Modified: trunk/wooly/python/wooly/util.py
===================================================================
--- trunk/wooly/python/wooly/util.py 2012-03-05 19:28:47 UTC (rev 5237)
+++ trunk/wooly/python/wooly/util.py 2012-03-06 15:16:02 UTC (rev 5238)
@@ -18,6 +18,11 @@
from parsley.collectionsex import *
+def xml_escape(string, entities=None):
+ if type(string) in (str, unicode):
+ return escape(string, entities)
+ return string
+
def unique_id():
bits0 = random.getrandbits(32)
bits1 = random.getrandbits(32)
Modified: trunk/wooly/python/wooly/widgets.py
===================================================================
--- trunk/wooly/python/wooly/widgets.py 2012-03-05 19:28:47 UTC (rev 5237)
+++ trunk/wooly/python/wooly/widgets.py 2012-03-06 15:16:02 UTC (rev 5238)
@@ -197,7 +197,7 @@
return writer.to_string()
def render_item_content(self, session, item):
- return item
+ return xml_escape(item)
def render_item_class(self, session, item):
return "_"
12 years, 2 months
r5237 - trunk/cumin/etc
by tmckay@fedoraproject.org
Author: tmckay
Date: 2012-03-05 19:28:47 +0000 (Mon, 05 Mar 2012)
New Revision: 5237
Modified:
trunk/cumin/etc/cumin.conf
Log:
Change explanatory comment section to use ## so that replacements
of parameters with sed can be done without setting multiple values
Modified: trunk/cumin/etc/cumin.conf
===================================================================
--- trunk/cumin/etc/cumin.conf 2012-03-05 16:55:53 UTC (rev 5236)
+++ trunk/cumin/etc/cumin.conf 2012-03-05 19:28:47 UTC (rev 5237)
@@ -177,107 +177,107 @@
# *************** Some parameter explanations by section ***************
-# [common]
+## [common]
-# wallaby-broker: [first item in 'brokers' list]
-# The broker to use for interaction with a Wallaby agent.
-# This is not necessarily the same broker used for grid
-# and messaging information. The default value is the
-# first item in the 'brokers' list if not specified. To
-# turn off interaction with Wallaby, set wallaby-broker to
-# the string 'None'.
+## wallaby-broker: [first item in 'brokers' list]
+## The broker to use for interaction with a Wallaby agent.
+## This is not necessarily the same broker used for grid
+## and messaging information. The default value is the
+## first item in the 'brokers' list if not specified. To
+## turn off interaction with Wallaby, set wallaby-broker to
+## the string 'None'.
-# wallaby-refresh: 60
-# How often in seconds to contact the Wallaby agent
-# for updated information.
+## wallaby-refresh: 60
+## How often in seconds to contact the Wallaby agent
+## for updated information.
-# use-aviary: True
-# Whether or not to use the Aviary services for
-# remote procedure calls to condor. If this is
-# set to False, the QMF interface will be used
-# instead.
+## use-aviary: True
+## Whether or not to use the Aviary services for
+## remote procedure calls to condor. If this is
+## set to False, the QMF interface will be used
+## instead.
-# aviary-job-servers: http://localhost:9090
-# Specifies the URIs for aviary job servers. The value
-# is a comma separated list of URIs. A full URI has the
-# form 'scheme://user/password@host:port/path". The scheme
-# will default to http if not specified, the port will
-# default to 9090, and the path will default to
-# /services/job/. User and password will be empty by
-# default. As a convenience, a URI that explicitly
-# sets a port number may be followed by one or more
-# port numbers separated by commas to specify
-# mulitple job servers whose URIs differ only
-# by port number.
+## aviary-job-servers: http://localhost:9090
+## Specifies the URIs for aviary job servers. The value
+## is a comma separated list of URIs. A full URI has the
+## form 'scheme://user/password@host:port/path". The scheme
+## will default to http if not specified, the port will
+## default to 9090, and the path will default to
+## /services/job/. User and password will be empty by
+## default. As a convenience, a URI that explicitly
+## sets a port number may be followed by one or more
+## port numbers separated by commas to specify
+## mulitple job servers whose URIs differ only
+## by port number.
-# aviary-query-servers: http://localhost:9091
-# Like aviary-job-servers but specifies URIs for aviary
-# query servers. The port value defaults to 9091 and the
-# path defaults to /services/query/. Other
-# defaults are as noted for aviary-job-servers.
+## aviary-query-servers: http://localhost:9091
+## Like aviary-job-servers but specifies URIs for aviary
+## query servers. The port value defaults to 9091 and the
+## path defaults to /services/query/. Other
+## defaults are as noted for aviary-job-servers.
-# log-max-mb: 10
-# Maximum size in MB of *.log files created by cumin.
-# A log file reaching maximum size will be rolled over.
-# A value of 0 leaves the log file size unlimited.
+## log-max-mb: 10
+## Maximum size in MB of *.log files created by cumin.
+## A log file reaching maximum size will be rolled over.
+## A value of 0 leaves the log file size unlimited.
-# log-max-archives: 1
-# Number of rolled over log files to retain. A retained
-# log file will have a "." and a number added to its name.
-# A value of 0 will cause a log file to be truncated
-# rather than renamed if it reaches maximum size.
+## log-max-archives: 1
+## Number of rolled over log files to retain. A retained
+## log file will have a "." and a number added to its name.
+## A value of 0 will cause a log file to be truncated
+## rather than renamed if it reaches maximum size.
-# [web]
+## [web]
-# persona: grid
-# Controls content of the top level page.
-# Valid values are "default", "grid", and "messaging".
-# The "default" persona contains content for both grid and
-# messaging.
+## persona: grid
+## Controls content of the top level page.
+## Valid values are "default", "grid", and "messaging".
+## The "default" persona contains content for both grid and
+## messaging.
-# [data]
+## [data]
-# expire-enabled: True
-# Whether or not the instance runs a thread which periodically expires samples.
-# Running the expire thread from more than one instance is okay but unnecessary
+## expire-enabled: True
+## Whether or not the instance runs a thread which periodically expires samples.
+## Running the expire thread from more than one instance is okay but unnecessary
-# expire-interval: 3600
-# How often the expire thread runs, in seconds
+## expire-interval: 3600
+## How often the expire thread runs, in seconds
-# expire-threshold: 86400
-# The maximum age of a sample in seconds. If it's older, it will be deleted when
-# the expire thread runs.
+## expire-threshold: 86400
+## The maximum age of a sample in seconds. If it's older, it will be deleted when
+## the expire thread runs.
-# vacuum-enabled: True
-# Whether or not the instance runs a thread which periodically vacuums the
-# database. Running the vacuum thread from more than one instance is okay but
-# unnecessary.
+## vacuum-enabled: True
+## Whether or not the instance runs a thread which periodically vacuums the
+## database. Running the vacuum thread from more than one instance is okay but
+## unnecessary.
-# vacuum-interval: 3600
-# How often the vacuum thread runs, in seconds
+## vacuum-interval: 3600
+## How often the vacuum thread runs, in seconds
-# include-classes: [all]
-# A comma separated list of QMF classes. The default value is all
-# classes in all packages. The cumin-data instance will be bound to
-# classes which appear in 'include-classes' but do not appear in
-# 'exclude-classes'. Classes are specified as package:class for a single
-# class or package:* for all classes in a package.
+## include-classes: [all]
+## A comma separated list of QMF classes. The default value is all
+## classes in all packages. The cumin-data instance will be bound to
+## classes which appear in 'include-classes' but do not appear in
+## 'exclude-classes'. Classes are specified as package:class for a single
+## class or package:* for all classes in a package.
-# exclude-classes: [empty list]
-# A comma separated list of QMF classes. The default value is
-# an empty list. The cumin-data instance will be bound to
-# classes which appear in 'include-classes' but do not appear in
-# 'exclude-classes'. Classes are specified as package:class for a single
-# class or package:* for all classes in a package.
+## exclude-classes: [empty list]
+## A comma separated list of QMF classes. The default value is
+## an empty list. The cumin-data instance will be bound to
+## classes which appear in 'include-classes' but do not appear in
+## 'exclude-classes'. Classes are specified as package:class for a single
+## class or package:* for all classes in a package.
-# [master]
+## [master]
-# webs: web
-# Comma separated list of sections in this file.
-# Each section specifies the configuration for a separate
-# instance of cumin-web.
+## webs: web
+## Comma separated list of sections in this file.
+## Each section specifies the configuration for a separate
+## instance of cumin-web.
-# datas: data
-# Comma separated list of sections in this file.
-# Each section specifies the configuration for a separate
-# instance of cumin-data.
+## datas: data
+## Comma separated list of sections in this file.
+## Each section specifies the configuration for a separate
+## instance of cumin-data.
12 years, 3 months
r5236 - trunk/cumin/bin
by tmckay@fedoraproject.org
Author: tmckay
Date: 2012-03-05 16:55:53 +0000 (Mon, 05 Mar 2012)
New Revision: 5236
Modified:
trunk/cumin/bin/cumin
trunk/cumin/bin/cumin-data
trunk/cumin/bin/cumin-web
Log:
Change timeout in master to 5 seconds when waiting for children to shutdown
Modified: trunk/cumin/bin/cumin
===================================================================
--- trunk/cumin/bin/cumin 2012-03-05 16:05:35 UTC (rev 5235)
+++ trunk/cumin/bin/cumin 2012-03-05 16:55:53 UTC (rev 5236)
@@ -220,7 +220,7 @@
break
sleep(0.25)
- if datetime.now() - then > timedelta(seconds=10):
+ if datetime.now() - then > timedelta(seconds=5):
log.warn("Timed out waiting for children, send SIGKILL")
for app in apps: # just to be paranoid
if app[PROCESS]:
Modified: trunk/cumin/bin/cumin-data
===================================================================
--- trunk/cumin/bin/cumin-data 2012-03-05 16:05:35 UTC (rev 5235)
+++ trunk/cumin/bin/cumin-data 2012-03-05 16:55:53 UTC (rev 5236)
@@ -232,7 +232,7 @@
sleep(86400)
except KeyboardInterrupt:
- log.info("Received SIGINT")
+ log.info("Received shutdown signal")
except SystemExit:
if "--help" not in sys.argv:
Modified: trunk/cumin/bin/cumin-web
===================================================================
--- trunk/cumin/bin/cumin-web 2012-03-05 16:05:35 UTC (rev 5235)
+++ trunk/cumin/bin/cumin-web 2012-03-05 16:55:53 UTC (rev 5236)
@@ -169,7 +169,7 @@
break
except KeyboardInterrupt:
- log.info("Received SIGINT")
+ log.info("Received shutdown signal")
pass
except SystemExit:
12 years, 3 months
r5235 - in trunk: cumin/bin parsley/python/parsley
by tmckay@fedoraproject.org
Author: tmckay
Date: 2012-03-05 16:05:35 +0000 (Mon, 05 Mar 2012)
New Revision: 5235
Modified:
trunk/cumin/bin/cumin
trunk/cumin/bin/cumin-data
trunk/cumin/bin/cumin-web
trunk/parsley/python/parsley/loggingex.py
Log:
Change initial shutdown signal from cumin master to SIGTERM instead of SIGINT.
Get rid of traceback call in loggingex.py
Modified: trunk/cumin/bin/cumin
===================================================================
--- trunk/cumin/bin/cumin 2012-03-02 16:25:36 UTC (rev 5234)
+++ trunk/cumin/bin/cumin 2012-03-05 16:05:35 UTC (rev 5235)
@@ -187,7 +187,7 @@
complete = len(apps)
break
else:
- log.warn("Subprocess (%s) exited with status %s (%s), %s"\
+ log.info("Subprocess (%s) exited with status %s (%s), %s"\
% (app[PROCESS].pid, poll, err[0], err[1]))
if poll != 0:
log.info("Subprocess logs may contain more details.")
@@ -198,12 +198,12 @@
start(app, "Restart")
finally:
# Try a ctrl-C first
- log.info("Send SIGINT to all children")
+ log.info("Send SIGTERM to all children")
complete = 0
for app in apps:
if app[PROCESS]:
complete += 1
- os.kill(app[PROCESS].pid, signal.SIGINT)
+ os.kill(app[PROCESS].pid, signal.SIGTERM)
# Give children 10 seconds to exit, then bail
then = datetime.now()
@@ -211,6 +211,7 @@
for app in apps:
poll = app[PROCESS] and app[PROCESS].poll()
if poll is not None:
+ log.info("Subprocess (%s) exited", app[PROCESS].pid)
app[PROCESS] = None
complete -= 1
@@ -220,9 +221,12 @@
sleep(0.25)
if datetime.now() - then > timedelta(seconds=10):
- for app in apps: # just to be paranoid
- app[PROCESS] and os.kill(app[PROCESS].pid, signal.SIGKILL)
- log.info("Timed out waiting for children, exited")
+ log.warn("Timed out waiting for children, send SIGKILL")
+ for app in apps: # just to be paranoid
+ if app[PROCESS]:
+ log.warn("Send SIGKILL to subprocess (%s)"\
+ % app[PROCESS].pid)
+ os.kill(app[PROCESS].pid, signal.SIGKILL)
break
return return_code
Modified: trunk/cumin/bin/cumin-data
===================================================================
--- trunk/cumin/bin/cumin-data 2012-03-02 16:25:36 UTC (rev 5234)
+++ trunk/cumin/bin/cumin-data 2012-03-05 16:05:35 UTC (rev 5235)
@@ -263,11 +263,17 @@
mint.stop()
if pipeThread:
pipeThread.stop()
+ log.info("about to call logging shutdown")
logging.shutdown()
return adjust_return(passed_init, return_code)
+def make_ctrl_c(sig, frame):
+ raise KeyboardInterrupt
+
if __name__ == "__main__":
try:
+ import signal
+ signal.signal(signal.SIGTERM, make_ctrl_c)
sys.exit(main())
except KeyboardInterrupt:
sys.exit(0)
Modified: trunk/cumin/bin/cumin-web
===================================================================
--- trunk/cumin/bin/cumin-web 2012-03-02 16:25:36 UTC (rev 5234)
+++ trunk/cumin/bin/cumin-web 2012-03-05 16:05:35 UTC (rev 5235)
@@ -201,11 +201,17 @@
cumin.stop()
if pipeThread:
pipeThread.stop()
+ log.info("about to call logging shutdown")
logging.shutdown()
return adjust_return(passed_init, return_code)
+def make_ctrl_c(sig, frame):
+ raise KeyboardInterrupt
+
if __name__ == "__main__":
try:
+ import signal
+ signal.signal(signal.SIGTERM, make_ctrl_c)
sys.exit(main())
except KeyboardInterrupt:
sys.exit(0)
Modified: trunk/parsley/python/parsley/loggingex.py
===================================================================
--- trunk/parsley/python/parsley/loggingex.py 2012-03-02 16:25:36 UTC (rev 5234)
+++ trunk/parsley/python/parsley/loggingex.py 2012-03-05 16:05:35 UTC (rev 5235)
@@ -3,7 +3,6 @@
import sys
from stat import ST_DEV, ST_INO
-import traceback
import select
from logging.handlers import RotatingFileHandler
from collectionsex import defaultdict
@@ -223,7 +222,6 @@
except Exception, e:
if callable(self.call_on_fail):
self.call_on_fail()
- traceback.print_exc()
finally:
for key, value in self.files.items():
12 years, 3 months
r5234 - trunk/cumin/python/cumin
by croberts@fedoraproject.org
Author: croberts
Date: 2012-03-02 16:25:36 +0000 (Fri, 02 Mar 2012)
New Revision: 5234
Modified:
trunk/cumin/python/cumin/main.py
Log:
One more tweak in Cumin.__init__ for BZ 785551
Modified: trunk/cumin/python/cumin/main.py
===================================================================
--- trunk/cumin/python/cumin/main.py 2012-03-01 20:53:49 UTC (rev 5233)
+++ trunk/cumin/python/cumin/main.py 2012-03-02 16:25:36 UTC (rev 5234)
@@ -64,6 +64,8 @@
self.max_qmf_table_sort = 1000
self.fast_view_attributes = list()
+ self.notification_timeout = 180
+ self.force_html_doctype = False
self.form_defaults = self.CuminFormDefaults()
12 years, 3 months