@@ -64,12 +64,28 @@ def parse_filters(kwargs) -> dict[str, Any]:
64
64
65
65
@click .group ()
66
66
@click .option ('-v' , '--verbose' , count = True , help = "Increase verbosity" )
67
- def main (verbose : int ):
67
+ def maingroup (verbose : int ):
68
68
"""Handle triage of Yocto autobuilder failures."""
69
69
utils .setup_logging (verbose )
70
70
71
71
72
- @main .command ()
72
+ def main ():
73
+ """Handle triage of Yocto autobuilder failures."""
74
+ try :
75
+ maingroup () # pylint: disable=no-value-for-parameter
76
+ except utils .LoginRequiredException as e :
77
+ if e .service == "swatbot" :
78
+ logger .warning ("Login required to swatbot server" )
79
+ user = click .prompt ('swatbot user' )
80
+ password = click .prompt ('swatbot password' , hide_input = True )
81
+ success = swatbotrest .login (user , password )
82
+ if success :
83
+ maingroup () # pylint: disable=no-value-for-parameter
84
+ else :
85
+ raise
86
+
87
+
88
+ @maingroup .command ()
73
89
@click .option ('--user' , '-u' , prompt = True )
74
90
@click .option ('--password' , '-p' , prompt = True , hide_input = True )
75
91
def login (user : str , password : str ):
@@ -145,7 +161,7 @@ def format_field(build, userinfo, field):
145
161
return (table , headers )
146
162
147
163
148
- @main .command ()
164
+ @maingroup .command ()
149
165
@_add_options (failures_list_options )
150
166
@click .option ('--open-url' , '-u' , is_flag = True ,
151
167
help = "Open the autobuilder url in web browser" )
@@ -194,7 +210,7 @@ def show_pending_failures(refresh: str, open_url: str,
194
210
if b .status == swatbuild .Status .CANCELLED ]))
195
211
196
212
197
- @main .command ()
213
+ @maingroup .command ()
198
214
@_add_options (failures_list_options )
199
215
@click .option ('--open-autobuilder-url' , '-u' , is_flag = True ,
200
216
help = "Open the autobuilder url in web browser" )
@@ -235,7 +251,7 @@ def review_pending_failures(refresh: str, open_autobuilder_url: bool,
235
251
userinfos .save ()
236
252
237
253
238
- @main .command ()
254
+ @maingroup .command ()
239
255
@click .option ('--dry-run' , '-n' , is_flag = True ,
240
256
help = "Only shows what would be done" )
241
257
def publish_new_reviews (dry_run : bool ):
0 commit comments