diff --git a/lib/anaconda.pm b/lib/anaconda.pm index 73b8a0de..a75c5b51 100644 --- a/lib/anaconda.pm +++ b/lib/anaconda.pm @@ -361,38 +361,6 @@ sub check_help_on_pane { } } - - -sub bugzilla_setup { - # This routines makes necessary settings to enable Bugzilla (staging/production) - # reporting from Anaconda easily, without the need to type the Bugzilla API. - # Switch to shell - send_key("alt-f3"); - assert_screen("anaconda_text_install_shell"); - # Navigate to the libreport configuration directory - type_string("cd /etc/libreport/events/\n"); - # Add some sleeps to make the output video more viewable - sleep(3); - # Change values in the report_Bugzilla.conf file - my $apikey = get_var("_SECRET_BUGZILLA_APIKEY") // undef; - # If we want to report to Bugzilla Staging, then we will - # change the configuration file. Normally, it is set - # to report to the production Bugzilla. - my $bugzilla = get_var("BUGZILLA_INSTANCE") // "staging"; - if ($bugzilla eq "staging") { - enter_cmd("sed -i 's/bugzilla.redhat.com/bugzilla.stage.redhat.com/g' report_Bugzilla.conf"); - sleep(3); - } - # If API key is defined, update the configuration file with the API key - if ($apikey) { - enter_cmd("sed -i s/Bugzilla_APIKey =/Bugzilla_APIKey = $apikey/g report_Bugzilla.conf"); - sleep(3); - } - #Switch back to the installation console - send_key("alt-f1"); - assert_screen("anaconda_text_install_shell"); -} - sub crash_anaconda_text { # This routine uses the Anaconda crash trigger to break the ongoing Anaconda installation to simulate # an Anaconda crash and runs a series of steps that results in creating a bug in Bugzilla. diff --git a/lib/bugzilla.pm b/lib/bugzilla.pm index 998ce308..29c1e3ee 100644 --- a/lib/bugzilla.pm +++ b/lib/bugzilla.pm @@ -11,13 +11,44 @@ use POSIX qw(strftime); use JSON; use REST::Client; -our @EXPORT = qw(convert_to_bz_timestamp get_newest_bug check_bug_status_field close_notabug); +our @EXPORT = qw(convert_to_bz_timestamp get_newest_bug check_bug_status_field close_notabug bugzilla_setup); + +sub bugzilla_setup { + # This routines makes necessary settings to enable Bugzilla (staging/production) + # reporting from Anaconda easily, without the need to type the Bugzilla API. + # Switch to shell + send_key("alt-f3"); + assert_screen("anaconda_text_install_shell"); + # Navigate to the libreport configuration directory + type_string("cd /etc/libreport/events/\n"); + # Add some sleeps to make the output video more viewable + sleep(3); + # Change values in the report_Bugzilla.conf file + my $apikey = get_var("_SECRET_BUGZILLA_APIKEY") // undef; + # If we want to report to Bugzilla Staging, then we will + # change the configuration file. Normally, it is set + # to report to the production Bugzilla. + my $bugzilla = get_var("BUGZILLA_INSTANCE") // "staging"; + if ($bugzilla eq "staging") { + enter_cmd("sed -i 's\/bugzilla.redhat.com\/bugzilla.stage.redhat.com\/g' report_Bugzilla.conf"); + sleep(3); + } + # If API key is defined, update the configuration file with the API key + if ($apikey) { + enter_cmd("sed -i s\/Bugzilla_APIKey =\/Bugzilla_APIKey = $apikey\/g report_Bugzilla.conf"); + sleep(3); + } + #Switch back to the installation console + send_key("alt-f1"); + assert_screen("anaconda_text_install_shell"); +} sub start_bugzilla_client { # Start a Bugzilla REST client for setting up communication. # This is a local subroutine, not intended for export. + my $host = shift; my $bugzilla = REST::Client->new(); - $bugzilla->setHost("https://bugzilla.redhat.com"); + $bugzilla->setHost($host); return $bugzilla; }