def submit(self, event=None): ip = self.txt_ip.get() if not ip or not core.check_ip(ip): tkMessageBox.showwarning('neup', 'Invalid ip address!') return p = self.txt_path.get() if not p or not os.path.exists(p): tkMessageBox.showwarning('neup', 'Invalid package path!') return b = self.var.get() nu = core.NeUp(ip, ip, p, b) try: nu.update() except Exception, e: tkMessageBox.showerror('neup', e) return
#Main program:parse command line and start processing def main(): try: opts, args = getopt.getopt(sys.argv[1:], 'b') except getopt.error, msg: usage(msg) ip1 = '192.168.3.211' ip2 = '192.168.3.211' p = './update.tar.gz' b = False if len(args) == 2 or len(args) == 3: ip1 = args[0] if not core.check_ip(ip1): print 'neup: Invalid master ip!' sys.exit(1) ip2 = args[-2] if not core.check_ip(ip2): print 'neup: Invalid slave ip!' sys.exit(2) p = args[-1] if not p.endswith('.tar.gz'): print 'neup: Update package must end with .tar.gz!' sys.exit(3) if not os.path.exists(p): print 'neup: Update package does not exist: %s!' % p