本文整理汇总了Python中script.util.GaussLog.GaussLog.exitWithError方法的典型用法代码示例。如果您正苦于以下问题:Python GaussLog.exitWithError方法的具体用法?Python GaussLog.exitWithError怎么用?Python GaussLog.exitWithError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类script.util.GaussLog.GaussLog
的用法示例。
在下文中一共展示了GaussLog.exitWithError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: checkPathUsageParameter
# 需要导入模块: from script.util.GaussLog import GaussLog [as 别名]
# 或者: from script.util.GaussLog.GaussLog import exitWithError [as 别名]
def checkPathUsageParameter():
"""
"""
if (g_opts.newUser == ""):
GaussLog.exitWithError("Parameter input error, need '-u' parameter.")
if (g_opts.configfile == ""):
GaussLog.exitWithError("Parameter input error, need '-X' parameter.")
示例2: main
# 需要导入模块: from script.util.GaussLog import GaussLog [as 别名]
# 或者: from script.util.GaussLog.GaussLog import exitWithError [as 别名]
def main():
"""
main function
"""
try:
opts, args = getopt.getopt(sys.argv[1:], "U:R:i:n:l:", ["help"])
except getopt.GetoptError, e:
GaussLog.exitWithError("Parameter input error: " + e.msg)
示例3: __checkParameters
# 需要导入模块: from script.util.GaussLog import GaussLog [as 别名]
# 或者: from script.util.GaussLog.GaussLog import exitWithError [as 别名]
def __checkParameters(self):
'''
check input parameters
'''
try:
opts, args = getopt.getopt(sys.argv[1:], "U:R:l:du", ["help"])
except getopt.GetoptError, e:
GaussLog.exitWithError("Parameter input error: " + e.msg)
示例4: parseCommandLine
# 需要导入模块: from script.util.GaussLog import GaussLog [as 别名]
# 或者: from script.util.GaussLog.GaussLog import exitWithError [as 别名]
def parseCommandLine():
"""
"""
try:
(opts, args) = getopt.getopt(sys.argv[1:], "c:p:h", ["help"])
except Exception, e:
usage()
GaussLog.exitWithError(str(e))
示例5: main
# 需要导入模块: from script.util.GaussLog import GaussLog [as 别名]
# 或者: from script.util.GaussLog.GaussLog import exitWithError [as 别名]
def main():
"""
main function
"""
try:
opts, args = getopt.getopt(sys.argv[1:], "U:P:l:pbh", ["position=", "parameter", "binary_file", "logpath=", "help"])
except getopt.GetoptError, e:
GaussLog.exitWithError("Parameter input error: " + e.msg)
示例6: parseCommandLine
# 需要导入模块: from script.util.GaussLog import GaussLog [as 别名]
# 或者: from script.util.GaussLog.GaussLog import exitWithError [as 别名]
def parseCommandLine():
"""
Parse command line and save to global variables
"""
try:
opts, args = getopt.getopt(sys.argv[1:], "t:u:U:X:l:", ["password_policy_value=", "support_extended_features=", "help"])
except Exception, e:
usage()
GaussLog.exitWithError("Error: %s" % str(e))
示例7: parseCommandLine
# 需要导入模块: from script.util.GaussLog import GaussLog [as 别名]
# 或者: from script.util.GaussLog.GaussLog import exitWithError [as 别名]
def parseCommandLine():
"""
Parse command line and save to global variable
"""
try:
opts, args = getopt.getopt(sys.argv[1:], "u:U:l:", ["help"])
except Exception, e:
usage()
GaussLog.exitWithError("Error: %s" % str(e))
示例8: parseCommandLine
# 需要导入模块: from script.util.GaussLog import GaussLog [as 别名]
# 或者: from script.util.GaussLog.GaussLog import exitWithError [as 别名]
def parseCommandLine():
"""
Parse command line
"""
try:
(opts, args) = getopt.getopt(sys.argv[1:], "U:l:O?", ["help"])
except Exception, e:
usage()
GaussLog.exitWithError("Error: %s" % str(e))
示例9: importOldVersionModules
# 需要导入模块: from script.util.GaussLog import GaussLog [as 别名]
# 或者: from script.util.GaussLog.GaussLog import exitWithError [as 别名]
def importOldVersionModules():
"""
import some needed modules from the old cluster.
currently needed are: DbClusterInfo
"""
installDir = DefaultValue.getInstallDir(g_opts.oldUser)
if(installDir == ""):
GaussLog.exitWithError("get install of user %s failed." % g_opts.oldUser)
global g_oldVersionModules
g_oldVersionModules = OldVersionModules()
sys.path.append("%s/bin/script/util" % installDir)
g_oldVersionModules.oldDbClusterInfoModule = __import__('DbClusterInfo')
示例10: checkParameter
# 需要导入模块: from script.util.GaussLog import GaussLog [as 别名]
# 或者: from script.util.GaussLog.GaussLog import exitWithError [as 别名]
def checkParameter():
"""
check parameter for different ation
"""
if (g_opts.action == ""):
GaussLog.exitWithError("Parameter input error, need '-t' parameter.")
if (g_opts.logFile == ""):
g_opts.logFile = DefaultValue.getOMLogPath(DefaultValue.DEFAULT_LOG_FILE, g_opts.user, "")
if (g_opts.user == ""):
GaussLog.exitWithError("Parameter input error, need '-u' parameter.")
示例11: main
# 需要导入模块: from script.util.GaussLog import GaussLog [as 别名]
# 或者: from script.util.GaussLog.GaussLog import exitWithError [as 别名]
def main():
"""
main function
"""
if os.getgid() == 0:
GaussLog.exitWithError("Can not use root privilege user run this script")
# parse cmd lines
parseCommandLine()
# init globals
initGlobal()
# execute command
executeCommand()
sys.exit(0)
示例12: initGlobal
# 需要导入模块: from script.util.GaussLog import GaussLog [as 别名]
# 或者: from script.util.GaussLog.GaussLog import exitWithError [as 别名]
def initGlobal():
"""
Init logger
"""
global g_clusterInfo
global g_sshTool
global g_user
try:
cmd = "id -un"
(status, output) = commands.getstatusoutput(cmd)
if status != 0:
GaussLog.exitWithError("Get user info failed")
g_user = output
g_clusterInfo = dbClusterInfo()
g_clusterInfo.initFromStaticConfig(output)
g_sshTool = SshTool(g_clusterInfo.getClusterNodeNames())
except Exception, e:
GaussLog.exitWithError(str(e))
示例13: checkParameter
# 需要导入模块: from script.util.GaussLog import GaussLog [as 别名]
# 或者: from script.util.GaussLog.GaussLog import exitWithError [as 别名]
def checkParameter():
"""
check parameter for different ation
"""
if (g_opts.action == ""):
GaussLog.exitWithError("Parameter input error, need '-t' parameter.")
if (g_opts.logFile == ""):
g_opts.logFile = DefaultValue.getOMLogPath(DefaultValue.DEFAULT_LOG_FILE, g_opts.newUser, "")
if (g_opts.action == ACTION_CLEAN_ENV):
checkCleanEnvParameter()
elif (g_opts.action == ACTION_CHECK_PATH_USAGE):
checkPathUsageParameter()
elif(g_opts.action == ACTION_START_IN_UPGRADE_MODE):
checkStartInUpgradeModeParameter()
elif (g_opts.action == ACTION_REPAIR_OLD_CLUSTER):
checkRepairOldClusterParameter()
elif (g_opts.action == ACTION_SET_GUC_PARAMETER):
checkSetNodeGUCParameters()
else:
GaussLog.exitWithError("Invalid Action : %s" % g_opts.action)
示例14: checkSetNodeGUCParameters
# 需要导入模块: from script.util.GaussLog import GaussLog [as 别名]
# 或者: from script.util.GaussLog.GaussLog import exitWithError [as 别名]
def checkSetNodeGUCParameters():
"""
"""
if (g_opts.newUser == ""):
GaussLog.exitWithError("Parameter input error, need '-u' parameter.")
if (g_opts.password_policy_value == None):
GaussLog.exitWithError("Parameter input error, need '--password_policy_value' parameter.")
else:
if(not g_opts.password_policy_value.isdigit()):
GaussLog.exitWithError("Parameter input error, '--password_policy_value' parameter should be integer.")
#should convert it to int
g_opts.password_policy_value = int(g_opts.password_policy_value)
if (g_opts.support_extended_features_value == None):
GaussLog.exitWithError("Parameter input error, need '--support_extended_features' parameter.")
示例15: checkParameter
# 需要导入模块: from script.util.GaussLog import GaussLog [as 别名]
# 或者: from script.util.GaussLog.GaussLog import exitWithError [as 别名]
def checkParameter():
"""
Check parameter for create os user
"""
if (g_opts.userInfo == ""):
GaussLog.exitWithError("Parameter input error, need '-U' parameter.")
strList = g_opts.userInfo.split(":")
if (len(strList) != 2):
GaussLog.exitWithError("Parameter input error: -U " + g_opts.userInfo)
if (strList[0] == "" or strList[1] == ""):
GaussLog.exitWithError("Parameter input error: -U " + g_opts.userInfo)
g_opts.user = strList[0]
g_opts.group = strList[1]
if (g_opts.logFile == ""):
g_opts.logFile = DefaultValue.getOMLogPath(DefaultValue.DEFAULT_LOG_FILE, g_opts.user, "")
if (not os.path.isabs(g_opts.logFile)):
GaussLog.exitWithError("Parameter input error, log path need absolute path.")