1"""
2Display clean output of an overstate stage
3==========================================
4
5This outputter is used to display :ref:`Orchestrate Runner
6<orchestrate-runner>` stages, and should not be called directly.
7"""
8
9
10import salt.utils.color
11
12# [{'group2': {'match': ['fedora17-2', 'fedora17-3'],
13#              'require': ['group1'],
14#              'sls': ['nginx', 'edit']}
15#              }
16#              ]
17
18
19def output(data, **kwargs):  # pylint: disable=unused-argument
20    """
21    Format the data for printing stage information from the overstate system
22    """
23    colors = salt.utils.color.get_colors(
24        __opts__.get("color"), __opts__.get("color_theme")
25    )
26    ostr = ""
27    for comp in data:
28        for name, stage in comp.items():
29            ostr += "{}{}: {}\n".format(colors["LIGHT_BLUE"], name, colors["ENDC"])
30            for key in sorted(stage):
31                ostr += "    {}{}: {}{}\n".format(
32                    colors["LIGHT_BLUE"], key, stage[key], colors["ENDC"]
33                )
34    return ostr
35