@@ -183,14 +183,6 @@ def process_whitelist_experimental(repositories, workflow, configuration, logger
183183 raise CommandError (msg )
184184
185185
186- def process_report_schema (args , cfg ):
187- default_report_schema = cfg .get ('report' , 'schema' )
188- if args .report_schema and args .report_schema > default_report_schema :
189- raise CommandError ('--report-schema version can not be greater that the '
190- 'actual {} one.' .format (default_report_schema ))
191- return args .report_schema or default_report_schema
192-
193-
194186@command ('upgrade' , help = 'Upgrade the current system to the next available major version.' )
195187@command_opt ('resume' , is_flag = True , help = 'Continue the last execution after it was stopped (e.g. after reboot)' )
196188@command_opt ('reboot' , is_flag = True , help = 'Automatically performs reboot when requested.' )
@@ -201,7 +193,8 @@ def process_report_schema(args, cfg):
201193 ' with Red Hat Subscription Manager' )
202194@command_opt ('enablerepo' , action = 'append' , metavar = '<repoid>' ,
203195 help = 'Enable specified repository. Can be used multiple times.' )
204- @command_opt ('report-schema' , help = 'Specify report schema version for leapp-report.json' , choices = ['1.0.0' , '1.1.0' ])
196+ @command_opt ('report-schema' , help = 'Specify report schema version for leapp-report.json' , choices = ['1.0.0' , '1.1.0' ],
197+ default = get_config ().get ('report' , 'schema' ))
205198def upgrade (args ):
206199 skip_phases_until = None
207200 context = str (uuid .uuid4 ())
@@ -210,7 +203,6 @@ def upgrade(args):
210203 configuration = prepare_configuration (args )
211204 answerfile_path = cfg .get ('report' , 'answerfile' )
212205 userchoices_path = cfg .get ('report' , 'userchoices' )
213- report_schema = process_report_schema (args , cfg )
214206 if os .getuid ():
215207 raise CommandError ('This command has to be run under the root user.' )
216208
@@ -253,7 +245,7 @@ def upgrade(args):
253245 workflow .save_answers (answerfile_path , userchoices_path )
254246 report_errors (workflow .errors )
255247 report_inhibitors (context )
256- generate_report_files (context , report_schema )
248+ generate_report_files (context , args . report_schema )
257249 report_files = get_cfg_files ('report' , cfg )
258250 log_files = get_cfg_files ('logs' , cfg )
259251 report_info (report_files , log_files , answerfile_path , fail = workflow .failure )
@@ -270,7 +262,8 @@ def upgrade(args):
270262 ' with Red Hat Subscription Manager' )
271263@command_opt ('enablerepo' , action = 'append' , metavar = '<repoid>' ,
272264 help = 'Enable specified repository. Can be used multiple times.' )
273- @command_opt ('report-schema' , help = 'Specify report schema version for leapp-report.json' , choices = ['1.0.0' , '1.1.0' ])
265+ @command_opt ('report-schema' , help = 'Specify report schema version for leapp-report.json' , choices = ['1.0.0' , '1.1.0' ],
266+ default = get_config ().get ('report' , 'schema' ))
274267def preupgrade (args ):
275268 context = str (uuid .uuid4 ())
276269 cfg = get_config ()
@@ -279,7 +272,6 @@ def preupgrade(args):
279272 answerfile_path = cfg .get ('report' , 'answerfile' )
280273 userchoices_path = cfg .get ('report' , 'userchoices' )
281274
282- report_schema = process_report_schema (args , cfg )
283275 if os .getuid ():
284276 raise CommandError ('This command has to be run under the root user.' )
285277 e = Execution (context = context , kind = 'preupgrade' , configuration = configuration )
@@ -303,7 +295,7 @@ def preupgrade(args):
303295
304296 logger .info ("Answerfile will be created at %s" , answerfile_path )
305297 workflow .save_answers (answerfile_path , userchoices_path )
306- generate_report_files (context , report_schema )
298+ generate_report_files (context , args . report_schema )
307299 report_errors (workflow .errors )
308300 report_inhibitors (context )
309301 report_files = get_cfg_files ('report' , cfg )
0 commit comments