Пример #1
0
def load_network_template(network_template):
    try:
        data = helpers.load_yaml(network_template)
    except Exception:
        LOG.exception("Cannot open network template from %s",
                      network_template)
        raise
    return data
Пример #2
0
def upload_graph_file_to_env(graph_file_path, env_id):
    """Upload a graph file to Nailgun for an environment."""

    # Try to load graph data
    graph_data = helpers.load_yaml(graph_file_path)
    if not graph_data:
        raise Exception("Graph '{0}' is empty.".format(graph_file_path))
    graph_name = os.path.splitext(os.path.basename(graph_file_path))[0]

    # Upload graph to Nailgun
    client = graph.GraphClient()
    client.upload(graph_data, "clusters", env_id, graph_name)
    LOG.info("Graph '%s' was uploaded for the environment '%s'.",
             graph_name, env_id)