def deploy_access(self, host): access_instance = "access_" + self.get_host_suffix( host) + "_" + self.time_suffix access_construct_file_path = self.combine_path(self.cureen_path, self.conf, "access") # access_construct_file_path= os.getcwd() + "/ConfigFile/access" self.create_path(access_construct_file_path) access.ModifyAccessConf(self.ice_addr, self.zookeeper_servers, access_instance, access_construct_file_path) tf.uploadFile(host, self.port, self.user, self.password, self.combine_path(access_construct_file_path, self.init), self.access_remote_init_path) print "modify access configure file, Done"
def deploy_rule(self, host): rule_service_instance = "rule_" + self.get_host_suffix( host) + "_" + self.time_suffix rule_construct_file_path = self.combine_path(self.cureen_path, self.conf, "rule") # rule_construct_file_path = os.getcwd() + "/ConfigFile/rule" self.create_path(rule_construct_file_path) rule.ModifyRuleConf(self.ice_addr, self.zookeeper_servers, rule_service_instance, rule_construct_file_path) tf.uploadFile(host, self.port, self.user, self.password, self.combine_path(rule_construct_file_path, self.init), self.rule_remote_init_path) # tf.uploadFile(host,self.port,self.user,self.password,rule_construct_file_path+"/init.properties",self.rule_remote_init_path) print "modify rule configure file, Done"
def deploy_ms(self, host): ms_topic = "ms_" + self.get_host_suffix(host) + "_" + self.time_suffix ms_construct_file_path = self.combine_path(self.cureen_path, self.conf, "ms") # ms_construct_file_path = os.getcwd() + "/ConfigFile/ms" self.create_path(ms_construct_file_path) ms.ModifyMSConf(self.kafka_brokers, self.zookeeper_servers, self.ice_addr, ms_topic, self.sc_ms_group_topic, ms_construct_file_path) tf.uploadFile(host, self.port, self.user, self.password, self.combine_path(ms_construct_file_path, self.init), self.ms_remote_init_path) # tf.uploadFile(host,self.port,self.user,self.password,ms_construct_file_path+"/init.properties",self.ms_remote_init_path) print "modify ms configure file, Done"
def deploy_ma(self, host): ma_topic = "ma_" + self.get_host_suffix(host) + "_" + self.time_suffix # ma_construct_file_path=os.getcwd()+"/ConfigFile/ma" ma_construct_file_path = self.combine_path(self.cureen_path, self.conf, "ma") self.create_path(ma_construct_file_path) ma.ModifyMAConf(self.ice_addr, self.kafka_brokers, self.zookeeper_servers, ma_topic, ma_construct_file_path) tf.uploadFile(host, self.port, self.user, self.password, self.combine_path(ma_construct_file_path, self.init), self.ma_remote_init_path) # tf.uploadFile(host,self.port,self.user,self.password,ma_construct_file_path+"/init.properties",self.ma_remote_init_path) print "modify ma configure file, Done" maInfo = ["ma instance: " + ma_topic]
def deploy_cp(self, host): cp_instance_id = "cp_" + self.get_host_suffix( host) + "_" + self.time_suffix cp_construct_file_path = self.combine_path(self.cureen_path, self.conf, "cp") # cp_construct_file_path = os.getcwd() + "/ConfigFile/cp" self.create_path(cp_construct_file_path) cp.ModifyCPConf(host, cp_instance_id, self.kafka_brokers, self.zookeeper_servers, self.sc_group_topic, cp_construct_file_path) tf.uploadFile(host, self.port, self.user, self.password, self.combine_path(cp_construct_file_path, "cp.config"), self.cp_remote_init_path) # tf.uploadFile(host,self.port,self.user,self.password,cp_construct_file_path+"/cp.config",self.cp_remote_init_path) print "modify cp configure file, Done"
def deploy_gs(self, host): gs_instance_id = "gs_" + self.get_host_suffix( host) + "_" + self.time_suffix gs_construct_file_path = self.combine_path(self.cureen_path, self.conf, "gs") # gs_construct_file_path= os.getcwd() + "/ConfigFile/gs" self.create_path(gs_construct_file_path) gs.ModifyGSConf(host, gs_instance_id, self.kafka_brokers, self.zookeeper_servers, self.sc_group_topic, self.gc_group_topic, gs_construct_file_path) tf.uploadFile(host, self.port, self.user, self.password, self.combine_path(gs_construct_file_path, "gs.config"), self.gs_remote_init_path) # tf.uploadFile(host,self.port,self.user,self.password,gs_construct_file_path+"/gs.config",self.gs_remote_init_path) print "modify gs configure file, Done"
def deploy_gc(self, host): gc_topic = "gc_" + self.get_host_suffix(host) + "_" + self.time_suffix gc_consumer_client_id = self.get_host_suffix(host) gc_construct_file_path = self.combine_path(self.cureen_path, self.conf, "gc") # gc_construct_file_path = os.getcwd() + "/ConfigFile/gc" self.create_path(gc_construct_file_path) gc.ModifyGCConf(self.ice_addr, self.kafka_brokers, self.zookeeper_servers, gc_topic, self.gc_group_topic, self.sc_group_topic, gc_consumer_client_id, gc_construct_file_path) tf.uploadFile(host, self.port, self.user, self.password, self.combine_path(gc_construct_file_path, self.init), self.gc_remote_init_path) # tf.uploadFile(host,self.port,self.user,self.password,gc_construct_file_path+"/init.properties",self.gc_remote_init_path) print "modify gc configure file, Done"
def deploy_sp(self, host): sp_topic = "sp_" + self.get_host_suffix(host) + "_" + self.time_suffix sp_server_id = sp_topic sp_construct_file_path = self.combine_path(self.cureen_path, self.conf, "sp") # sp_construct_file_path = os.getcwd() + "/ConfigFile/sp" self.create_path(sp_construct_file_path) sp.ModifySPConf(self.ice_addr, self.kafka_brokers, self.zookeeper_servers, sp_topic, self.sc_group_topic, self.gc_group_topic, sp_server_id, sp_construct_file_path) tf.uploadFile(host, self.port, self.user, self.password, self.combine_path(sp_construct_file_path, self.init), self.sp_remote_init_path) # tf.uploadFile(host, self.port, self.user, self.password, sp_construct_file_path+"/init.properties", self.sp_remote_init_path) print "modify sp configure file, Done"
rc = ReadConf().readcf() mysectionlist = [] version = rc.get("common", "package_version") buildid = rc.get("common", "buildid") mysections = rc.sections() DeployObj = Deploy() for i in mysections: if "common" in i: pass else: mysectionlist.append(i) for i in mysectionlist: myip = rc.get(i, "ip") myservices = rc.get(i, "service") tf.uploadFile(myip, 22, "root", "123456", os.path.join("MyUtil", "startService.sh"), "/tmp/startService.sh") subprocess.Popen([ os.getcwd() + "/MyUtil/auto.exp " + myip + " 123456 " + version + " " + buildid ], shell=True).wait() myserviceslist = myservices.split(",") for k in myserviceslist: print "\n", "%s installing..." % k subprocess.Popen([ os.getcwd() + "/MyUtil/call_install_server.exp " + myip + " 123456 " + version + " " + k ], shell=True).wait()