[c-c create] make post-create step optional (closes #2712041)

In this context the "post-create" step refers to the database's creation and initialization. We want to be able to create a new instance but skip the database creation (db-create and db-init commands) in automatic setup.

authorDavid Douard <david.douard@logilab.fr>
changeset0020aa12af07
branchdefault
phasepublic
hiddenno
parent revision#4032499c701e [cwconfig] Add optional configuration param to load a UI cube before other cubes
child revision#32425065931b [c-c create] allow to pass command line options to instance creation command (closes #2709702), #063987c107f9 [dataimport] Revert CS 6947201033be (related to #2788402), #89cf8f8c0902 [source] Now preprocess_entity use SQL converters., #20daeb57eb62 [source] Now preprocess_entity use SQL converters., #0786041922b4 [toward-py3k] rewrite __cmp__ (closes #2715115), #c3ad594804da skeleton: add RPM spec template, #3e812dc7d0f5 [cmd] fix exlog documentation (closes #2715913), #baa586e2186f [schema] Correctly set the final attribute of user-defined base types while deserializing the schema, closes #2790973, #59a29405688c [ext/rest] add directive bookmark to rest (closes #2545595), #4e1f7847116f [ext/rest] add directive bookmark to rest (closes #2545595)
files modified by this revision
cwctl.py
# HG changeset patch
# User David Douard <david.douard@logilab.fr>
# Date 1364984244 -7200
# Wed Apr 03 12:17:24 2013 +0200
# Node ID 0020aa12af07a45200041ac858a0becf8e2330c3
# Parent 4032499c701ee79207bb3b7f8b4c627c387a335f
[c-c create] make post-create step optional (closes #2712041)

In this context the "post-create" step refers to the database's creation and
initialization. We want to be able to create a new instance but skip the
database creation (`db-create` and `db-init` commands) in automatic setup.

diff --git a/cwctl.py b/cwctl.py
@@ -363,10 +363,16 @@
1            'help': 'installation type, telling which part of an instance '
2            'should be installed. You can list available configurations using the'
3            ' "list" command. Default to "all-in-one", e.g. an installation '
4            'embedding both the RQL repository and the web server.',
5            }),
6 +        ('no-post-create',
7 +         {'short': 'P',
8 +          'action': 'store_true',
9 +          'default': False,
10 +          'help': 'do not run post-create tasks (database creation, etc.)',
11 +          }),
12          )
13 
14      def run(self, args):
15          """run the command with its specific arguments"""
16          from logilab.common.textutils import splitstrip
@@ -431,11 +437,12 @@
17              from logilab.common.shellutils import chown
18              # this directory should be owned by the uid of the server process
19              print 'set %s as owner of the data directory' % config['uid']
20              chown(config.appdatahome, config['uid'])
21          print '\n-> creation done for %s\n' % repr(config.apphome)[1:-1]
22 -        helper.postcreate(self.config.automatic)
23 +        if not self.config.no_post_create:
24 +            helper.postcreate(self.config.automatic)
25 
26      def _handle_win32(self, config, appid):
27          if sys.platform != 'win32':
28              return
29          service_template = """