def copyAndModCertFiles(self): """ function : copy and chage permission cert files input : NA output : NA """ user = g_OSlib.getUserInfo()["name"] appPath = DefaultValue.getInstallDir(user) caPath = os.path.join(appPath, "share/sslcert/om") # cp cert files g_file.cpFile("%s/server.crt" % caPath, "%s/" % self.instInfo.datadir) g_file.cpFile("%s/server.key" % caPath, "%s/" % self.instInfo.datadir) g_file.cpFile("%s/cacert.pem" % caPath, "%s/" % self.instInfo.datadir) g_file.cpFile("%s/server.key.cipher" % caPath, "%s/" % self.instInfo.datadir) g_file.cpFile("%s/server.key.rand" % caPath, "%s/" % self.instInfo.datadir) # change mode g_file.changeMode(DefaultValue.KEY_FILE_MODE, "%s/server.crt" % self.instInfo.datadir) g_file.changeMode(DefaultValue.KEY_FILE_MODE, "%s/server.key" % self.instInfo.datadir) g_file.changeMode(DefaultValue.KEY_FILE_MODE, "%s/cacert.pem" % self.instInfo.datadir) g_file.changeMode(DefaultValue.KEY_FILE_MODE, "%s/server.key.cipher" % self.instInfo.datadir) g_file.changeMode(DefaultValue.KEY_FILE_MODE, "%s/server.key.rand" % self.instInfo.datadir)
def getInstanceNodeName(self): """ function: Get Instance Node Name input : NA output: instance node name """ user = g_OSlib.getUserInfo()["name"] clusterInfo = dbClusterInfo() clusterInfo.initFromStaticConfig(user) peerInsts = clusterInfo.getPeerInstance(self.instInfo) nodename = "dn_%d" % self.instInfo.instanceId if len(peerInsts) == 0: return nodename nodename = ClusterInstanceConfig. \ setReplConninfoForSinglePrimaryMultiStandbyCluster( self.instInfo, peerInsts, clusterInfo)[1] return nodename
def setPrimaryStandyConnInfo(self, peerInsts): """ function: Modify replconninfo for datanode input : peerInsts output: NA """ connInfo1 = None connInfo2 = None dummyStandbyInst = None nodename = None user = g_OSlib.getUserInfo()["name"] clusterInfo = dbClusterInfo() clusterInfo.initFromStaticConfig(user) if (self.clusterType == DefaultValue.CLUSTER_TYPE_SINGLE_PRIMARY_MULTI_STANDBY or self.clusterType == DefaultValue.CLUSTER_TYPE_SINGLE_INST): (connInfo1, nodename) = ClusterInstanceConfig. \ setReplConninfoForSinglePrimaryMultiStandbyCluster( self.instInfo, peerInsts, clusterInfo) for i in range(len(connInfo1)): connInfo = "replconninfo" + "%d" % (i + 1) tmpDict1 = {} tmpDict1[connInfo] = "'%s'" % connInfo1[i] self.setGucConfig(tmpDict1) if "availablezone" in tmpDict1[connInfo]: tempazname = tmpDict1[connInfo].split("=")[-1].strip("'") #if "availablezone" in str(connInfo1): self.setGucConfig({"available_zone": "'%s'" % self.instInfo.azName}) else: (connInfo1, connInfo2, dummyStandbyInst, nodename) = \ ClusterInstanceConfig.setReplConninfo(self.instInfo, peerInsts, clusterInfo) connInfo = "replconninfo1" tmpDict1 = {} tmpDict1[connInfo] = "'%s'" % connInfo1 self.setGucConfig(tmpDict1) if (dummyStandbyInst is not None): tmpDict2 = {} tmpDict2["replconninfo2"] = "'%s'" % connInfo2 self.setGucConfig(tmpDict2)