Exemplo n.º 1
0
def install_urlmetadata_systemd(c):
    """Push urlmetadata.service configuration on a server"""
    base = get_assembl_code_path(c)
    template_dir = join(base, 'templates/system/')
    template_path = join(template_dir, 'urlmetadata.service.jinja2.jinja2')
    assert sudo_exists(c, template_path, sudo=True)
    fill_template(c, template_path, '/tmp/urlmetadata.service', default_dir=template_dir)

    c.sudo('cp /tmp/urlmetadata.service /etc/systemd/system/urlmetadata.service')
    c.sudo('sudo systemctl daemon-reload')
    c.sudo('systemctl enable urlmetadata')
    c.run('rm /tmp/urlmetadata.service')
Exemplo n.º 2
0
def install_assembl_systemd(c, assembl_path=None):
    """Push assembl.service configuration on a server. Asseme cloud env only"""
    base = get_assembl_code_path(c)
    template_dir = join(base, 'templates/system/')
    template_path = join(template_dir, 'assembl.service.jinja2')
    assert sudo_exists(c, template_path, sudo=True)
    fill_template(c, template_path, '/tmp/assembl.service', default_dir=template_dir)

    c.sudo('cp /tmp/assembl.service /etc/systemd/system/assembl.service')
    c.sudo('sudo systemctl daemon-reload')
    c.sudo('systemctl enable assembl')
    c.run('rm /tmp/assembl.service')
Exemplo n.º 3
0
    definitions = []
    definitions.sort(key=lambda d: d.name)

    for name, definition in json_top_node["definitions"].items():
        references = []
        descriptions = []
        for prop_name, prop in definition["properties"].items():
            if "$ref" in prop:
                ref_name, ref_anchor = extract_ref_name_and_anchor(
                    prop["$ref"])
                references.append(DefinitionReference(ref_name, ref_anchor))
            if "description" in prop:
                descriptions.append(
                    DefinitionFieldDescription(prop_name, prop["description"]))

        definitions.append(
            SchemaDefinition(name, presentable_top_node(definition),
                             references, descriptions))

    presentable_json = presentable_top_node(json_top_node)

    output_file = open(args.output, "w")
    print(
        common.fill_template("backend.md",
                             event_schema=presentable_json,
                             parameters=parameters,
                             definitions=definitions),
        file=output_file,
    )
    output_file.close()
Exemplo n.º 4
0
        for p in et["properties"]:
            prop = EventTypeProperty(p["name"], p["type"], p["definition"])
            event_type.properties.append(prop)
        event_types.append(event_type)
    return event_types


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Generate SECL documentation")
    parser.add_argument(
        "--input",
        type=str,
        help="input json file generated by the accessors generator")
    parser.add_argument("--output", type=str, help="output file")
    parser.add_argument("--template",
                        type=str,
                        default="agent_expressions.md",
                        help="template used for the generation")
    args = parser.parse_args()

    secl_json_file = open(args.input)
    json_top_node = json.load(secl_json_file)
    secl_json_file.close()

    event_types = build_event_types(json_top_node)

    output_file = open(args.output, "w")
    print(common.fill_template(args.template, event_types=event_types),
          file=output_file)
    output_file.close()