#!/usr/bin/python
from edge.com import fs
from edge import path_helpers as ph
from edge import pipeline_helpers as oh


def main():

    origins_jnode = oh.get_pipeline_jnode_set2() or list()
    for origin_jnode in origins_jnode:
        for detector_jnode in origin_jnode.get('detectors', list()):
            if detector_jnode.get('type') == ph.UI_TYPE_RED_LIGHT:
                ui_pid = origin_jnode['id']
                ui_type = ph.UI_TYPE_RED_LIGHT
                ui_id = detector_jnode['id']

                rl_schema_path = ph.get_ui_pipeline_schema_filepath(ui_pid, ui_type, ui_id)
                rl_jnode_path = ph.get_ui_pipeline_jnode_filepath(ui_pid, ui_type, ui_id)

                fs.ln_schema(rl_schema_path, rl_jnode_path)


if __name__ == '__main__':
    main()
