Esempio n. 1
0
def graph_json():
    Node.reset_counter() # FIXME: NO!
    Edge.reset_counter() # FIXME: NO!

    dot = DotGraph('', file_contents=run_tf_graph())

    tf = Terraform(os.getcwd())
    for node in dot.nodes:
        node.definition = tf.get_def(node)

    return dot.json()
Esempio n. 2
0
def graph_json():
    Graph.reset_counters()
    dot = DotGraph('', file_contents=run_tf_graph())
    module_depth = request.args.get('module_depth', default=None, type=int)
    if module_depth is not None and module_depth >= 0:
        dot.set_module_depth(module_depth) 

    tf = Terraform(os.getcwd())
    for node in dot.nodes:
        node.definition = tf.get_def(node)

    return dot.json()
Esempio n. 3
0
def graph_json():
    Graph.reset_counters()
    # dot = DotGraph('','',file_contents=run_tf_graph()) we will create jsn with extended svg info
    dot = DotGraph('', '', file_contents=simple_graph())
    module_depth = request.args.get('module_depth', default=None, type=int)
    refocus = request.args.get('refocus', default=None, type=str)
    if module_depth is not None and module_depth >= 0:
        dot.set_module_depth(module_depth)

    tf = Terraform(os.getcwd())
    for node in dot.nodes:
        node.definition = tf.get_def(node)

    if refocus is not None:
        node = dot.get_node_by_name(refocus)
        if node:
            dot.center(node)

    return dot.json()