allow configuring the level of the configuration settings for cw-ctl add-source and db-init (which may call add-source) stable
authorAlexandre Fayolle <alexandre.fayolle@logilab.fr>
Tue, 22 Feb 2011 21:33:10 +0100
branchstable
changeset 7030 d48c6b0158b9
parent 7029 bae4d11a104b
child 7031 a04621040cad
allow configuring the level of the configuration settings for cw-ctl add-source and db-init (which may call add-source)
server/serverctl.py
--- a/server/serverctl.py	Tue Feb 22 21:30:32 2011 +0100
+++ b/server/serverctl.py	Tue Feb 22 21:33:10 2011 +0100
@@ -388,6 +388,10 @@
           'default': False,
           'help': 'insert drop statements to remove previously existant \
 tables, indexes... (no by default)'}),
+        ('config-level',
+         {'short': 'l', 'type': 'int', 'default': 1,
+          'help': 'level threshold for questions asked when configuring another source'
+          }),
         )
 
     def run(self, args):
@@ -412,7 +416,7 @@
                 % (config.sources_file(), str(ex).strip()))
         init_repository(config, drop=self.config.drop)
         while ASK.confirm('Enter another source ?', default_is_yes=False):
-            CWCTL.run(['add-source', config.appid])
+            CWCTL.run(['add-source', '--config-level', self.config.config_level, config.appid])
 
 
 class AddSourceCommand(Command):
@@ -424,7 +428,12 @@
     name = 'add-source'
     arguments = '<instance>'
     min_args = max_args = 1
-    options = ()
+    options = (
+        ('config-level',
+         {'short': 'l', 'type': 'int', 'default': 1,
+          'help': 'level threshold for questions asked when configuring another source'
+          }),
+        )
 
     def run(self, args):
         appid = args[0]
@@ -463,7 +472,7 @@
                 else:
                     break
         # XXX configurable inputlevel
-        sconfig = ask_source_config(config, type, inputlevel=0)
+        sconfig = ask_source_config(config, type, inputlevel=self.config.config_level)
         cfgstr = unicode(generate_source_config(sconfig), sys.stdin.encoding)
         req.create_entity('CWSource', name=sourceuri,
                           type=unicode(type), config=cfgstr)