Mercurial > p > roundup > code
comparison roundup/admin.py @ 3433:2affe8fa51a5
install: accept configuration setting overrides (based on patch [SF#237110])
| author | Alexander Smishlajev <a1s@users.sourceforge.net> |
|---|---|
| date | Sat, 03 Dec 2005 11:26:08 +0000 |
| parents | c1c67c62b699 |
| children | 5cd1c83dea50 |
comparison
equal
deleted
inserted
replaced
| 3432:3876b94ffe8c | 3433:2affe8fa51a5 |
|---|---|
| 14 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 14 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 15 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" | 15 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
| 16 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 16 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 17 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 17 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 18 # | 18 # |
| 19 # $Id: admin.py,v 1.96 2005-07-12 01:37:49 richard Exp $ | 19 # $Id: admin.py,v 1.97 2005-12-03 11:26:08 a1s Exp $ |
| 20 | 20 |
| 21 '''Administration commands for maintaining Roundup trackers. | 21 '''Administration commands for maintaining Roundup trackers. |
| 22 ''' | 22 ''' |
| 23 __docformat__ = 'restructuredtext' | 23 __docformat__ = 'restructuredtext' |
| 24 | 24 |
| 339 import roundup.backends | 339 import roundup.backends |
| 340 backends = roundup.backends.list_backends() | 340 backends = roundup.backends.list_backends() |
| 341 print _('Back ends:'), ', '.join(backends) | 341 print _('Back ends:'), ', '.join(backends) |
| 342 | 342 |
| 343 def do_install(self, tracker_home, args): | 343 def do_install(self, tracker_home, args): |
| 344 ""'''Usage: install [template [backend [admin password]]] | 344 ""'''Usage: install [template [backend [admin password [key=val[,key=val]]]]] |
| 345 Install a new Roundup tracker. | 345 Install a new Roundup tracker. |
| 346 | 346 |
| 347 The command will prompt for the tracker home directory | 347 The command will prompt for the tracker home directory |
| 348 (if not supplied through TRACKER_HOME or the -i option). | 348 (if not supplied through TRACKER_HOME or the -i option). |
| 349 The template, backend and admin password may be specified | 349 The template, backend and admin password may be specified |
| 350 on the command-line as arguments, in that order. | 350 on the command-line as arguments, in that order. |
| 351 | |
| 352 The last command line argument allows to pass initial values | |
| 353 for config options. For example, passing | |
| 354 "web_http_auth=no,rdbms_user=dinsdale" will override defaults | |
| 355 for options http_auth in section [web] and user in section [rdbms]. | |
| 356 Please be careful to not use spaces in this argument! (Enclose | |
| 357 whole argument in quotes if you need spaces in option value). | |
| 351 | 358 |
| 352 The initialise command must be called after this command in order | 359 The initialise command must be called after this command in order |
| 353 to initialise the tracker's database. You may edit the tracker's | 360 to initialise the tracker's database. You may edit the tracker's |
| 354 initial database contents before running that command by editing | 361 initial database contents before running that command by editing |
| 355 the tracker's dbinit.py module init() function. | 362 the tracker's dbinit.py module init() function. |
| 400 backend = raw_input(_('Select backend [anydbm]: ')).strip() | 407 backend = raw_input(_('Select backend [anydbm]: ')).strip() |
| 401 if not backend: | 408 if not backend: |
| 402 backend = 'anydbm' | 409 backend = 'anydbm' |
| 403 # XXX perform a unit test based on the user's selections | 410 # XXX perform a unit test based on the user's selections |
| 404 | 411 |
| 412 # Process configuration file definitions | |
| 413 if len(args) > 3: | |
| 414 try: | |
| 415 defns = dict([item.split("=") for item in args[3].split(",")]) | |
| 416 except: | |
| 417 print _('Error in configuration settings: "%s"') % args[3] | |
| 418 raise | |
| 419 else: | |
| 420 defns = {} | |
| 421 | |
| 405 # install! | 422 # install! |
| 406 init.install(tracker_home, templates[template]['path']) | 423 init.install(tracker_home, templates[template]['path'], settings=defns) |
| 407 init.write_select_db(tracker_home, backend) | 424 init.write_select_db(tracker_home, backend) |
| 408 | 425 |
| 409 print _(""" | 426 print _(""" |
| 410 --------------------------------------------------------------------------- | 427 --------------------------------------------------------------------------- |
| 411 You should now edit the tracker configuration file: | 428 You should now edit the tracker configuration file: |
