Example #1
0
    def post(self):
        oname = self.get_username()
        ipAddress = self.get_argument("ipAddress", None)
        ename = self.get_argument("ename", None)
        elogo = self.get_argument("elogo", None)
        print "this is {}".format(elogo)
        etype = self.get_argument("etype", None)
        tusername = self.get_argument("tusername", None)
        tpassword = self.get_argument("tpassword", None)
        if not tusername or not tpassword:
            # do something
            self.flash.error = "You must enter a username and password to proceed. Please try again."
            self.redirect("/add_exchange")
            return

        if tpassword != self.get_argument("tpassword2", None):
            self.flash.error = "Passwords do not match. Please try again."
            self.redirect("/add_exchange")
            return
        Exchange.insert(ename, oname, ipAddress, elogo, etype)
        #         rpc = TelnetRpcClient(options.service_ip)
        #         msg = json.dumps({'fileadd':options.telnet_key_dir, \
        #                                                     'ipadd':ipAddress,'username':tusername,"password":tpassword})
        #         from util import encrypt_util
        #         encoded = encrypt_util.encode(msg)
        #         response = rpc.call("key_queue",encoded)
        #         Log.info(response)
        ##加密传输入保存
        self.redirect("/get_exchanges")
Example #2
0
 def post(self):  
     oname = self.get_username()
     ipAddress = self.get_argument("ipAddress", None)
     ename = self.get_argument("ename", None)
     tusername = self.get_argument("tusername", None)
     tpassword = self.get_argument("tpassword", None)
     if not tusername or not tpassword:
         # do something
         self.flash.error = "You must enter a username and password to proceed. Please try again."
         self.redirect("/add_exchange")
         return
     
     if tpassword != self.get_argument("tpassword2", None) :
         self.flash.error = "Passwords do not match. Please try again."
         self.redirect("/add_exchange")
         return
     Exchange.insert(ename,oname,ipAddress)
     rpc = TelnetRpcClient(options.service_ip)
     msg = json.dumps({'fileadd':options.telnet_key_dir, \
                                                 'ipadd':ipAddress,'username':tusername,"password":tpassword})
     from util import encrypt_util  
     encoded = encrypt_util.encode(msg)
     response = rpc.call("key_queue",encoded)
     Log.info(response)
     ##加密传输入保存
     self.redirect("/get_exchanges")     
Example #3
0
 def post(self):  
     oname = self.get_username()
     ipAddress = self.get_argument("ipAddress", None)
     ename = self.get_argument("ename", None)
     tusername = self.get_argument("tusername", None)
     tpassword = self.get_argument("tpassword", None)
     rpc = TelnetRpcClient(options.service_ip)
     Exchange.insert(ename,oname,ipAddress)
     response = rpc.call("key_queue",json.dumps({'fileadd':options.telnet_key_dir,'ipadd':ipAddress,'username':tusername,"password":tpassword}))
     self.redirect("/manage")     
     
     
     
     
Example #4
0
 def post(self):
     oname = self.get_username()
     ipAddress = self.get_argument("ipAddress", None)
     ename = self.get_argument("ename", None)
     tusername = self.get_argument("tusername", None)
     tpassword = self.get_argument("tpassword", None)
     rpc = TelnetRpcClient(options.service_ip)
     Exchange.insert(ename, oname, ipAddress)
     response = rpc.call(
         "key_queue",
         json.dumps({
             'fileadd': options.telnet_key_dir,
             'ipadd': ipAddress,
             'username': tusername,
             "password": tpassword
         }))
     self.redirect("/manage")