r5023 - trunk/wooly/resources
by croberts@fedoraproject.org
Author: croberts
Date: 2011-09-28 14:52:08 +0000 (Wed, 28 Sep 2011)
New Revision: 5023
Modified:
trunk/wooly/resources/mootools.js
Log:
Some changes for the hybrid filtered select widget. The clear button will now clear the filter box and unselect everything. In addition, each time you change your filter, your selections will be reset. Also, fixing the "counting" bug that would occasionally pop-up when selecting/unselecting/filtering things.
Modified: trunk/wooly/resources/mootools.js
===================================================================
--- trunk/wooly/resources/mootools.js 2011-09-28 12:54:17 UTC (rev 5022)
+++ trunk/wooly/resources/mootools.js 2011-09-28 14:52:08 UTC (rev 5023)
@@ -1867,6 +1867,7 @@
item.selected = false;
}
);
+ this.filterbox.value = "";
this.fireEvent('rebuild', [this.options.datasrc.getChildren()]);
this.update(0);
return false;
@@ -1875,14 +1876,22 @@
// list is the list of option dom elements from the select elem
// test is a function that gets used in the filter
filter: function(list, test, reset){
+ var matched = false;
+ var num_unselected = 0;
results = list.filter(function(item, index){
- return test(item);
+ matched = test(item);
+ if(!matched && item.selected) {
+ item.selected = false;
+ num_unselected++;
+ }
+ return matched;
});
if(reset){
this.filterbox.value = "";
}
this.fireEvent('rebuild', [results]);
+ this.update(this.numselected - num_unselected);
return results; //returning in the even that someone wants to do a filter(...).each()
},
@@ -1909,6 +1918,7 @@
},
update: function(numselected){
+ this.numselected = numselected;
var total = this.options.datasrc.getChildren().length;
this.totalbtn.getElement('span').set('text', total);
this.selectedbtn.getElement('span').set('text', numselected);
12 years, 8 months
r5022 - trunk/cumin/bin
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-09-28 12:54:17 +0000 (Wed, 28 Sep 2011)
New Revision: 5022
Modified:
trunk/cumin/bin/cumin-admin
Log:
Exception handler syntax not valid for Python 2.4
BZ741729
Modified: trunk/cumin/bin/cumin-admin
===================================================================
--- trunk/cumin/bin/cumin-admin 2011-09-27 21:10:13 UTC (rev 5021)
+++ trunk/cumin/bin/cumin-admin 2011-09-28 12:54:17 UTC (rev 5022)
@@ -250,7 +250,7 @@
def handle_check_schema(app, cursor, opts, args):
try:
schema_version = app.admin.check_schema(cursor)
- except Exception as e:
+ except Exception, e:
error(str(e))
print "The schema is OK (schema version %s)" % schema_version
12 years, 8 months
r5021 - in trunk/cumin: model model/upgrades python/cumin
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-09-27 21:10:13 +0000 (Tue, 27 Sep 2011)
New Revision: 5021
Added:
trunk/cumin/model/upgrades/1.0_to_1.1
Modified:
trunk/cumin/model/rosemary.xml
trunk/cumin/python/cumin/admin.py
Log:
Change the schema version in admin.py to 1.1
Make the Name field an index on the Submission table in the new schema.
Add a schema upgrade script to create the index for existing cumin DBs with schema version 1.0
BZ741783
Modified: trunk/cumin/model/rosemary.xml
===================================================================
--- trunk/cumin/model/rosemary.xml 2011-09-27 20:06:40 UTC (rev 5020)
+++ trunk/cumin/model/rosemary.xml 2011-09-27 21:10:13 UTC (rev 5021)
@@ -498,6 +498,7 @@
</class>
<class name="Submission">
+ <index name="Name" attributes="Name"/>
<property name="Name">
<title>Description</title>
</property>
Added: trunk/cumin/model/upgrades/1.0_to_1.1
===================================================================
--- trunk/cumin/model/upgrades/1.0_to_1.1 (rev 0)
+++ trunk/cumin/model/upgrades/1.0_to_1.1 2011-09-27 21:10:13 UTC (rev 5021)
@@ -0,0 +1,2 @@
+#!/bin/bash
+echo create index \"Submission_Name_idx\" on \"com.redhat.grid\".\"Submission\"\(\"Name\"\) | psql -d cumin -U cumin -h localhost
Property changes on: trunk/cumin/model/upgrades/1.0_to_1.1
___________________________________________________________________
Added: svn:executable
+ *
Modified: trunk/cumin/python/cumin/admin.py
===================================================================
--- trunk/cumin/python/cumin/admin.py 2011-09-27 20:06:40 UTC (rev 5020)
+++ trunk/cumin/python/cumin/admin.py 2011-09-27 21:10:13 UTC (rev 5021)
@@ -5,7 +5,7 @@
log = logging.getLogger("cumin.admin")
-schema_version = "1.0"
+schema_version = "1.1"
class CuminAdmin(object):
def __init__(self, app):
12 years, 8 months
r5020 - in trunk/cumin: bin etc
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-09-27 20:06:40 +0000 (Tue, 27 Sep 2011)
New Revision: 5020
Modified:
trunk/cumin/bin/cumin-admin
trunk/cumin/etc/sysvinit-cumin
Log:
Add a schema version check to cumin service start and suggest cumin-admin upgrade-schema
if there is a failure
BZ741729
Modified: trunk/cumin/bin/cumin-admin
===================================================================
--- trunk/cumin/bin/cumin-admin 2011-09-27 19:59:08 UTC (rev 5019)
+++ trunk/cumin/bin/cumin-admin 2011-09-27 20:06:40 UTC (rev 5020)
@@ -120,10 +120,6 @@
lines.append(" upgrade-schema Run utility scripts to upgrade the schema to")
lines.append(" the expected version if necessary")
-# upgrade
-
-# add an external link redirection for changing external paswords in 2.2?
-
return "\n".join(lines)
def confirm(prompt, resp=False):
@@ -252,7 +248,10 @@
print "The schema is created"
def handle_check_schema(app, cursor, opts, args):
- schema_version = app.admin.check_schema(cursor)
+ try:
+ schema_version = app.admin.check_schema(cursor)
+ except Exception as e:
+ error(str(e))
print "The schema is OK (schema version %s)" % schema_version
Modified: trunk/cumin/etc/sysvinit-cumin
===================================================================
--- trunk/cumin/etc/sysvinit-cumin 2011-09-27 19:59:08 UTC (rev 5019)
+++ trunk/cumin/etc/sysvinit-cumin 2011-09-27 20:06:40 UTC (rev 5020)
@@ -41,6 +41,12 @@
exit 1
}
+ test -x /usr/bin/cumin-admin || {
+ echo_failure; echo
+ echo "/usr/bin/cumin-admin has been removed"
+ exit 1
+ }
+
# Initial checks for the start case
cumin-database check-started &> /dev/null || {
echo_failure; echo
@@ -60,6 +66,15 @@
exit 1
}
+ cumin-admin check-schema &> /dev/null || {
+ # Run again with output left on for user.
+ echo_failure; echo
+ echo "Run 'cumin-admin upgrade-schema' for available upgrades"
+ echo "(detailed output from cumin-admin check-schema:)"
+ cumin-admin check-schema
+ exit 1
+ }
+
# If it's already running, be happy and return success
status $processname &> /dev/null
[ $? -eq 0 ] && echo_success && echo && return
12 years, 8 months
r5019 - trunk/cumin/python/cumin/inventory
by croberts@fedoraproject.org
Author: croberts
Date: 2011-09-27 19:59:08 +0000 (Tue, 27 Sep 2011)
New Revision: 5019
Modified:
trunk/cumin/python/cumin/inventory/system.py
Log:
Removing the 0 that was being incorrectly reported for wallaby-only nodes.
Modified: trunk/cumin/python/cumin/inventory/system.py
===================================================================
--- trunk/cumin/python/cumin/inventory/system.py 2011-09-27 19:26:45 UTC (rev 5018)
+++ trunk/cumin/python/cumin/inventory/system.py 2011-09-27 19:59:08 UTC (rev 5019)
@@ -41,8 +41,10 @@
self.add_attribute_column(cls.osName)
self.add_attribute_column(cls.machine)
self.add_attribute_column(cls.memFree)
- self.add_attribute_column(cls.loadAverage1Min)
+ col = self.LoadAverageColumn(app, "loadavg", cls.loadAverage1Min)
+ self.add_column(col)
+
col = SystemTagsColumn(app, "Tags", app.model.com_redhat_cumin_grid.Node.Tags, "Tags")
self.add_column(col)
@@ -51,6 +53,14 @@
self.enable_csv_export()
+ class LoadAverageColumn(ObjectTableColumn):
+ def render_cell_content(self, session, data):
+ content = data[self.table.adapter.fields_by_name['loadAverage1Min'].index]
+ return content
+
+ def render_header_content(self, session):
+ return "Load average"
+
class SystemFrame(ObjectFrame):
def __init__(self, app, name):
cls = app.model.com_redhat_sesame.Sysimage
@@ -280,7 +290,7 @@
sqldata[match_index[0]] = tuple(new_record)
else:
# there was no match found, add a wallaby-only row
- data_row = tuple([node.name, node.name, "", "", "", 0, ", ".join(self.app.wallaby.get_tag_names(node)), node.last_checkin])
+ data_row = tuple([node.name, node.name, "", "", "", "", ", ".join(self.app.wallaby.get_tag_names(node)), node.last_checkin])
sqldata.append(data_row)
data = sqldata
elif len(sqldata) > 0: # we only have sesame data
@@ -292,7 +302,7 @@
for node in wallaby_nodes:
# using the node name for the [0] element in this case will allow
#other pages to use the id as the node lookup key against the wallaby data
- data_row = tuple([node.name, node.name, "", "", "", 0, ", ".join(self.app.wallaby.get_tag_names(node)), node.last_checkin])
+ data_row = tuple([node.name, node.name, "", "", "", "", ", ".join(self.app.wallaby.get_tag_names(node)), node.last_checkin])
data.append(data_row)
options.sort_field = requested_sort_field
12 years, 8 months
r5018 - in trunk/cumin: . model
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-09-27 19:26:45 +0000 (Tue, 27 Sep 2011)
New Revision: 5018
Added:
trunk/cumin/model/upgrades/
Modified:
trunk/cumin/Makefile
Log:
Add model/upgrades directory to standard install
BZ741729
Modified: trunk/cumin/Makefile
===================================================================
--- trunk/cumin/Makefile 2011-09-27 19:07:06 UTC (rev 5017)
+++ trunk/cumin/Makefile 2011-09-27 19:26:45 UTC (rev 5018)
@@ -25,8 +25,9 @@
install -pm 0644 LICENSE COPYING ${CUMIN_HOME}/doc
install -pm 0644 ../wooly/LICENSE-for-wsgiserver ${CUMIN_HOME}/doc
install -pm 0644 ../wooly/COPYING-for-wsgiserver ${CUMIN_HOME}/doc
- install -d ${CUMIN_HOME}/model
+ install -d ${CUMIN_HOME}/model/upgrades
install -pm 0644 model/*.xml ${CUMIN_HOME}/model
+ - install -pm 0755 model/upgrades/* ${CUMIN_HOME}/model/upgrades/
install -d ${CUMIN_HOME}/resources
install -pm 0644 ../wooly/resources/* ${CUMIN_HOME}/resources
install -pm 0644 resources/* ${CUMIN_HOME}/resources
12 years, 8 months
r5017 - in trunk/cumin: bin python/cumin
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-09-27 19:07:06 +0000 (Tue, 27 Sep 2011)
New Revision: 5017
Modified:
trunk/cumin/bin/cumin-admin
trunk/cumin/python/cumin/admin.py
Log:
Add a general schema upgrade mechanism for cumin
Modified: trunk/cumin/bin/cumin-admin
===================================================================
--- trunk/cumin/bin/cumin-admin 2011-09-27 19:04:09 UTC (rev 5016)
+++ trunk/cumin/bin/cumin-admin 2011-09-27 19:07:06 UTC (rev 5017)
@@ -3,6 +3,8 @@
import os
import sys
import csv
+import subprocess
+from subprocess import PIPE
from psycopg2 import IntegrityError
@@ -115,7 +117,13 @@
lines.append(" create-schema Create schema objects")
lines.append(" drop-schema Drop schema and all data")
lines.append(" print-schema Print the schema definition")
+ lines.append(" upgrade-schema Run utility scripts to upgrade the schema to")
+ lines.append(" the expected version if necessary")
+
+# upgrade
+# add an external link redirection for changing external paswords in 2.2?
+
return "\n".join(lines)
def confirm(prompt, resp=False):
@@ -134,9 +142,107 @@
continue
return ans in ('y', 'yes')
+def get_upgrade_map(upgrade_dir):
+ res = defaultdict(list)
+ try:
+ scripts = os.listdir(upgrade_dir)
+ except:
+ # Hmm, dir or path is messed up
+ return res
+
+ for s in scripts:
+ if "_to_" in s:
+ v1, v2 = s.split("_to_")
+ res[v1].append(v2)
+ for k,v in res.iteritems():
+ v.sort()
+ return res
+
+def find_upgrade_path(upgrades, curr, target):
+ # upgrades is a dictionary of sorted lists where
+ # each entry represents possible movement
+ # from one schema version (the key) to one or more
+ # other versions.
+ res = []
+ while True:
+ if curr not in upgrades:
+ # Can't finish, no path
+ return []
+
+ # Always make the biggest jump forward in version that we can
+ # (to keep it simple) even though there might be another
+ # possible solution.
+ latest = None
+ for v in upgrades[curr]:
+ if v <= target:
+ latest = v
+
+ if latest == None:
+ # Can't finish, no path
+ return []
+
+ # Add the version jumps to the upgrade path
+ res.append((curr, latest))
+
+ if latest == target:
+ # We're done!
+ return res
+ else:
+ # Look for the next jump
+ curr = latest
+
def handle_print_schema(app, cursor, opts, args):
print app.admin.get_schema(),
+def handle_upgrade_schema(app, cursor, opts, args):
+ curr = app.admin.get_schema_version(cursor)
+ target = app.admin.get_target_schema_version()
+ if curr == target:
+ print "The schema is already version %s, nothing to do" % target
+
+ elif curr > target:
+ print "This version of cumin-admin can upgrade the schema to version %s" % target
+ print "The schema version is already %s" % curr
+ print "Have you been using a newer version of cumin?"
+ print "In order to use this version of cumin you will have to recreate the schema"
+
+ else:
+ print "Attempting to upgrade the schema from %s to %s" % (curr, target)
+ upgrade_dir = os.path.join(app.home, "model/upgrades")
+ upgrade_path = find_upgrade_path(get_upgrade_map(upgrade_dir),
+ curr, target)
+ if not upgrade_path:
+ print "Could not find an upgrade path from %s to %s in %s" % \
+ (curr, target, upgrade_dir)
+ else:
+
+ if not confirm("Found an update path. Alter the schema?", True):
+ print "No action taken"
+ return
+
+ for steps in upgrade_path:
+ script = os.path.join(upgrade_dir, steps[0]+"_to_"+steps[1])
+ print "Executing script %s" % script
+
+ cmd = [script]
+ res = subprocess.Popen(cmd, stdout=PIPE, stderr=PIPE)
+ out, err = res.communicate()
+ if res.returncode != 0:
+ print "Script exited with error code %s" % res.returncode
+ if out:
+ print "Script stdout:\n%s" % out
+ if err:
+ print "Script stderr:\n%s" % err
+ break
+ else:
+ app.admin.update_schema_version(cursor, steps[1])
+
+ curr = app.admin.get_schema_version(cursor)
+ if curr != target:
+ print "Upgrade failed, schema is version %s" % curr
+ else:
+ print "Upgrade to schema version %s succeeded" % target
+
def handle_create_schema(app, cursor, opts, args):
app.admin.create_schema(cursor)
Modified: trunk/cumin/python/cumin/admin.py
===================================================================
--- trunk/cumin/python/cumin/admin.py 2011-09-27 19:04:09 UTC (rev 5016)
+++ trunk/cumin/python/cumin/admin.py 2011-09-27 19:07:06 UTC (rev 5017)
@@ -26,6 +26,22 @@
obj.fake_qmf_values()
obj.save(cursor)
+ def update_schema_version(self, cursor, version):
+ cls = self.app.model.com_redhat_cumin.Info
+ info = cls.get_object(cursor)
+ info.schema_version = version
+ info.save(cursor)
+
+ def get_schema_version(self, cursor):
+ cls = self.app.model.com_redhat_cumin.Info
+ info = cls.get_object(cursor)
+ if not info:
+ raise Exception("The schema isn't there")
+ return info.schema_version
+
+ def get_target_schema_version(self):
+ return schema_version
+
def check_schema(self, cursor):
cls = self.app.model.com_redhat_cumin.Info
info = cls.get_object(cursor)
@@ -99,3 +115,4 @@
mapping.save(cursor)
return mapping
+
12 years, 8 months
r5016 - trunk/cumin/python/cumin/grid
by croberts@fedoraproject.org
Author: croberts
Date: 2011-09-27 19:04:09 +0000 (Tue, 27 Sep 2011)
New Revision: 5016
Modified:
trunk/cumin/python/cumin/grid/tags.py
Log:
All of the forms for tag-related functionality are now of the "mform" class, in addition to ButtonForm. This gives us the nicer looking submit buttons.
Modified: trunk/cumin/python/cumin/grid/tags.py
===================================================================
--- trunk/cumin/python/cumin/grid/tags.py 2011-09-27 18:24:06 UTC (rev 5015)
+++ trunk/cumin/python/cumin/grid/tags.py 2011-09-27 19:04:09 UTC (rev 5016)
@@ -477,6 +477,9 @@
def render_title(self, session):
''' appears in the top "bar" of the form display '''
return "Activate pool configuration"
+
+ def render_form_class(self, session):
+ return " ".join((super(ActivateConfigurationForm, self).render_form_class(session), "mform"))
class LabelField(Label):
''' this is just text that appears in place of actual form fields '''
@@ -522,6 +525,9 @@
def render_title(self, session):
return("Tag names ")
+ def render_form_class(self, session):
+ return " ".join((super(CreateTags, self).render_form_class(session), "mform"))
+
class RemoveTags(ObjectSelectorTaskForm):
'''
This form is used to allow the user to pick a set of tags to be removed.
@@ -555,6 +561,9 @@
def render_title(self, session):
return "Delete tags"
+
+ def render_form_class(self, session):
+ return " ".join((super(RemoveTags, self).render_form_class(session), "mform"))
class TagSelectField(FormField):
'''
12 years, 8 months
r5015 - trunk/cumin/python/cumin/grid
by croberts@fedoraproject.org
Author: croberts
Date: 2011-09-27 18:24:06 +0000 (Tue, 27 Sep 2011)
New Revision: 5015
Modified:
trunk/cumin/python/cumin/grid/tags.py
Log:
Enabling csv export for the tags table.
Modified: trunk/cumin/python/cumin/grid/tags.py
===================================================================
--- trunk/cumin/python/cumin/grid/tags.py 2011-09-27 18:21:39 UTC (rev 5014)
+++ trunk/cumin/python/cumin/grid/tags.py 2011-09-27 18:24:06 UTC (rev 5015)
@@ -312,6 +312,8 @@
RemoveNodeTags(app, self, "removetags")
+ self.enable_csv_export()
+
def render_title(self, session):
return "Configuration"
12 years, 8 months
r5014 - trunk/cumin/python/cumin
by croberts@fedoraproject.org
Author: croberts
Date: 2011-09-27 18:21:39 +0000 (Tue, 27 Sep 2011)
New Revision: 5014
Modified:
trunk/cumin/python/cumin/objectselector.strings
trunk/cumin/python/cumin/widgets.strings
Log:
Removing colon after "act on selection".
Modified: trunk/cumin/python/cumin/objectselector.strings
===================================================================
--- trunk/cumin/python/cumin/objectselector.strings 2011-09-27 18:06:14 UTC (rev 5013)
+++ trunk/cumin/python/cumin/objectselector.strings 2011-09-27 18:21:39 UTC (rev 5014)
@@ -95,7 +95,7 @@
[ObjectSelectorButtons.html]
<div class="{class}">
- <span>Act on selection:</span>
+ <span>Act on selection</span>
<ul>{widgets}</ul>
</div>
Modified: trunk/cumin/python/cumin/widgets.strings
===================================================================
--- trunk/cumin/python/cumin/widgets.strings 2011-09-27 18:06:14 UTC (rev 5013)
+++ trunk/cumin/python/cumin/widgets.strings 2011-09-27 18:21:39 UTC (rev 5014)
@@ -624,7 +624,7 @@
<form method="post" action="?">
<div class="sactions">
- <h2>Act on selection:</h2>
+ <h2>Act on selection</h2>
{buttons}
</div>
12 years, 8 months