8 __docformat__ = "restructuredtext en" |
8 __docformat__ = "restructuredtext en" |
9 |
9 |
10 import sys |
10 import sys |
11 import os |
11 import os |
12 |
12 |
13 from logilab.common.configuration import REQUIRED, Configuration |
13 from logilab.common.configuration import Configuration |
14 from logilab.common.clcommands import register_commands, cmd_run, pop_arg |
14 from logilab.common.clcommands import register_commands, cmd_run, pop_arg |
15 |
15 |
16 from cubicweb import AuthenticationError, ExecutionError, ConfigurationError |
16 from cubicweb import AuthenticationError, ExecutionError, ConfigurationError |
17 from cubicweb.toolsutils import Command, CommandHandler, confirm |
17 from cubicweb.toolsutils import Command, CommandHandler, confirm |
18 from cubicweb.server import SOURCE_TYPES |
18 from cubicweb.server import SOURCE_TYPES |
19 from cubicweb.server.utils import ask_source_config |
19 from cubicweb.server.utils import ask_source_config |
20 from cubicweb.server.serverconfig import ServerConfiguration |
20 from cubicweb.server.serverconfig import USER_OPTIONS, ServerConfiguration |
21 |
21 |
22 |
22 |
23 # utility functions ########################################################### |
23 # utility functions ########################################################### |
24 |
24 |
25 def source_cnx(source, dbname=None, special_privs=False, verbose=True): |
25 def source_cnx(source, dbname=None, special_privs=False, verbose=True): |
173 if confirm('do you want to create repository\'s system database?'): |
173 if confirm('do you want to create repository\'s system database?'): |
174 verbosity = (self.config.mode == 'installed') and 'y' or 'n' |
174 verbosity = (self.config.mode == 'installed') and 'y' or 'n' |
175 cmd_run('db-create', self.config.appid, '--verbose=%s' % verbosity) |
175 cmd_run('db-create', self.config.appid, '--verbose=%s' % verbosity) |
176 else: |
176 else: |
177 print 'nevermind, you can do it later using the db-create command' |
177 print 'nevermind, you can do it later using the db-create command' |
178 |
|
179 USER_OPTIONS = ( |
|
180 ('login', {'type' : 'string', |
|
181 'default': REQUIRED, |
|
182 'help': "cubicweb manager account's login " |
|
183 '(this user will be created)', |
|
184 'inputlevel': 0, |
|
185 }), |
|
186 ('password', {'type' : 'password', |
|
187 'help': "cubicweb manager account's password", |
|
188 'inputlevel': 0, |
|
189 }), |
|
190 ) |
|
191 |
178 |
192 |
179 |
193 class RepositoryDeleteHandler(CommandHandler): |
180 class RepositoryDeleteHandler(CommandHandler): |
194 cmdname = 'delete' |
181 cmdname = 'delete' |
195 cfgname = 'repository' |
182 cfgname = 'repository' |