Exemplo n.º 1
0
def delete(request):
    path = request.GET['path']
    path = str(path).replace("//", '/')
    try:
        znode = ZNode(path)
        znode.delete()

        sPath = path.split('/')[:-1]
        toPath = '/'.join(sPath)
        toPath = "/tree" + toPath
        return redirect(toPath)
    except Exception as err:
        return render_to_response('zktree/error.html', {'error': str(err)})
Exemplo n.º 2
0
def delete(request):
    path = request.GET['path']
    path = str(path).replace("//", '/')
    try:
        znode = ZNode(path)
        znode.delete()
        
        sPath = path.split('/')[:-1]
        toPath = '/'.join(sPath)
        toPath = "/tree"+toPath
        return redirect(toPath)
    except Exception as err:
        return render_to_response('zktree/error.html',
                                  {'error':str(err)})
Exemplo n.º 3
0
def index(request, path=""):
    path = "/" + path
    try:
        znode = ZNode(path)
        znode.children.sort()
        if znode.data and not istext(znode.data):
            znode.data = "0x" + "".join(["%d" % (ord(d)) for d in znode.data])
            znode.datatype = "bin"
        else:
            znode.datatype = "str"

        return render_to_response('zktree/index.html', {'znode': znode})
    except Exception as err:
        traceback.print_exc()
        return render_to_response('zktree/error.html', {'error': str(err)})
Exemplo n.º 4
0
def index(request, path=""):
    path = "/" + path
    try:
        znode = ZNode(path)
        znode.children.sort()
        if znode.data and not istext(znode.data):
            znode.data = "0x" + "".join(["%d" % (ord(d)) for d in znode.data])
            znode.datatype = "bin"
        else:
            znode.datatype = "str"

        return render_to_response("zktree/index.html", {"znode": znode})
    except Exception as err:
        traceback.print_exc()
        return render_to_response("zktree/error.html", {"error": str(err)})
Exemplo n.º 5
0
def index(request, path=''):
    try:
        znode = ZNode('/' + path)
        znode.children.sort()
        if not istext(znode.data):
            znode.data = '0x' + ''.join(['%d' % (ord(d)) for d in znode.data])
            znode.datatype = 'bin'
        else:
            znode.datatype = 'str'

        return render_to_response('zktree/index.html',
                                  {'znode':znode})
    except Exception as err:
        return render_to_response('zktree/error.html',
                                  {'error':str(err)})
Exemplo n.º 6
0
def index(request, path=""):
    print(path)
    path = "/" + path
    try:
        znode = ZNode(path)
        znode.children.sort()
        if not istext(znode.data):
            znode.data = "0x" + "".join(["%d" % (ord(d)) for d in znode.data])
            znode.datatype = "bin"
        else:
            znode.datatype = "str"

        return render_to_response('zktree/index.html',
                                  {'znode':znode})
    except Exception as err:
        return render_to_response('zktree/error.html',
                                  {'error':str(err)})
Exemplo n.º 7
0
def index(request):
    server_data = []
    for i, server in enumerate(ZOOKEEPER_SERVERS):
        zkserver = ZKServer(server)
        zkserver.id = i
        server_data.append(zkserver)
        
    rootNode = ZNode()
    children = rootNode.getExtendedChildren()
    quotaNode = ZNode("/zookeeper/quota")

    return render_to_response('zkadmin/index.html',
                              {'ZOOKEEPER_SERVERS':ZOOKEEPER_SERVERS,
                               'server_data':server_data,
                               'rootNode':rootNode,
                               'children':children,
                               'quotaNode':quotaNode})
Exemplo n.º 8
0
def index(request):
    server_data = []
    for i, server in enumerate(ZOOKEEPER_SERVERS):
        zkserver = ZKServer(server)
        zkserver.id = i
        server_data.append(zkserver)

    rootNode = ZNode()
    children = rootNode.getExtendedChildren()
    quotaNode = ZNode("/zookeeper/quota")

    return render_to_response(
        'zkadmin/index.html', {
            'ZOOKEEPER_SERVERS': ZOOKEEPER_SERVERS,
            'server_data': server_data,
            'rootNode': rootNode,
            'children': children,
            'quotaNode': quotaNode
        })
Exemplo n.º 9
0
def index(request, path=""):
    print(path)
    path = "/" + path
    try:
        znode = ZNode(path)
        znode.children.sort()
        if not istext(znode.data):
            znode.data = "0x" + "".join(["%d" % (ord(d)) for d in znode.data])
            znode.datatype = "bin"
        else:
            znode.datatype = "str"

        return render_to_response('zktree/index.html',
                                  {'znode':znode,
                                   'isZKPath':str(znode.path).startswith("/zookeeper"),
                                   'zchildren':znode.getExtendedChildren()})
    except Exception as err:
        tback = traceback.format_exc(err)
        return render_to_response('zktree/error.html',
                                  {'error':str(err),
                                   'traceback':tback})
Exemplo n.º 10
0
def index(request, path=""):
    print(path)
    path = "/" + path
    try:
        znode = ZNode(path)
        znode.children.sort()
        if not istext(znode.data):
            znode.data = "0x" + "".join(["%d" % (ord(d)) for d in znode.data])
            znode.datatype = "bin"
        else:
            znode.datatype = "str"

        return render_to_response(
            'zktree/index.html', {
                'znode': znode,
                'isZKPath': str(znode.path).startswith("/zookeeper"),
                'zchildren': znode.getExtendedChildren()
            })
    except Exception as err:
        tback = traceback.format_exc(err)
        return render_to_response('zktree/error.html', {
            'error': str(err),
            'traceback': tback
        })