Hacked By AnonymousFox
# coding=utf-8
#
# Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2019 All Rights Reserved
#
# Licensed under CLOUD LINUX LICENSE AGREEMENT
# http://cloudlinux.com/docs/LICENSE.TXT
from __future__ import print_function
from __future__ import absolute_import
import sys
from clcommon import clconfpars
from clcommon.lib.cledition import lve_supported_or_exit
from lvestats.utils.v1import import CONFIG_PATH_v1, get_config_path, get_import_status, get_connection_string, \
init_v1_db_migrator, CONFIG_PATH_v2, NOTIFY_PATH_v1, NOTIFY_PATH_v2, set_import_status
@lve_supported_or_exit
def main():
try:
if get_import_status():
print('Settings already imported')
sys.exit(0)
config_path = get_config_path(CONFIG_PATH_v1)
if config_path:
lvestats_config = clconfpars.load(config_path, True)
if 'COMPACT' in lvestats_config:
lvestats_config.pop('COMPACT', None)
try:
get_connection_string(lvestats_config)
except Exception:
raise Exception('Parameter "connect_string" has incorrect format')
init_v1_db_migrator(lvestats_config)
clconfpars.change_settings(lvestats_config, CONFIG_PATH_v2)
notify_path = get_config_path(NOTIFY_PATH_v1)
if notify_path:
lvestats_config = clconfpars.load(notify_path, True)
clconfpars.change_settings(lvestats_config, NOTIFY_PATH_v2)
set_import_status(1)
except Exception as e:
print("Import settings error:", str(e))
sys.exit(1)
if __name__ == '__main__':
main()
Hacked By AnonymousFox1.0, Coded By AnonymousFox