File: callTracer.py

package info (click to toggle)
cockpit 355-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 311,568 kB
  • sloc: javascript: 774,787; python: 40,655; ansic: 35,157; cpp: 11,141; sh: 3,512; makefile: 580; xml: 261
file content (19 lines) | stat: -rw-r--r-- 480 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import json

from tracer.query import Query

q = Query()
applications = q.affected_applications().get()


def filter_by_type(apps, type_str):
    return [app.name for app in apps if app.type == type_str]


dump_obj = {}
# ignore type "session" for cockpit use case
dump_obj["reboot"] = filter_by_type(applications, "static")
dump_obj["daemons"] = filter_by_type(applications, "daemon")
dump_obj["manual"] = filter_by_type(applications, "application")

print(json.dumps(dump_obj))