summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2019-09-24 10:51:46 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2019-09-24 10:51:46 +0200
commitad8b564136fdd2a573e838775f23533cdee7c644 (patch)
tree626611f9143b1130e1d6ee5e3f2c41f4b0c91de0 /pykolab
parentdaab3079f0192d9c2ad7c9321e6ecc2d42cd384d (diff)
downloadpykolab-ad8b564136fdd2a573e838775f23533cdee7c644.tar.gz
Allow specifying the root password in addition to using an existing mysql server
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/setup/setup_mysql.py37
1 files changed, 24 insertions, 13 deletions
diff --git a/pykolab/setup/setup_mysql.py b/pykolab/setup/setup_mysql.py
index ec9e6d4..807bc7f 100644
--- a/pykolab/setup/setup_mysql.py
+++ b/pykolab/setup/setup_mysql.py
@@ -39,15 +39,22 @@ def __init__():
def cli_options():
- ldap_group = conf.add_cli_parser_option_group(_("MySQL Options"))
+ mysql_group = conf.add_cli_parser_option_group(_("MySQL Options"))
- ldap_group.add_option(
+ mysql_group.add_option(
"--mysqlserver",
dest="mysqlserver",
action="store",
help=_("Specify whether to use an (existing) or (new) MySQL server.")
)
+ mysql_group.add_option(
+ "--mysqlrootpw",
+ dest="mysqlrootpw",
+ action="store",
+ help=_("The MySQL root user password.")
+ )
+
def description():
return _("Setup MySQL.")
@@ -119,17 +126,21 @@ def execute(*args, **kw): # noqa: C901
answer = utils.ask_menu(_("What MySQL server are we setting up?"), options)
if answer == "1" or answer == 1:
- print >> sys.stderr, utils.multiline_message(
- _("""
- Please supply the root password for MySQL, so we can set
- up user accounts for other components that use MySQL.
- """)
- )
-
- mysql_root_password = utils.ask_question(
- _("MySQL root password"),
- password=True
- )
+ if not conf.mysqlrootpw:
+ print >> sys.stderr, utils.multiline_message(
+ _("""
+ Please supply the root password for MySQL, so we can set
+ up user accounts for other components that use MySQL.
+ """)
+ )
+
+ mysql_root_password = utils.ask_question(
+ _("MySQL root password"),
+ password=True
+ )
+
+ else:
+ mysql_root_password = conf.mysqlrootpw
else:
print >> sys.stderr, utils.multiline_message(