r4465 - branches/1.3.2/wooly/python/wooly
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-01-13 16:22:09 +0000 (Thu, 13 Jan 2011)
New Revision: 4465
Modified:
branches/1.3.2/wooly/python/wooly/datatable.strings
Log:
Merge revisions 4463 and 4464 from trunk.
BZ626972
Modified: branches/1.3.2/wooly/python/wooly/datatable.strings
===================================================================
--- branches/1.3.2/wooly/python/wooly/datatable.strings 2011-01-13 14:49:05 UTC (rev 4464)
+++ branches/1.3.2/wooly/python/wooly/datatable.strings 2011-01-13 16:22:09 UTC (rev 4465)
@@ -9,13 +9,18 @@
margin: 0 0 0 2em;
}
+table.DataTable th.controls div.paginator span.selectorOptions {
+ /* allow page number to wrap to next line */
+ white-space: normal;
+}
+
[DataTableHeader.html]
<thead>
<tr>
<th colspan="{colspan}" class="controls">
<div class="right">{limit}</div>
<div class="right">{font}</div>
- {page}
+ <div class="paginator">{page}</div>
</th>
</tr>
<tr>{headers}</tr>
@@ -32,4 +37,4 @@
[DataTableSelector.html]
<span>{title}</span>
-<span>{options}</span>
+<span class="selectorOptions">{options}</span>
13 years, 3 months
r4464 - trunk/wooly/python/wooly
by eallen@fedoraproject.org
Author: eallen
Date: 2011-01-13 14:49:05 +0000 (Thu, 13 Jan 2011)
New Revision: 4464
Modified:
trunk/wooly/python/wooly/datatable.py
Log:
For BZ 626972: Removed debugging value accidentally that was left in
Modified: trunk/wooly/python/wooly/datatable.py
===================================================================
--- trunk/wooly/python/wooly/datatable.py 2011-01-13 14:47:37 UTC (rev 4463)
+++ trunk/wooly/python/wooly/datatable.py 2011-01-13 14:49:05 UTC (rev 4464)
@@ -253,7 +253,7 @@
return "Font"
class DataTablePageSelector(DataTableSelector):
- max_page_links = 99
+ max_page_links = 16
def get_options(self, session):
# number of items in the table
13 years, 3 months
r4463 - trunk/wooly/python/wooly
by eallen@fedoraproject.org
Author: eallen
Date: 2011-01-13 14:47:37 +0000 (Thu, 13 Jan 2011)
New Revision: 4463
Modified:
trunk/wooly/python/wooly/datatable.py
trunk/wooly/python/wooly/datatable.strings
Log:
For BZ 626972: Allowed page numbers to wrap to multiple lines when screen is sliverfied.
Modified: trunk/wooly/python/wooly/datatable.py
===================================================================
--- trunk/wooly/python/wooly/datatable.py 2011-01-12 22:25:28 UTC (rev 4462)
+++ trunk/wooly/python/wooly/datatable.py 2011-01-13 14:47:37 UTC (rev 4463)
@@ -253,7 +253,7 @@
return "Font"
class DataTablePageSelector(DataTableSelector):
- max_page_links = 16
+ max_page_links = 99
def get_options(self, session):
# number of items in the table
Modified: trunk/wooly/python/wooly/datatable.strings
===================================================================
--- trunk/wooly/python/wooly/datatable.strings 2011-01-12 22:25:28 UTC (rev 4462)
+++ trunk/wooly/python/wooly/datatable.strings 2011-01-13 14:47:37 UTC (rev 4463)
@@ -9,13 +9,18 @@
margin: 0 0 0 2em;
}
+table.DataTable th.controls div.paginator span.selectorOptions {
+ /* allow page number to wrap to next line */
+ white-space: normal;
+}
+
[DataTableHeader.html]
<thead>
<tr>
<th colspan="{colspan}" class="controls">
<div class="right">{limit}</div>
<div class="right">{font}</div>
- {page}
+ <div class="paginator">{page}</div>
</th>
</tr>
<tr>{headers}</tr>
@@ -32,4 +37,4 @@
[DataTableSelector.html]
<span>{title}</span>
-<span>{options}</span>
+<span class="selectorOptions">{options}</span>
13 years, 3 months
r4462 - in branches/1.3.2: cumin/bin cumin/python/cumin/grid wooly/python/wooly
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-01-12 22:25:28 +0000 (Wed, 12 Jan 2011)
New Revision: 4462
Modified:
branches/1.3.2/cumin/bin/cumin-web
branches/1.3.2/cumin/python/cumin/grid/pool.py
branches/1.3.2/wooly/python/wooly/datatable.py
branches/1.3.2/wooly/python/wooly/widgets.py
branches/1.3.2/wooly/python/wooly/widgets.strings
Log:
Merged revisions 4457 and 4461 from trunk.
Revision 4461 is for BZ 626972
Modified: branches/1.3.2/cumin/bin/cumin-web
===================================================================
--- branches/1.3.2/cumin/bin/cumin-web 2011-01-12 20:28:21 UTC (rev 4461)
+++ branches/1.3.2/cumin/bin/cumin-web 2011-01-12 22:25:28 UTC (rev 4462)
@@ -17,7 +17,7 @@
parser = CuminOptionParser(values.web)
parser.add_option("--host", default=values.web.host)
- parser.add_option("--port", default=values.web.port)
+ parser.add_option("--port", default=values.web.port, type=int)
opts, args = parser.parse_args()
Modified: branches/1.3.2/cumin/python/cumin/grid/pool.py
===================================================================
--- branches/1.3.2/cumin/python/cumin/grid/pool.py 2011-01-12 20:28:21 UTC (rev 4461)
+++ branches/1.3.2/cumin/python/cumin/grid/pool.py 2011-01-12 22:25:28 UTC (rev 4462)
@@ -160,6 +160,7 @@
self.add_child(chart)
chart = self.SlotFlashChart(app, "slots", self.collector)
+ chart.duration.param.default = "3600"
chart.stats = ("HostsClaimed", "HostsUnclaimed", "HostsOwner")
chart.chart_type = "stacked"
self.add_child(chart)
Modified: branches/1.3.2/wooly/python/wooly/datatable.py
===================================================================
--- branches/1.3.2/wooly/python/wooly/datatable.py 2011-01-12 20:28:21 UTC (rev 4461)
+++ branches/1.3.2/wooly/python/wooly/datatable.py 2011-01-12 22:25:28 UTC (rev 4462)
@@ -111,6 +111,12 @@
options.limit = self.header.limit.get(session)
options.offset = self.header.offset.get(session)
+ # make sure offset is a multiple of limit
+ # this happens sometimes when we change limits
+ if options.offset % options.limit:
+ options.offset = (options.offset / options.limit) * options.limit
+ self.header.offset.set(session, options.offset)
+
return options
def get_count(self, session):
@@ -230,6 +236,9 @@
if self.parent.selection.get(session) == option[0]:
return "selected"
+ def render_title(self, session, option):
+ return option[2]
+
def edit_session(self, session, option):
self.parent.selection.set(session, option[0])
@@ -238,26 +247,65 @@
class DataTableFontSelector(DataTableSelector):
def get_options(self, session):
- return ((0.8, "S"), (0.9, "M"), (1.0, "L"))
+ return ((0.8, "S", "Small"), (0.9, "M", "Medium"), (1.0, "L", "Large"))
def render_title(self, session):
return "Font"
class DataTablePageSelector(DataTableSelector):
+ max_page_links = 16
+
def get_options(self, session):
+ # number of items in the table
count = self.table.count.get(session)
+ if not count:
+ return []
+
+ # number of items per page
limit = self.table.header.limit.get(session)
- count = min(count, 20 * limit)
+ # info for each possible page of results
+ options = [(x[1], x[0] + 1, "Goto Page %i" % (x[0] + 1, )) for x in enumerate(range(0, count, limit))]
- return [(x[1], x[0] + 1) for x in enumerate(range(0, count, limit))]
+ # the starting item on the current page
+ selection = self.selection.get(session)
+ #find the index of the current page
+ cur_page = 0
+ for page in options:
+ if selection == page[0]:
+ cur_page = page[1] - 1
+ break
+
+ pages = list()
+
+ # adjust the page links shown so that the current page is in the list
+ first_page = max(cur_page - 1, 0)
+ last_page = min(first_page + self.max_page_links, len(options))
+ first_page = max(last_page - self.max_page_links, 0)
+
+ if first_page:
+ pages.append((0, "«", "First Page"))
+ prev = max(selection - limit, 0)
+ pages.append((prev, "‹", "Previous Page"))
+
+ pages.extend(options[first_page : last_page])
+
+ if last_page < len(options):
+ next = options[cur_page + 1][0]
+ pages.append((next, "›", "Next Page"))
+
+ last = options[len(options) - 1][0]
+ pages.append((last, "»", "Last Page"))
+
+ return pages
+
def render_title(self, session):
- return "Page"
+ return self.table.count.get(session) and "Page" or ""
class DataTableLimitSelector(DataTableSelector):
def get_options(self, session):
- return ((25, 25), (50, 50), (100, 100))
+ return ((25, 25, "25 items per page"), (50, 50, "50 items per page"), (100, 100, "100 items per page"))
def render_title(self, session):
return "Limit"
Modified: branches/1.3.2/wooly/python/wooly/widgets.py
===================================================================
--- branches/1.3.2/wooly/python/wooly/widgets.py 2011-01-12 20:28:21 UTC (rev 4461)
+++ branches/1.3.2/wooly/python/wooly/widgets.py 2011-01-12 22:25:28 UTC (rev 4462)
@@ -131,6 +131,9 @@
self.edit_session(branch, *args)
return branch.marshal()
+ def render_title(self, session, *args):
+ return ""
+
class Toggle(Link):
def __init__(self, app, name):
super(Toggle, self).__init__(app, name)
Modified: branches/1.3.2/wooly/python/wooly/widgets.strings
===================================================================
--- branches/1.3.2/wooly/python/wooly/widgets.strings 2011-01-12 20:28:21 UTC (rev 4461)
+++ branches/1.3.2/wooly/python/wooly/widgets.strings 2011-01-12 22:25:28 UTC (rev 4462)
@@ -67,7 +67,7 @@
<li>{link}</li>
[Link.html]
-<a class="{class}" href="{href}">{content}</a>
+<a class="{class}" href="{href}" title="{title}">{content}</a>
[Toggle.css]
a.Toggle.on {
13 years, 3 months
r4461 - in trunk: cumin/python/cumin/grid wooly/python/wooly
by eallen@fedoraproject.org
Author: eallen
Date: 2011-01-12 20:28:21 +0000 (Wed, 12 Jan 2011)
New Revision: 4461
Modified:
trunk/cumin/python/cumin/grid/pool.py
trunk/wooly/python/wooly/datatable.py
trunk/wooly/python/wooly/widgets.py
trunk/wooly/python/wooly/widgets.strings
Log:
For BZ 626972: Implement First, Previous, Next and Last page links for tables.
Modified: trunk/cumin/python/cumin/grid/pool.py
===================================================================
--- trunk/cumin/python/cumin/grid/pool.py 2011-01-12 18:13:26 UTC (rev 4460)
+++ trunk/cumin/python/cumin/grid/pool.py 2011-01-12 20:28:21 UTC (rev 4461)
@@ -160,6 +160,7 @@
self.add_child(chart)
chart = self.SlotFlashChart(app, "slots", self.collector)
+ chart.duration.param.default = "3600"
chart.stats = ("HostsClaimed", "HostsUnclaimed", "HostsOwner")
chart.chart_type = "stacked"
self.add_child(chart)
Modified: trunk/wooly/python/wooly/datatable.py
===================================================================
--- trunk/wooly/python/wooly/datatable.py 2011-01-12 18:13:26 UTC (rev 4460)
+++ trunk/wooly/python/wooly/datatable.py 2011-01-12 20:28:21 UTC (rev 4461)
@@ -111,6 +111,12 @@
options.limit = self.header.limit.get(session)
options.offset = self.header.offset.get(session)
+ # make sure offset is a multiple of limit
+ # this happens sometimes when we change limits
+ if options.offset % options.limit:
+ options.offset = (options.offset / options.limit) * options.limit
+ self.header.offset.set(session, options.offset)
+
return options
def get_count(self, session):
@@ -230,6 +236,9 @@
if self.parent.selection.get(session) == option[0]:
return "selected"
+ def render_title(self, session, option):
+ return option[2]
+
def edit_session(self, session, option):
self.parent.selection.set(session, option[0])
@@ -238,26 +247,65 @@
class DataTableFontSelector(DataTableSelector):
def get_options(self, session):
- return ((0.8, "S"), (0.9, "M"), (1.0, "L"))
+ return ((0.8, "S", "Small"), (0.9, "M", "Medium"), (1.0, "L", "Large"))
def render_title(self, session):
return "Font"
class DataTablePageSelector(DataTableSelector):
+ max_page_links = 16
+
def get_options(self, session):
+ # number of items in the table
count = self.table.count.get(session)
+ if not count:
+ return []
+
+ # number of items per page
limit = self.table.header.limit.get(session)
- count = min(count, 20 * limit)
+ # info for each possible page of results
+ options = [(x[1], x[0] + 1, "Goto Page %i" % (x[0] + 1, )) for x in enumerate(range(0, count, limit))]
- return [(x[1], x[0] + 1) for x in enumerate(range(0, count, limit))]
+ # the starting item on the current page
+ selection = self.selection.get(session)
+ #find the index of the current page
+ cur_page = 0
+ for page in options:
+ if selection == page[0]:
+ cur_page = page[1] - 1
+ break
+
+ pages = list()
+
+ # adjust the page links shown so that the current page is in the list
+ first_page = max(cur_page - 1, 0)
+ last_page = min(first_page + self.max_page_links, len(options))
+ first_page = max(last_page - self.max_page_links, 0)
+
+ if first_page:
+ pages.append((0, "«", "First Page"))
+ prev = max(selection - limit, 0)
+ pages.append((prev, "‹", "Previous Page"))
+
+ pages.extend(options[first_page : last_page])
+
+ if last_page < len(options):
+ next = options[cur_page + 1][0]
+ pages.append((next, "›", "Next Page"))
+
+ last = options[len(options) - 1][0]
+ pages.append((last, "»", "Last Page"))
+
+ return pages
+
def render_title(self, session):
- return "Page"
+ return self.table.count.get(session) and "Page" or ""
class DataTableLimitSelector(DataTableSelector):
def get_options(self, session):
- return ((25, 25), (50, 50), (100, 100))
+ return ((25, 25, "25 items per page"), (50, 50, "50 items per page"), (100, 100, "100 items per page"))
def render_title(self, session):
return "Limit"
Modified: trunk/wooly/python/wooly/widgets.py
===================================================================
--- trunk/wooly/python/wooly/widgets.py 2011-01-12 18:13:26 UTC (rev 4460)
+++ trunk/wooly/python/wooly/widgets.py 2011-01-12 20:28:21 UTC (rev 4461)
@@ -131,6 +131,9 @@
self.edit_session(branch, *args)
return branch.marshal()
+ def render_title(self, session, *args):
+ return ""
+
class Toggle(Link):
def __init__(self, app, name):
super(Toggle, self).__init__(app, name)
Modified: trunk/wooly/python/wooly/widgets.strings
===================================================================
--- trunk/wooly/python/wooly/widgets.strings 2011-01-12 18:13:26 UTC (rev 4460)
+++ trunk/wooly/python/wooly/widgets.strings 2011-01-12 20:28:21 UTC (rev 4461)
@@ -67,7 +67,7 @@
<li>{link}</li>
[Link.html]
-<a class="{class}" href="{href}">{content}</a>
+<a class="{class}" href="{href}" title="{title}">{content}</a>
[Toggle.css]
a.Toggle.on {
13 years, 3 months
r4460 - in trunk/cumin: . bin python/cumin
by jross@fedoraproject.org
Author: jross
Date: 2011-01-12 18:13:26 +0000 (Wed, 12 Jan 2011)
New Revision: 4460
Added:
trunk/cumin/bin/cumin-command-test
trunk/cumin/bin/cumin-data-test
trunk/cumin/bin/cumin-web-test
Modified:
trunk/cumin/Makefile
trunk/cumin/bin/cumin-admin
trunk/cumin/bin/cumin-admin-test
trunk/cumin/bin/cumin-bench
trunk/cumin/bin/cumin-data
trunk/cumin/bin/cumin-smoke-test
trunk/cumin/bin/cumin-test
trunk/cumin/bin/cumin-web
trunk/cumin/python/cumin/config.py
Log:
* Extend logging utility functions to support disabling logging
* Introduce two-stage logging setup, to ensure we have a useful
logging config during program initialization
* Add a make check rule to cumin
* Add more command test programs, using a common command test script
* Begin basic refactor of cumin-test; more to come here
Modified: trunk/cumin/Makefile
===================================================================
--- trunk/cumin/Makefile 2011-01-12 15:49:31 UTC (rev 4459)
+++ trunk/cumin/Makefile 2011-01-12 18:13:26 UTC (rev 4460)
@@ -1,12 +1,11 @@
-.phony: build install clean
+.phony: build install clean check
include ../etc/Makefile.common
-CUMIN_HOME := $(shell mktemp -d)
-
build:
python -m compileall -x '/\.svn' -f python
+install: CUMIN_HOME := $(shell mktemp -d)
install: build
install -d ${CUMIN_HOME}/bin
install -pm 0755 bin/cumin bin/cumin-* ${CUMIN_HOME}/bin
@@ -31,3 +30,8 @@
find ${CUMIN_HOME} -type d
clean: clean-python-files
+
+check:
+ cumin-admin-test
+ cumin-data-test
+ cumin-web-test
Modified: trunk/cumin/bin/cumin-admin
===================================================================
--- trunk/cumin/bin/cumin-admin 2011-01-12 15:49:31 UTC (rev 4459)
+++ trunk/cumin/bin/cumin-admin 2011-01-12 18:13:26 UTC (rev 4460)
@@ -24,6 +24,8 @@
if uid == 0:
os.setuid(file_uid)
+ setup_initial_logging()
+
config = CuminConfig()
values = config.parse()
@@ -32,6 +34,8 @@
opts, args = parser.parse_args()
+ setup_operational_logging(opts)
+
try:
name = args[0]
except IndexError:
Modified: trunk/cumin/bin/cumin-admin-test
===================================================================
--- trunk/cumin/bin/cumin-admin-test 2011-01-12 15:49:31 UTC (rev 4459)
+++ trunk/cumin/bin/cumin-admin-test 2011-01-12 18:13:26 UTC (rev 4460)
@@ -1,32 +1,14 @@
-#!/bin/bash
+#!/bin/bash -e
id="test_${RANDOM}"
-code=0
-tmpdir=$(mktemp -d)
-trap "rm -rf ${tmpdir}" EXIT
+opts="--debug"
-while read command; do
- echo -n "Testing command '$command'..."
-
- $command &> "${tmpdir}/output"
-
- if [[ $? == 0 ]]; then
- echo " OK"
- else
- echo
- echo "Command failed with exit code $?"
- echo "Output:"
- cat "${tmpdir}/output"
- code=1
- fi
-done <<EOF
-cumin-admin --help
-cumin-admin add-user "$id" changeme
-cumin-admin add-assignment "$id" admin
-cumin-admin list-users
-cumin-admin list-roles
-cumin-admin remove-assignment "$id" admin
-cumin-admin remove-user "$id"
+cumin-command-test <<EOF
+cumin-admin $opts --help
+cumin-admin $opts add-user "$id" changeme
+cumin-admin $opts add-assignment "$id" admin
+cumin-admin $opts list-users
+cumin-admin $opts list-roles
+cumin-admin $opts remove-assignment "$id" admin
+cumin-admin $opts remove-user "$id"
EOF
-
-exit "$code"
Modified: trunk/cumin/bin/cumin-bench
===================================================================
--- trunk/cumin/bin/cumin-bench 2011-01-12 15:49:31 UTC (rev 4459)
+++ trunk/cumin/bin/cumin-bench 2011-01-12 18:13:26 UTC (rev 4460)
@@ -8,6 +8,8 @@
from cumin.config import *
def do_main():
+ setup_initial_logging()
+
config = CuminConfig()
values = config.parse()
@@ -15,7 +17,7 @@
opts, args = parser.parse_args()
- setup_logging(opts)
+ setup_operational_logging(opts)
broker_uris = [x.strip() for x in opts.brokers.split(",")]
Added: trunk/cumin/bin/cumin-command-test
===================================================================
--- trunk/cumin/bin/cumin-command-test (rev 0)
+++ trunk/cumin/bin/cumin-command-test 2011-01-12 18:13:26 UTC (rev 4460)
@@ -0,0 +1,31 @@
+#!/bin/bash -e
+
+code=0
+tmpdir=$(mktemp -d)
+
+trap "rm -rf ${tmpdir}" EXIT
+
+while read command; do
+ notice="Testing '$command' "
+
+ echo -n "$notice"
+
+ len=$((76 - ${#notice}))
+
+ for ((i = 0; i < $len; i += 1)); do
+ echo -n "."
+ done
+
+ if $command &> "${tmpdir}/output"; then
+ echo " OK"
+ else
+ echo
+ echo "Command failed:"
+
+ cat "${tmpdir}/output"
+
+ code=1
+ fi
+done
+
+exit "$code"
\ No newline at end of file
Property changes on: trunk/cumin/bin/cumin-command-test
___________________________________________________________________
Name: svn:executable
+ *
Modified: trunk/cumin/bin/cumin-data
===================================================================
--- trunk/cumin/bin/cumin-data 2011-01-12 15:49:31 UTC (rev 4459)
+++ trunk/cumin/bin/cumin-data 2011-01-12 18:13:26 UTC (rev 4460)
@@ -11,6 +11,8 @@
from mint import *
def main():
+ setup_initial_logging()
+
config = CuminConfig()
values = config.parse().data
@@ -20,7 +22,7 @@
opts, args = parser.parse_args()
- setup_logging(opts)
+ setup_operational_logging(opts)
model_dir = os.path.join(config.home, "model")
Added: trunk/cumin/bin/cumin-data-test
===================================================================
--- trunk/cumin/bin/cumin-data-test (rev 0)
+++ trunk/cumin/bin/cumin-data-test 2011-01-12 18:13:26 UTC (rev 4460)
@@ -0,0 +1,8 @@
+#!/bin/bash -e
+
+opts="--debug --init-only"
+
+cumin-command-test <<EOF
+cumin-data $opts --help
+cumin-data $opts
+EOF
Property changes on: trunk/cumin/bin/cumin-data-test
___________________________________________________________________
Name: svn:executable
+ *
Modified: trunk/cumin/bin/cumin-smoke-test
===================================================================
--- trunk/cumin/bin/cumin-smoke-test 2011-01-12 15:49:31 UTC (rev 4459)
+++ trunk/cumin/bin/cumin-smoke-test 2011-01-12 18:13:26 UTC (rev 4460)
@@ -13,6 +13,8 @@
from cumin.util import *
def main():
+ setup_initial_logging()
+
config = CuminConfig()
values = config.parse()
@@ -23,7 +25,7 @@
opts, args = parser.parse_args()
- setup_logging(opts)
+ setup_operational_logging(opts)
cumin = Cumin(config.home, opts.brokers, opts.database,
opts.host, opts.port)
Modified: trunk/cumin/bin/cumin-test
===================================================================
--- trunk/cumin/bin/cumin-test 2011-01-12 15:49:31 UTC (rev 4459)
+++ trunk/cumin/bin/cumin-test 2011-01-12 18:13:26 UTC (rev 4460)
@@ -6,10 +6,22 @@
home = os.environ.get("CUMIN_HOME", os.path.normpath("/usr/share/cumin"))
sys.path.append(os.path.join(home, "python"))
-from cumin.tools import CuminTestTool
+from cumin.config import *
+def main():
+ setup_initial_logging()
+
+ config = CuminConfig()
+ values = config.parse()
+
+ parser = CuminOptionParser(values.test)
+
+ opts, args = parser.parse_args()
+
+ setup_operational_logging(opts)
+
if __name__ == "__main__":
try:
- CuminTestTool("cumin-test").main()
+ main()
except KeyboardInterrupt:
pass
Modified: trunk/cumin/bin/cumin-web
===================================================================
--- trunk/cumin/bin/cumin-web 2011-01-12 15:49:31 UTC (rev 4459)
+++ trunk/cumin/bin/cumin-web 2011-01-12 18:13:26 UTC (rev 4460)
@@ -11,6 +11,8 @@
from cumin.util import *
def main():
+ setup_initial_logging()
+
config = CuminConfig()
values = config.parse()
@@ -21,7 +23,7 @@
opts, args = parser.parse_args()
- setup_logging(opts)
+ setup_operational_logging(opts)
broker_uris = [x.strip() for x in opts.brokers.split(",")]
Added: trunk/cumin/bin/cumin-web-test
===================================================================
--- trunk/cumin/bin/cumin-web-test (rev 0)
+++ trunk/cumin/bin/cumin-web-test 2011-01-12 18:13:26 UTC (rev 4460)
@@ -0,0 +1,9 @@
+#!/bin/bash -e
+
+opts="--debug --init-only"
+
+cumin-command-test <<EOF
+cumin-web $opts --help
+cumin-web $opts --host example.com
+cumin-web $opts --port 27654
+EOF
Property changes on: trunk/cumin/bin/cumin-web-test
___________________________________________________________________
Name: svn:executable
+ *
Modified: trunk/cumin/python/cumin/config.py
===================================================================
--- trunk/cumin/python/cumin/config.py 2011-01-12 15:49:31 UTC (rev 4459)
+++ trunk/cumin/python/cumin/config.py 2011-01-12 18:13:26 UTC (rev 4460)
@@ -56,6 +56,9 @@
param = ConfigParameter(data, "vacuum-interval", int)
param.default = 60 * 60 # 1 hour
+ test = CuminConfigSection(self, "test")
+ test.log_file.default = os.path.join(self.home, "log", "test.log")
+
def parse(self):
paths = list()
@@ -94,12 +97,34 @@
self.add_option("--debug", action="store_true", default=section.debug)
self.add_option("--init-only", action="store_true")
-def setup_logging(values):
- modules = ("cumin", "mint", "parsley", "rosemary", "wooly")
+# These logging functions address a logging bootstrap problem. Before
+# configuration is read, we can't configure logging. Nonetheless,
+# we'd like to log errors or warnings encountered before that point.
+# These logging functions split setup into two phases, the first being
+# temporary and basic, and the second being fully configured.
+#
+# Here's how to use them:
+#
+# def main():
+# setup_initial_logging()
+#
+# # load config files and command-line options
+#
+# setup_operational_logging(config)
+#
+# # start your business
- for name in modules:
+_logging_modules = "cumin", "mint", "parsley", "rosemary", "wooly"
+
+def setup_initial_logging():
+ for name in _logging_modules:
+ enable_logging(name, "warn", sys.stderr)
+
+def setup_operational_logging(values):
+ for name in _logging_modules:
+ disable_logging(name)
enable_logging(name, values.log_level, values.log_file)
if values.debug:
- for name in modules:
+ for name in _logging_modules:
enable_logging(name, "debug", sys.stderr)
13 years, 3 months
r4459 - trunk/parsley/python/parsley
by jross@fedoraproject.org
Author: jross
Date: 2011-01-12 15:49:31 +0000 (Wed, 12 Jan 2011)
New Revision: 4459
Modified:
trunk/parsley/python/parsley/config.py
Log:
When loading a config section that has no corresponding file data, load the common values
Modified: trunk/parsley/python/parsley/config.py
===================================================================
--- trunk/parsley/python/parsley/config.py 2011-01-11 16:47:18 UTC (rev 4458)
+++ trunk/parsley/python/parsley/config.py 2011-01-12 15:49:31 UTC (rev 4459)
@@ -42,27 +42,28 @@
self.parameters = list()
def parse(self, parser):
- values = ConfigValues()
+ in_values = dict()
+ out_values = ConfigValues()
- if not parser.has_section(self.name):
- return values
+ for section in ("common", self.name):
+ try:
+ items = parser.items(section)
+ except NoSectionError:
+ continue
+ in_values.update(items)
+
for param in self.parameters:
- name = param.name.replace("-", "_")
-
try:
- string = parser.get(self.name, param.name)
+ string = in_values[param.name]
value = param.unmarshal(string)
- except NoOptionError:
- try:
- string = parser.get("common", param.name)
- value = param.unmarshal(string)
- except NoOptionError:
- value = param.default
+ except KeyError:
+ value = param.default
- values[name] = value
+ name = param.name.replace("-", "_")
+ out_values[name] = value
- return values
+ return out_values
class ConfigParameter(object):
def __init__(self, section, name, type):
13 years, 3 months
r4458 - trunk/parsley/python/parsley
by jross@fedoraproject.org
Author: jross
Date: 2011-01-11 16:47:18 +0000 (Tue, 11 Jan 2011)
New Revision: 4458
Modified:
trunk/parsley/python/parsley/config.py
Log:
Repair a logic error introduced in change 4452
Modified: trunk/parsley/python/parsley/config.py
===================================================================
--- trunk/parsley/python/parsley/config.py 2011-01-11 15:37:07 UTC (rev 4457)
+++ trunk/parsley/python/parsley/config.py 2011-01-11 16:47:18 UTC (rev 4458)
@@ -16,7 +16,7 @@
log.info("Read config file '%s'", path)
if not found:
- log.info("No config files found at %s", ", ".join(paths))
+ log.warn("No config files found at %s", ", ".join(paths))
sections = ConfigValues()
@@ -44,26 +44,26 @@
def parse(self, parser):
values = ConfigValues()
- self.add_values(parser, "common", values)
- self.add_values(parser, self.name, values)
+ if not parser.has_section(self.name):
+ return values
- return values
-
- def add_values(self, parser, section_name, values):
- if not parser.has_section(section_name):
- return
-
for param in self.parameters:
name = param.name.replace("-", "_")
try:
- string = parser.get(section_name, param.name)
+ string = parser.get(self.name, param.name)
value = param.unmarshal(string)
except NoOptionError:
- value = param.default
+ try:
+ string = parser.get("common", param.name)
+ value = param.unmarshal(string)
+ except NoOptionError:
+ value = param.default
values[name] = value
+ return values
+
class ConfigParameter(object):
def __init__(self, section, name, type):
assert isinstance(section, ConfigSection)
13 years, 3 months
r4457 - trunk/cumin/bin
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-01-11 15:37:07 +0000 (Tue, 11 Jan 2011)
New Revision: 4457
Modified:
trunk/cumin/bin/cumin-web
Log:
Port command line option needs type set to int to cause conversion
Modified: trunk/cumin/bin/cumin-web
===================================================================
--- trunk/cumin/bin/cumin-web 2011-01-07 16:17:35 UTC (rev 4456)
+++ trunk/cumin/bin/cumin-web 2011-01-11 15:37:07 UTC (rev 4457)
@@ -17,7 +17,7 @@
parser = CuminOptionParser(values.web)
parser.add_option("--host", default=values.web.host)
- parser.add_option("--port", default=values.web.port)
+ parser.add_option("--port", default=values.web.port, type=int)
opts, args = parser.parse_args()
13 years, 3 months
r4456 - branches/1.3.2/cumin/bin
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-01-07 16:17:35 +0000 (Fri, 07 Jan 2011)
New Revision: 4456
Modified:
branches/1.3.2/cumin/bin/cumin-database
Log:
Merge in revision 4453 and 4454 from trunk.
BZ667719
(related to BZ667653)
Modified: branches/1.3.2/cumin/bin/cumin-database
===================================================================
--- branches/1.3.2/cumin/bin/cumin-database 2011-01-07 15:13:08 UTC (rev 4455)
+++ branches/1.3.2/cumin/bin/cumin-database 2011-01-07 16:17:35 UTC (rev 4456)
@@ -151,7 +151,11 @@
check-environment || exit 1
check-initialized || exit 1
- /sbin/service postgresql restart
+ # The postgresql 8.1.22 init script violates LSB 3.1 Chapter 20.2,
+ # and returns 1 on a successful restart of a stopped service. A
+ # proper restart is thus simulated with condstop and start.
+ /sbin/service postgresql condstop
+ /sbin/service postgresql start
}
function initialize {
@@ -170,9 +174,10 @@
# On older versions of Postgres (before 8.4), initdb does not exist but
# using the start option will initialize the database, then start it.
- # Try initdb first, and if it fails try start followed by stop. This
- # should leave the database and the service in the same state on all
- # 8.x versions of Postgres.
+ # Try initdb first, and if it fails try start. The "start" method
+ # will leave the service running, which is different than initdb,
+ # but that is fine at this point because it is restarted after
+ # the call to configure anyway.
echo -e "\nAttempting to use initdb option..."
run "/sbin/service postgresql initdb" || {
echo -e "\ninitdb option not supported, using start..."
13 years, 4 months