-
Notifications
You must be signed in to change notification settings - Fork 58
/
setup-utils.py
62 lines (47 loc) · 1.71 KB
/
setup-utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import os
import sys
import argparse
parser = argparse.ArgumentParser(description="Utilities for Gluu CE")
parser.add_argument('-load-ldif', help="Loads ldif file to persistence")
argsp = parser.parse_args()
#first import paths and make changes if necassary
from setup_app import paths
#for example change log file location:
paths.LOG_FILE = os.path.join(paths.INSTALL_DIR, 'logs/setup-utils.log')
from setup_app import static
# second import module base, this makes some initial settings
from setup_app.utils import base
# we will access args via base module
base.argsp = argsp
from setup_app.utils.package_utils import packageUtils
packageUtils.check_and_install_packages()
from setup_app.messages import msg
from setup_app.config import Config
from setup_app.static import BackendTypes
from setup_app.utils.setup_utils import SetupUtils
from setup_app.utils.collect_properties import CollectProperties
from setup_app.installers.gluu import GluuInstaller
Config.init(paths.INSTALL_DIR)
Config.determine_version()
# we must initilize SetupUtils after initilizing Config
SetupUtils.init()
collectProperties = CollectProperties()
if os.path.exists(Config.gluu_properties_fn):
collectProperties.collect()
Config.installed_instance = True
else:
print("Gluu Server installation was not found")
sys.exit()
gluuInstaller = GluuInstaller()
class SetupUtilities:
def __init__(self):
pass
def load_ldif(self, ldif_fn):
if not os.path.exists(ldif_fn):
print("Can't file", ldif_fn)
return
print("Loading ldif file", ldif_fn)
gluuInstaller.dbUtils.import_ldif([ldif_fn])
setupUtilities = SetupUtilities()
if argsp.load_ldif:
setupUtilities.load_ldif(argsp.load_ldif)