[serverctl] Ask for parser type when adding a new source (closes #3484231)
authorPaul Tonelli <paul.tonelli@logilab.fr>
Mon, 28 Apr 2014 17:34:07 +0200
changeset 10009 560747cd7774
parent 10008 36b75aefe2c2
child 10010 3dd66bdbfe8e
[serverctl] Ask for parser type when adding a new source (closes #3484231) Remove 'quick_start' option to load all AppObjects, including feed parsers.
server/serverctl.py
--- a/server/serverctl.py	Wed Jun 11 10:57:28 2014 +0200
+++ b/server/serverctl.py	Mon Apr 28 17:34:07 2014 +0200
@@ -482,7 +482,6 @@
     def run(self, args):
         appid = args[0]
         config = ServerConfiguration.config_for(appid)
-        config.quick_start = True
         repo, cnx = repo_cnx(config)
         with cnx:
             used = set(n for n, in cnx.execute('Any SN WHERE S is CWSource, S name SN'))
@@ -505,6 +504,12 @@
                         continue
                 break
             while True:
+                parser = raw_input('parser type (%s): '
+                                    % ', '.join(sorted(repo.vreg['parsers'])))
+                if parser in repo.vreg['parsers']:
+                    break
+                print '-> unknown parser identifier, use one of the available types.'
+            while True:
                 sourceuri = raw_input('source identifier (a unique name used to '
                                       'tell sources apart): ').strip()
                 if not sourceuri:
@@ -518,8 +523,8 @@
             # XXX configurable inputlevel
             sconfig = ask_source_config(config, type, inputlevel=self.config.config_level)
             cfgstr = unicode(generate_source_config(sconfig), sys.stdin.encoding)
-            cnx.create_entity('CWSource', name=sourceuri,
-                              type=unicode(type), config=cfgstr)
+            cnx.create_entity('CWSource', name=sourceuri, type=unicode(type),
+                              config=cfgstr, parser=unicode(parser))
             cnx.commit()