summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorTimotheus Pokorra <tp@tbits.net>2015-04-13 11:30:37 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2015-04-15 12:12:27 +0200
commit6000d8c21a6095e084fdff3eac0fc4e77af8a593 (patch)
treee3661f250ad86a7ea0a42a8f1ccb1cc22d813aac /pykolab
parent140da5efe734a80617cca0fb8f7258251cb18718 (diff)
downloadpykolab-6000d8c21a6095e084fdff3eac0fc4e77af8a593.tar.gz
implementing --mysqlserver parameter for setup-kolab to specify if a new or existing MySQL server should be used (#4971)
this is useful for silent/unattended installs
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/setup/setup_mysql.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/pykolab/setup/setup_mysql.py b/pykolab/setup/setup_mysql.py
index 174cbc7..460a4d5 100644
--- a/pykolab/setup/setup_mysql.py
+++ b/pykolab/setup/setup_mysql.py
@@ -35,6 +35,16 @@ conf = pykolab.getConf()
def __init__():
components.register('mysql', execute, description=description())
+def cli_options():
+ ldap_group = conf.add_cli_parser_option_group(_("MySQL Options"))
+
+ ldap_group.add_option(
+ "--mysqlserver",
+ dest = "mysqlserver",
+ action = "store",
+ help = _("Specify whether to use an (existing) or (new) MySQL server.")
+ )
+
def description():
return _("Setup MySQL.")
@@ -73,7 +83,13 @@ def execute(*args, **kw):
os.path.exists('/var/run/mysqld/mysqld.sock') or \
os.path.exists('/var/run/mysql/mysql.sock') or \
os.path.exists('/var/run/mysqld/mysqld.pid'):
- answer = utils.ask_menu(_("What MySQL server are we setting up?"), options)
+ if conf.mysqlserver:
+ if conf.mysqlserver == 'existing':
+ answer = 1
+ elif conf.mysqlserver == 'new':
+ answer = 2
+ if answer == 0:
+ answer = utils.ask_menu(_("What MySQL server are we setting up?"), options)
if answer == "1" or answer == 1:
print >> sys.stderr, utils.multiline_message(