Files
openGauss-OM/script/gs_upgradechk
2023-06-17 15:37:41 +08:00

52 lines
1.6 KiB
Python

#!/usr/bin/env python3
# -*- coding:utf-8 -*-
#############################################################################
# Copyright (c) 2023 Huawei Technologies Co.,Ltd.
#
# openGauss is licensed under Mulan PSL v2.
# You can use this software according to the terms
# and conditions of the Mulan PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
#
# http://license.coscl.org.cn/MulanPSL2
#
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# ----------------------------------------------------------------------------
# Description : gs_upgradechk is a utility to check meta data in gaussdb after upgrade.
#############################################################################
import sys
import os
from upgrade_checker.utils.param import Param
from upgrade_checker.project import ProjectFactory
def program_workspace():
"""
If OM exists, use the log path of OM.
"""
gauss_log = os.getenv('GAUSSLOG')
om_log = os.path.join(gauss_log, 'om') if gauss_log is not None else None
if om_log is not None and os.access(om_log, os.F_OK):
return os.path.join(om_log, 'upgrade_checker')
return os.path.join(sys.path[0], 'upgrade_checker')
if __name__ == "__main__":
param = Param(program_workspace(), sys.argv)
if param.is_help():
print(param.helper)
exit(0)
project = ProjectFactory.produce(param)
project.init()
project.run()
project.close()