[4suite-checkins] In 4Suite/Ft/Server/Server/Commands,
files __init__.py
Jeremy Kloth
jkloth at 4suite.org
Wed Oct 18 13:24:35 MDT 2006
Modified Files:
__init__.py
Log Message:
Forward-port changes from XML 1.0 maintenance branch
ViewCVS diff:
http://cvs.4suite.org/viewcvs/4Suite/Ft/Server/Server/Commands/__init__.py.diff?r1=1.11&r2=1.12
ViewCVS view:
http://cvs.4suite.org/viewcvs/4Suite/Ft/Server/Server/Commands/__init__.py?rev=1.12&content-type=text/vnd.viewcvs-markup
Index: __init__.py
===================================================================
RCS file: /var/local/cvsroot/4Suite/Ft/Server/Server/Commands/__init__.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -U2 -r1.11 -r1.12
--- __init__.py 11 Aug 2006 15:39:16 -0000 1.11
+++ __init__.py 18 Oct 2006 19:24:35 -0000 1.12
@@ -10,76 +10,50 @@
"""
-from Ft import GetConfigVars
-from Ft.Lib.CommandLine import Options, CommandLineApp
+import sys
+
+from Ft.Lib.CommandLine import CommandLineApp, Options
from Ft.Server import FtServerBaseException
# command modules to register as subcommands
-import Init
-import Backup
-#import Restore
-import Recompile
-import Start
-import Stop
-import Restart
-#import Reload
-import Status
-import Log
-import Login
-
g_commands = [
# These commands deal directly with the data store
- Init,
- Backup,
- #Restore,
- Recompile,
-
+ 'Init', 'Backup', 'Recompile',
# These commands are for server control and info
- Start,
- Stop,
- Restart,
- #Reload,
- Status,
- Log,
- Login,
- ]
-
-# global options (inherited by all subcommands)
-g_options = [
- Options.Option('u',
- 'username=USER',
- 'authenticate using the given user name'),
- Options.Option('p',
- 'password=PASSWORD',
- 'authenticate using the given password'),
- Options.Option('I',
- 'core-id=CORE',
- 'use a specific core in config file (default: Core)'),
- Options.Option('C',
- 'config-file=FILEPATH',
- 'use alternative repository configuration file'),
+ 'Start', 'Stop', 'Restart', 'Status', 'Log', 'Login',
]
-
+g_commands = [ __import__(__name__ + '.' + module, {}, {}, ['Register'])
+ for module in g_commands ]
class ManagerCommandLineApp(CommandLineApp.CommandLineApp):
- project_name, project_version, project_url = \
- GetConfigVars('NAME', 'VERSION', 'URL')
+ from Ft.Server.__config__ import \
+ NAME as project_name, VERSION as project_version, URL as project_url
- def __init__(self):
- CommandLineApp.CommandLineApp.__init__(
- self,
- '4ss_manager',
- '4Suite repository management tools',
- """This command-line application allows a 4Suite repository
+ name = '4ss_manager'
+ summary = '4Suite repository management tools'
+ description = """This command-line application allows a 4Suite repository
administrator to perform management tasks on the repository as a whole,
-including setup, server control, backup, and other operations.""",
- [cmd_module.Register() for cmd_module in g_commands],
- options=g_options,
- fileName=__file__,
- )
+including setup, server control, backup, and other operations."""
+
+ options = [
+ Options.Option(
+ 'u', 'username=USER',
+ 'authenticate using the given user name'),
+ Options.Option(
+ 'p', 'password=PASSWORD',
+ 'authenticate using the given password'),
+ Options.Option(
+ 'I', 'core-id=CORE',
+ 'use a specific core in config file (default: Core)'),
+ Options.Option(
+ 'C', 'config-file=FILEPATH',
+ 'use alternative repository configuration file'),
+ ]
+
+ commands = [ module.Register() for module in g_commands ]
- def run(*args, **kwords):
+ def run(self, *args, **kwds):
try:
- return CommandLineApp.CommandLineApp.run(*args, **kwords)
- except FtServerBaseException,e:
- print e
+ return CommandLineApp.CommandLineApp.run(self, *args, **kwds)
+ except FtServerBaseException, exc:
+ print >> sys.stderr, str(exc)
More information about the 4suite-checkins
mailing list