def update(request, path='/'): update_stat = "" # set data for this node if 'data' in request.POST: data = request.POST['data'] stat, old_data = zkutils._get(zh, path) try: ret = zk.set(zh, path, data, stat['version']) except IOError, errmsg: update_stat += ("Set data error: %s"%str(errmsg))
def update(request, path='/'): update_stat = "" # set data for this node if 'data' in request.POST: data = request.POST['data'] stat, old_data = zkutils._get(zh, path) try: ret = zk.set(zh, path, data, stat['version']) except IOError, errmsg: update_stat += ("Set data error: %s" % str(errmsg))
if stat != False: acls = zkutils.AclSet(acls).to_display_dict() for acl in acls: hostname = "all" if acl['scheme'] == 'ip': try: hostname = socket.gethostbyaddr(acl['id'])[0] except socket.herror,errmsg: hostname = 'Unknow host' acl['host'] = hostname # javascript conflict with 'id' key. acl['acl_id'] = acl['id'] acl.pop('id') node_dict['acl'].append(acl) stat,data = zkutils._get(zh,path) logging.debug("get data from %s " % path) logging.debug("stat: %s " % str(stat)) logging.debug("data: %s " % str(data)) if stat != False: node_dict['data'] = data else: node_dict['data'] = "error: Get Node Data Failed" stats = zkutils._get_stat(zh,path) if stats == False: node_dict['stat'] = {"error":'Get Node Stat Failed'} else: stat_keys = stats.keys() # stat_keys.sort() for k in stat_keys:
if stat != False: acls = zkutils.AclSet(acls).to_display_dict() for acl in acls: hostname = "all" if acl['scheme'] == 'ip': try: hostname = socket.gethostbyaddr(acl['id'])[0] except socket.herror, errmsg: hostname = 'Unknow host' acl['host'] = hostname # javascript conflict with 'id' key. acl['acl_id'] = acl['id'] acl.pop('id') node_dict['acl'].append(acl) stat, data = zkutils._get(zh, path) if stat != False: node_dict['data'] = data else: node_dict['data'] = "error: Get Node Data Failed" stats = zkutils._get_stat(zh, path) if stats == False: node_dict['stat'] = {"error": 'Get Node Stat Failed'} else: stat_keys = stats.keys() # stat_keys.sort() for k in stat_keys: node_dict['stat'].append({"name": k, "value": stats[k]}) node_dict['stat'].append({ 'name':