Exemplo n.º 1
0
 def response(self):
     '''add
     '''
     if self.id:
         # 修改记录
         tb_inst = ZdZookeeper.one(id=self.id)
     else:
         # 新增记录
         zookeeper = ZdZookeeper.one(cluster_name=self.cluster_name,
                                     deleted='0')
         # 检验集群名称是否重复
         if zookeeper:
             return self.ajax_popup(code=300, msg="zookeeper集群名称重复!")
         else:
             tb_inst = ZdZookeeper()
     if self.id:
         tb_inst.id = self.id
     if self.cluster_name:
         tb_inst.cluster_name = self.cluster_name
     if self.hosts:
         tb_inst.hosts = self.hosts
     if self.business:
         tb_inst.business = self.business
     tb_inst.save()
     return self.ajax_ok(forward="/config/zookeeper/index")
Exemplo n.º 2
0
 def response(self):
     '''add
     '''
     if self.id:
         # 修改记录
         tb_inst = ZdZookeeper.one(id=self.id)
     else:
         # 新增记录
         zookeeper = ZdZookeeper.one(cluster_name=self.cluster_name, deleted='0')
         # 检验集群名称是否重复
         if zookeeper:
             return self.ajax_popup(code=300, msg="zookeeper集群名称重复!")
         else:
             tb_inst = ZdZookeeper()
     if self.id:
         tb_inst.id = self.id
     if self.cluster_name:
         tb_inst.cluster_name = self.cluster_name
     if self.hosts:
         tb_inst.hosts = self.hosts
     if self.business:
         tb_inst.business = self.business
     tb_inst.save()
     return self.ajax_ok(forward="/config/zookeeper/index")