r4792 - trunk/cumin/python/cumin/grid
by croberts@fedoraproject.org
Author: croberts
Date: 2011-05-27 17:44:59 +0000 (Fri, 27 May 2011)
New Revision: 4792
Modified:
trunk/cumin/python/cumin/grid/limit.py
Log:
Adding a missing lower() to force case insensitivity for setting limits to "unlimited"
Modified: trunk/cumin/python/cumin/grid/limit.py
===================================================================
--- trunk/cumin/python/cumin/grid/limit.py 2011-05-26 19:06:08 UTC (rev 4791)
+++ trunk/cumin/python/cumin/grid/limit.py 2011-05-27 17:44:59 UTC (rev 4792)
@@ -256,7 +256,7 @@
value = self.input.get(session)
if value:
try:
- if value not in ("unlimited", "na", "n/a"):
+ if value.lower() not in ("unlimited", "na", "n/a"):
value = float(value)
except:
title = self.render_title(session)
12 years, 11 months
r4791 - trunk/cumin/python/cumin/usergrid
by croberts@fedoraproject.org
Author: croberts
Date: 2011-05-26 19:06:08 +0000 (Thu, 26 May 2011)
New Revision: 4791
Modified:
trunk/cumin/python/cumin/usergrid/model.strings
Log:
Adding where clause to the LoadUserJobStats.sql in order to take care of BZ https://bugzilla.redhat.com/show_bug.cgi?id=703283
Modified: trunk/cumin/python/cumin/usergrid/model.strings
===================================================================
--- trunk/cumin/python/cumin/usergrid/model.strings 2011-05-26 15:42:48 UTC (rev 4790)
+++ trunk/cumin/python/cumin/usergrid/model.strings 2011-05-26 19:06:08 UTC (rev 4791)
@@ -4,6 +4,4 @@
sum(s."IdleJobs") as IdleJobs,
sum(s."HeldJobs") as held
from "com.redhat.grid"."Submitter" as s
-
-[xxx]
-where s.submitter like '{user_name}@%'
+where s."Owner" = '{user_name}'
12 years, 11 months
r4790 - in trunk: cumin/python/cumin wooly/resources
by croberts@fedoraproject.org
Author: croberts
Date: 2011-05-26 15:42:48 +0000 (Thu, 26 May 2011)
New Revision: 4790
Modified:
trunk/cumin/python/cumin/widgets.strings
trunk/wooly/resources/wooly.js
Log:
To address BZ https://bugzilla.redhat.com/show_bug.cgi?id=682447 we put an extra check after the ajax call is made. In the event of a non-200 status code, we let the page listeners know that the call failed. The page update listener has been updated to address the failure status.
Modified: trunk/cumin/python/cumin/widgets.strings
===================================================================
--- trunk/cumin/python/cumin/widgets.strings 2011-05-26 13:30:41 UTC (rev 4789)
+++ trunk/cumin/python/cumin/widgets.strings 2011-05-26 15:42:48 UTC (rev 4790)
@@ -109,13 +109,14 @@
}
[CuminMainView.javascript]
- cumin.set_updated = function () {
+ cumin.set_updated = function (success) {
var updateStr;
+
var kiosk = wooly.session.branch()["kiosk"];
if (kiosk != null && kiosk != undefined)
- updateStr = "**Updated "
+ updateStr = success ? "**Updated " : "Last update failed ";
else
- updateStr = "Updated "
+ updateStr = success ? "Updated " : "Last update failed ";
$('heartbeat').set('text', updateStr + new Date().format("%Y-%m-%d %H:%M:%S"));
$('shock').style.display = "none";
$('heartbeat').style.display = "inline";
@@ -125,9 +126,8 @@
cumin.myEffect = new Fx.Morph('heartbeat', {duration: 1000});
setTimeout(function () {cumin.myEffect.start({ 'color': ['#000000', '#666666'] })}, 500);
}
- wooly.addPageUpdateListener( function () {
- cumin.set_updated();
- });
+ wooly.addPageUpdateListener(cumin.set_updated);
+
cumin.expireIntervalUpdate = function () {
if (typeof cumin.expireID != "undefined") {
if (cumin.expireID) {
@@ -148,14 +148,14 @@
wooly.updateNow();
wooly.resumeIntervalUpdate();
cumin.expireIntervalUpdate();
- cumin.set_updated();
+ cumin.set_updated(true);
}
}, 30*60*1000);
};
};
cumin.expireIntervalUpdate();
window.addEvent('domready', function () {
- cumin.set_updated();
+ cumin.set_updated(true);
});
[CuminMainView.html]
Modified: trunk/wooly/resources/wooly.js
===================================================================
--- trunk/wooly/resources/wooly.js 2011-05-26 13:30:41 UTC (rev 4789)
+++ trunk/wooly/resources/wooly.js 2011-05-26 15:42:48 UTC (rev 4790)
@@ -328,49 +328,54 @@
}
this.updatePage = function(xml) {
- var child = xml.documentElement.firstChild;
-
- while (child) {
- if (child.nodeType == 1 && child.nodeName == "widget") {
- var id = child.getAttribute("id");
- var oldElem = document.getElementById(id);
-
- if (oldElem) {
- var newElem = child.firstChild;
-
- while (newElem && newElem.nodeType != 1) {
- newElem = newElem.nextSibling;
- }
-
- if (newElem) {
- // only update a sub-block of html
-
- var updateId = newElem.getAttribute("update");
-
- if (updateId) {
- oldElem = document.getElementById(updateId);
- newElem = xmlGetElementById(newElem, updateId);
- }
-
- replaceNode(newElem, oldElem);
- } else {
- oldElem.parentNode.removeChild(oldElem);
- }
- } else {
- wooly.log("Element '" + id + "' not found");
- }
- // find and execute any javascript
- executeJS(child);
- }
-
- child = child.nextSibling;
- }
-
+ var success = true;
+ if(xml == null) {
+ success = false;
+ } else {
+ var child = xml.documentElement.firstChild;
+
+ while (child) {
+ if (child.nodeType == 1 && child.nodeName == "widget") {
+ var id = child.getAttribute("id");
+ var oldElem = document.getElementById(id);
+
+ if (oldElem) {
+ var newElem = child.firstChild;
+
+ while (newElem && newElem.nodeType != 1) {
+ newElem = newElem.nextSibling;
+ }
+
+ if (newElem) {
+ // only update a sub-block of html
+
+ var updateId = newElem.getAttribute("update");
+
+ if (updateId) {
+ oldElem = document.getElementById(updateId);
+ newElem = xmlGetElementById(newElem, updateId);
+ }
+
+ replaceNode(newElem, oldElem);
+ } else {
+ oldElem.parentNode.removeChild(oldElem);
+ }
+ } else {
+ wooly.log("Element '" + id + "' not found");
+ }
+ // find and execute any javascript
+ executeJS(child);
+ }
+
+ child = child.nextSibling;
+ }
+ }
+
var len = wooly.pageUpdateListeners.length;
for (var i = 0; i < len; i++) {
- wooly.pageUpdateListeners[i]();
- }
+ wooly.pageUpdateListeners[i](success);
+ }
}
this.backgroundUpdate = function(url, callback, passback) {
@@ -436,6 +441,11 @@
callback(req.responseText, passback);
else
callback(req.responseXML, passback);
+ } else {
+ if(req.readyState == 4) {
+ //readyState == 4 means that the call is done...a non-200 status means that something bad happened, call the callback with null for the XML
+ callback(null, passback);
+ }
}
} catch (e) {
log(e);
12 years, 11 months
r4789 - trunk/cumin/python/cumin
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-05-26 13:30:41 +0000 (Thu, 26 May 2011)
New Revision: 4789
Modified:
trunk/cumin/python/cumin/objectframe.py
Log:
Check for None in render_title before truncation
Modified: trunk/cumin/python/cumin/objectframe.py
===================================================================
--- trunk/cumin/python/cumin/objectframe.py 2011-05-25 20:13:03 UTC (rev 4788)
+++ trunk/cumin/python/cumin/objectframe.py 2011-05-26 13:30:41 UTC (rev 4789)
@@ -274,7 +274,7 @@
def render_title(self, session):
retval = self.parent.render_title(session)
- if(len(retval) > 100):
+ if retval is not None and len(retval) > 100:
retval = retval[:100] + "..."
return retval
12 years, 11 months
r4788 - trunk/wooly/python/wooly
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-05-25 20:13:03 +0000 (Wed, 25 May 2011)
New Revision: 4788
Modified:
trunk/wooly/python/wooly/datatable.py
Log:
Tweak none compare, style.
Modified: trunk/wooly/python/wooly/datatable.py
===================================================================
--- trunk/wooly/python/wooly/datatable.py 2011-05-25 19:12:27 UTC (rev 4787)
+++ trunk/wooly/python/wooly/datatable.py 2011-05-25 20:13:03 UTC (rev 4788)
@@ -45,7 +45,7 @@
if self.format is not None:
if callable(self.format):
value = self.format(value)
- elif value != None:
+ elif value is not None:
try:
value = self.format % value
except:
12 years, 11 months
r4787 - trunk/wooly/python/wooly
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-05-25 19:12:27 +0000 (Wed, 25 May 2011)
New Revision: 4787
Modified:
trunk/wooly/python/wooly/datatable.py
Log:
Boolean test disallowed 0 as a valid entry for numeric columns with format fields. This seems wrong, since it is indistinguishable from a true Null.
Modified: trunk/wooly/python/wooly/datatable.py
===================================================================
--- trunk/wooly/python/wooly/datatable.py 2011-05-25 14:35:50 UTC (rev 4786)
+++ trunk/wooly/python/wooly/datatable.py 2011-05-25 19:12:27 UTC (rev 4787)
@@ -45,8 +45,11 @@
if self.format is not None:
if callable(self.format):
value = self.format(value)
- else:
- value = value and self.format % value or None
+ elif value != None:
+ try:
+ value = self.format % value
+ except:
+ value = "Error"
return value
12 years, 11 months
r4786 - trunk/cumin/etc
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-05-25 14:35:50 +0000 (Wed, 25 May 2011)
New Revision: 4786
Modified:
trunk/cumin/etc/sysvinit-cumin
Log:
More informative error messages from init.d script when attempting to start
or stop cumin as a non-root user. Added [FAILED] banner when environment checks
fail in general.
BZ704653
Modified: trunk/cumin/etc/sysvinit-cumin
===================================================================
--- trunk/cumin/etc/sysvinit-cumin 2011-05-25 13:22:58 UTC (rev 4785)
+++ trunk/cumin/etc/sysvinit-cumin 2011-05-25 14:35:50 UTC (rev 4786)
@@ -32,8 +32,16 @@
start() {
+ echo -n $"Starting cumin: "
+ if [[ "$EUID" != "0" ]]; then
+ echo_failure; echo
+ echo "Must be run as root"
+ exit 1
+ fi
+
# Initial checks for the start case
cumin-database check-started &> /dev/null || {
+ echo_failure; echo
echo "Cumin's database server is not running"
echo "Run 'cumin-database start' as root"
exit 1
@@ -41,6 +49,7 @@
cumin-database check &> /dev/null || {
# Run again with output left on for user.
+ echo_failure; echo
echo "Cumin's database is not yet installed"
echo "Run 'cumin-database install' as root"
@@ -49,7 +58,6 @@
exit 1
}
- echo -n $"Starting cumin: "
# If it's already running, be happy and return success
status $processname &> /dev/null
[ $? -eq 0 ] && echo_success && echo && return
@@ -78,6 +86,10 @@
if [ $RETVAL -eq 0 ]; then
rm -f /var/lock/subsys/$servicename
rm -f /var/run/cumin.pid
+ else
+ if [[ "$EUID" != "0" ]]; then
+ echo "Must be run as root"
+ fi
fi
}
12 years, 11 months
r4785 - trunk/cumin/resources
by croberts@fedoraproject.org
Author: croberts
Date: 2011-05-25 13:22:58 +0000 (Wed, 25 May 2011)
New Revision: 4785
Modified:
trunk/cumin/resources/app.js
Log:
Now using Array.from instead of $A which is no longer supported in mootools.js 1.3.x
Modified: trunk/cumin/resources/app.js
===================================================================
--- trunk/cumin/resources/app.js 2011-05-25 13:01:06 UTC (rev 4784)
+++ trunk/cumin/resources/app.js 2011-05-25 13:22:58 UTC (rev 4785)
@@ -43,7 +43,7 @@
if (!(name in hash)) {
hash[name] = "";
}
- var vals = $A(hash[name].split('|'));
+ var vals = Array.from(hash[name].split('|'));
if ((vals.length == 1) && (vals[0] == ""))
vals.empty();
var valIndex = vals.indexOf(val);
@@ -74,7 +74,7 @@
if (document.forms.length > 0) {
var checks = document.forms[0].elements[key];
if (checks) {
- var vals = $A(hash[key].split('|'));
+ var vals = Array.from(hash[key].split('|'));
if ((vals.length == 1) && (vals[0] == ""))
vals.empty();
if (typeof checks.length == "undefined") {
12 years, 11 months
r4784 - in trunk/cumin/python/cumin: . grid
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-05-25 13:01:06 +0000 (Wed, 25 May 2011)
New Revision: 4784
Modified:
trunk/cumin/python/cumin/grid/job.py
trunk/cumin/python/cumin/objectselector.py
Log:
Suppress exceptions in ObjectSelectorTaskForm.get_selection() when looking up items.
Previously, an exception here would kill the task but leave the form displayed, with
no way out but to modify the URL by hand.
Additionaly, move form straight to cancel state if no items from the selection list are found.
This prevents a form pop up on an empty selection list.
BZ659247
Modified: trunk/cumin/python/cumin/grid/job.py
===================================================================
--- trunk/cumin/python/cumin/grid/job.py 2011-05-24 20:28:55 UTC (rev 4783)
+++ trunk/cumin/python/cumin/grid/job.py 2011-05-25 13:01:06 UTC (rev 4784)
@@ -356,6 +356,7 @@
selection = list(ids)
self.selection.set(session, selection)
+ return len(selection)
def get_reason(self, session, verb):
""" returns <verb> by username[: <user input reason>] """
Modified: trunk/cumin/python/cumin/objectselector.py
===================================================================
--- trunk/cumin/python/cumin/objectselector.py 2011-05-24 20:28:55 UTC (rev 4783)
+++ trunk/cumin/python/cumin/objectselector.py 2011-05-25 13:01:06 UTC (rev 4784)
@@ -518,7 +518,10 @@
self.app.form_page.modes.add_mode(self)
def do_process(self, session):
- self.get_selection(session)
+ # If the selection list is zero length,
+ # set cancel state and let processing complete.
+ if self.get_selection(session) == 0:
+ self.cancel(session)
super(ObjectSelectorTaskForm, self).do_process(session)
def get_selection(self, session):
@@ -527,8 +530,12 @@
self.selection.set(session, selection)
for id in self.ids.get(session):
- item = self.cls.get_object_by_id(session.cursor, id)
- selection.append(item)
+ try:
+ item = self.cls.get_object_by_id(session.cursor, id)
+ selection.append(item)
+ except:
+ pass
+ return len(selection)
def process_submit(self, session):
selection = self.selection.get(session)
12 years, 11 months
r4783 - in trunk: cumin/python/cumin rosemary/python/rosemary
by croberts@fedoraproject.org
Author: croberts
Date: 2011-05-24 20:28:55 +0000 (Tue, 24 May 2011)
New Revision: 4783
Modified:
trunk/cumin/python/cumin/objectselector.py
trunk/rosemary/python/rosemary/util.py
Log:
Fix for human-readable uptime hours/days calculation.
Modified: trunk/cumin/python/cumin/objectselector.py
===================================================================
--- trunk/cumin/python/cumin/objectselector.py 2011-05-24 18:01:45 UTC (rev 4782)
+++ trunk/cumin/python/cumin/objectselector.py 2011-05-24 20:28:55 UTC (rev 4783)
@@ -560,10 +560,12 @@
class MonitorSelfAgeColumn(ObjectTableColumn):
def render_cell_content(self, session, record):
- mins, secs = divmod(self.field.get_content(session, record), 60)
- hours, mins = divmod(mins, 60)
- days = hours / 24
- return '%02d:%02d:%02d:%02d' % (days, hours, mins, secs)
+ value = self.field.get_content(session, record)
+ days = value / 86400
+ hours = (value / 3600) - (days * 24)
+ minutes = (value / 60) - (days * 1440) - (hours * 60)
+ seconds = value % 60
+ return '%02d:%02d:%02d:%02d' % (days, hours, minutes, seconds)
class ExportButton(Widget):
def __init__(self, app, name, args, exporter, file_name):
Modified: trunk/rosemary/python/rosemary/util.py
===================================================================
--- trunk/rosemary/python/rosemary/util.py 2011-05-24 18:01:45 UTC (rev 4782)
+++ trunk/rosemary/python/rosemary/util.py 2011-05-24 20:28:55 UTC (rev 4783)
@@ -17,7 +17,8 @@
return fmt_bytes(value * 1024)
def fmt_timestamp_ddhhmmss(value):
- mins, secs = divmod(value, 60)
- hours, mins = divmod(mins, 60)
- days = hours / 24
- return '%02d:%02d:%02d:%02d' % (days, hours, mins, secs)
\ No newline at end of file
+ days = value / 86400
+ hours = (value / 3600) - (days * 24)
+ minutes = (value / 60) - (days * 1440) - (hours * 60)
+ seconds = value % 60
+ return '%02d:%02d:%02d:%02d' % (days, hours, minutes, seconds)
\ No newline at end of file
12 years, 11 months