Beispiel #1
0
def tree(request, id, path):
    cluster = get_cluster_or_404(id)
    zk = ZooKeeper(cluster['rest_gateway'])

    znode = zk.get(path)
    children = sorted(zk.get_children_paths(path))

    return render('tree.mako', request,
      dict(cluster=cluster, path=path, \
        znode=znode, children=children))
Beispiel #2
0
def tree(request, id, path):
  cluster = get_cluster_or_404(id)
  zk = ZooKeeper(cluster['rest_gateway'])

  znode = zk.get(path)
  children = sorted(zk.get_children_paths(path))
  
  return render('tree.mako', request,
    dict(cluster=cluster, path=path, \
      znode=znode, children=children))
Beispiel #3
0
def edit_as_text(request, id, path):
    cluster = get_cluster_or_404(id)
    zk = ZooKeeper(cluster['rest_gateway'])
    node = zk.get(path)

    if request.method == 'POST':
        form = EditZNodeForm(request.POST)
        if form.is_valid():
            zk.set(path, form.cleaned_data['data'])

        return tree(request, id, path)
    else:
        form = EditZNodeForm(dict(data=node.get('data64', '')\
          .decode('base64').strip(),
          version=node.get('version', '-1')))

    return render('edit.mako', request, dict(path=path, form=form))
Beispiel #4
0
def edit_as_text(request, id, path):
  cluster = get_cluster_or_404(id)
  zk = ZooKeeper(cluster['rest_gateway'])
  node = zk.get(path)

  if request.method == 'POST':
    form = EditZNodeForm(request.POST)
    if form.is_valid():
      zk.set(path, form.cleaned_data['data'])

    return tree(request, id, path)
  else:
    form = EditZNodeForm(dict(data=node.get('data64', '')\
      .decode('base64').strip(), 
      version=node.get('version', '-1')))

  return render('edit.mako', request,
    dict(path=path, form=form))