initial commit
This commit is contained in:
@@ -6,12 +6,16 @@ import sys
|
||||
from .. import utils
|
||||
|
||||
|
||||
def install(appname, config, upgrade):
|
||||
def install(appname, config, upgrade, restore):
|
||||
"""Install an application."""
|
||||
if (config.has_option(appname, "enabled") and
|
||||
not config.getboolean(appname, "enabled")):
|
||||
return
|
||||
utils.printcolor("Installing {}".format(appname), utils.MAGENTA)
|
||||
|
||||
if not restore:
|
||||
utils.printcolor("Installing {}".format(appname), utils.MAGENTA)
|
||||
else:
|
||||
utils.printcolor("Restoring {}".format(appname), utils.MAGENTA)
|
||||
try:
|
||||
script = importlib.import_module(
|
||||
"modoboa_installer.scripts.{}".format(appname))
|
||||
@@ -19,7 +23,7 @@ def install(appname, config, upgrade):
|
||||
print("Unknown application {}".format(appname))
|
||||
sys.exit(1)
|
||||
try:
|
||||
getattr(script, appname.capitalize())(config, upgrade).run()
|
||||
getattr(script, appname.capitalize())(config, upgrade, restore).run()
|
||||
except utils.FatalError as inst:
|
||||
utils.printcolor(u"{}".format(inst), utils.RED)
|
||||
sys.exit(1)
|
||||
|
||||
@@ -20,10 +20,11 @@ class Installer(object):
|
||||
with_db = False
|
||||
config_files = []
|
||||
|
||||
def __init__(self, config, upgrade):
|
||||
def __init__(self, config, upgrade, restore):
|
||||
"""Get configuration."""
|
||||
self.config = config
|
||||
self.upgrade = upgrade
|
||||
self.restore = restore
|
||||
if self.config.has_section(self.appname):
|
||||
self.app_config = dict(self.config.items(self.appname))
|
||||
self.dbengine = self.config.get("database", "engine")
|
||||
|
||||
Reference in New Issue
Block a user