本文整理汇总了Python中script.util.GaussLog.GaussLog类的典型用法代码示例。如果您正苦于以下问题:Python GaussLog类的具体用法?Python GaussLog怎么用?Python GaussLog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GaussLog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: checkPathUsageParameter
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: parseCommandLine
def parseCommandLine():
"""
"""
try:
(opts, args) = getopt.getopt(sys.argv[1:], "c:p:h", ["help"])
except Exception, e:
usage()
GaussLog.exitWithError(str(e))
示例3: main
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)
示例4: __checkParameters
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)
示例5: main
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
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
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
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
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
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: LocalBackup
class LocalBackup():
'''
classdocs
'''
def __init__(self, user = "", backupDir = "", backupPara = False, backupBin = False, logFile = ""):
'''
Constructor
'''
self.backupDir = backupDir
self.backupPara = backupPara
self.backupBin = backupBin
self.logFile = logFile
self.installPath = ""
self.user = user
self.group = ""
self.nodeInfo = None
self.logger = None
self.__hostnameFile = None
##static parameter
self.defaultLogDir = ""
self.logName = "gs_local_backup.log"
self.envirName = "GAUSS_VERSION"
self.binTarName = "binary.tar"
self.paraTarName = "parameter.tar"
self.hostnameFileName = "HOSTNAME"
####################################################################################
# This is the main install flow.
####################################################################################
def run(self):
'''
check install
'''
self.logger = GaussLog(self.logFile, "LocalBackup")
try:
self.parseConfigFile()
self.checkBackupDir()
self.doBackup()
except Exception,e:
self.logger.closeLog()
raise Exception(str(e))
self.logger.closeLog()
示例12: main
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)
示例13: initGlobal
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))
示例14: checkParameter
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)
示例15: run
def run(self):
'''
check install
'''
self.logger = GaussLog(self.logFile, "LocalBackup")
try:
self.parseConfigFile()
self.checkBackupDir()
self.doBackup()
except Exception,e:
self.logger.closeLog()
raise Exception(str(e))