Skip to content

Commit 9f42a40

Browse files
author
Frederic Massart
committed
Create now prevents usage of --engine with --install. Fixes #67
1 parent cab3479 commit 9f42a40

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

lib/commands/create.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,24 @@ class CreateCommand(Command):
3838
def __init__(self, *args, **kwargs):
3939
super(CreateCommand, self).__init__(*args, **kwargs)
4040
self._arguments = [
41+
(
42+
['-i', '--install'],
43+
{
44+
'action': 'store_true',
45+
'dest': 'install',
46+
'help': 'launch the installation script after creating the instance'
47+
}
48+
),
4149
(
4250
['-e', '--engine'],
4351
{
4452
'action': 'store',
4553
'choices': ['mysqli', 'pgsql'],
4654
'default': self.C.get('defaultEngine'),
47-
'help': 'database engine to use',
55+
'help': 'database engine to install the instance on, use with --install',
4856
'metavar': 'engine'
4957
}
5058
),
51-
(
52-
['-i', '--install'],
53-
{
54-
'action': 'store_true',
55-
'dest': 'install',
56-
'help': 'launch the installation script after creating the instance'
57-
}
58-
),
5959
(
6060
['-t', '--integration'],
6161
{
@@ -109,6 +109,10 @@ def run(self, args):
109109
engine = args.engine
110110
versions = args.version
111111
suffixes = args.suffix
112+
install = args.install
113+
114+
if engine and not install:
115+
self.argumentError('--engine can only be used with --install.')
112116

113117
for version in versions:
114118
for suffix in suffixes:
@@ -118,7 +122,7 @@ def run(self, args):
118122
'engine': engine,
119123
'integration': args.integration,
120124
'identifier': args.identifier,
121-
'install': args.install,
125+
'install': install,
122126
'run': args.run
123127
}
124128
self.do(arguments)

0 commit comments

Comments
 (0)