Example #1
0
 def __checkOsUser(self):
     """
     Check if user exists and get $GAUSSHOME
     """
     if(self.cleanUser == False):
         self.logger.log("Skip user check!")
         return
         
     self.logger.log("Begin check OS user...")
     try:
         PlatformCommand.checkUser(self.user, False)
     except Exception as e:
         self.logger.logExit(str(e))
         
     # Get GAUSSHOME
     cmd = "echo $GAUSSHOME 2>/dev/null"
     (status, output) = commands.getstatusoutput(cmd)
     if(status != 0):
         self.logger.logExit("Get $GAUSSHOME failed!Error:%s" % output)
     
     gaussHome = output.strip()
     if (gaussHome == ""):
         self.logger.logExit("$GAUSSHOME is null!")
         
     if (gaussHome != self.installPath):
         self.logger.debug("$GAUSSHOME : %s" % gaussHome)
         self.logger.debug("Install path parameter: %s" % self.installPath)
         self.logger.logExit("$GAUSSHOME of user is not equal to install path!")
     self.logger.log("End check OS user")
Example #2
0
 def __checkOSVersion(self):
     '''
     Check operator system version and install binary file version.
     '''
     self.logger.log("Begin check OS version...")
     if (not PlatformCommand.checkOsVersion()):
         self.logger.logExit("can't support current system,current system is : %s" % platform.platform())
     
     self.logger.log("End check OS version")
Example #3
0
 def __readConfigInfo(self):
     """
     Read config from static config file
     """
     try:
         self.clusterInfo = dbClusterInfo()
         if (os.getgid()==0):
             self.clusterInfo.initFromXml(self.xmlFile)
         else:
             self.clusterInfo.initFromStaticConfig(self.user)
         (self.user, self.group) = PlatformCommand.getPathOwner(self.clusterInfo.appPath)
         hostName = socket.gethostname()
         self.dbNodeInfo = self.clusterInfo.getDbNodeByName(hostName)
         if (self.dbNodeInfo is None):
             self.logger.logExit("Get local instance info failed!There is no host named %s!" % hostName)
     except Exception, e:
         self.logger.logExit(str(e))
Example #4
0
    
    for (key, value) in opts:
        if (key == "-?" or key == "--help"):
            usage()
            sys.exit(0)
        elif (key == "-U"):
            g_clusterUser = value
        elif (key == "-P"):
            dbInitParams.append(value)
        elif (key == "-G"):
            gtmInitParams.append(value)
        elif (key == "-l"):
            logFile = os.path.abspath(value)

    # check if user exist and is the right user
    PlatformCommand.checkUser(g_clusterUser)
        
    if (logFile == ""):
        logFile = DefaultValue.getOMLogPath(DefaultValue.DEFAULT_LOG_FILE, g_clusterUser, "")

    # Init logger
    global g_logger
    g_logger = GaussLog(logFile, "InitInstance")
    try:
        dbInit = initDbNode(dbInitParams, gtmInitParams)
        dbInit.run()
        
        g_logger.log("Init instances on node[%s] successfully!" % socket.gethostname())
        g_logger.closeLog()
        sys.exit(0)
    except Exception, e: