1+ from functools import wraps
2+
13import click
24
35from kcidev .libs .dashboard import (
6+ dashboard_fetch_hardware_boots ,
7+ dashboard_fetch_hardware_builds ,
48 dashboard_fetch_hardware_list ,
59 dashboard_fetch_hardware_summary ,
10+ dashboard_fetch_hardware_tests ,
11+ )
12+ from kcidev .subcommands .results .options import (
13+ builds_and_tests_options ,
14+ results_display_options ,
15+ )
16+ from kcidev .subcommands .results .parser import (
17+ cmd_builds ,
18+ cmd_hardware_list ,
19+ cmd_summary ,
20+ cmd_tests ,
621)
7- from kcidev .subcommands .results .options import results_display_options
8- from kcidev .subcommands .results .parser import cmd_hardware_list , cmd_summary
22+
23+
24+ def hardware_common_opt (func ):
25+ @click .option ("--name" , required = True , help = "Name of the hardware" )
26+ @click .option ("--origin" , default = "maestro" , help = "Select KCIDB origin" )
27+ @wraps (func )
28+ def wrapper (* args , ** kwargs ):
29+ return func (* args , ** kwargs )
30+
31+ return wrapper
932
1033
1134@click .group (chain = True , help = "Get hardware related information from the dashboard" )
@@ -23,9 +46,35 @@ def list(origin, use_json):
2346
2447
2548@hardware .command ()
26- @click .option ("--name" , required = True , help = "Name of the hardware" )
27- @click .option ("--origin" , default = "maestro" , help = "Select KCIDB origin" )
49+ @hardware_common_opt
2850@results_display_options
2951def summary (name , origin , use_json ):
3052 data = dashboard_fetch_hardware_summary (name , origin , use_json )
3153 cmd_summary (data , use_json )
54+
55+
56+ @hardware .command ()
57+ @hardware_common_opt
58+ @results_display_options
59+ @builds_and_tests_options
60+ def boots (name , origin , use_json , download_logs , status , filter , count ):
61+ data = dashboard_fetch_hardware_boots (name , origin , use_json )
62+ cmd_tests (data ["boots" ], name , download_logs , status , filter , count , use_json )
63+
64+
65+ @hardware .command ()
66+ @hardware_common_opt
67+ @results_display_options
68+ @builds_and_tests_options
69+ def builds (name , origin , use_json , download_logs , status , filter , count ):
70+ data = dashboard_fetch_hardware_builds (name , origin , use_json )
71+ cmd_builds (data , name , download_logs , status , count , use_json )
72+
73+
74+ @hardware .command ()
75+ @hardware_common_opt
76+ @results_display_options
77+ @builds_and_tests_options
78+ def tests (name , origin , use_json , download_logs , status , filter , count ):
79+ data = dashboard_fetch_hardware_tests (name , origin , use_json )
80+ cmd_tests (data ["tests" ], name , download_logs , status , filter , count , use_json )
0 commit comments