diff --git a/cmd/openshift-install/create.go b/cmd/openshift-install/create.go index fbee6840053..aec02406825 100644 --- a/cmd/openshift-install/create.go +++ b/cmd/openshift-install/create.go @@ -113,17 +113,20 @@ var ( timer.StartTimer("Bootstrap Complete") if err := waitForBootstrapComplete(ctx, config); err != nil { - if err2 := logClusterOperatorConditions(ctx, config); err2 != nil { - logrus.Error("Attempted to gather ClusterOperator status after installation failure: ", err2) + bundlePath, gatherErr := runGatherBootstrapCmd(rootOpts.dir) + if gatherErr != nil { + logrus.Error("Attempted to gather debug logs after installation failure: ", gatherErr) } - bundlePath, err2 := runGatherBootstrapCmd(rootOpts.dir) - if err2 != nil { - logrus.Error("Attempted to gather debug logs after installation failure: ", err2) + if err := logClusterOperatorConditions(ctx, config); err != nil { + logrus.Error("Attempted to gather ClusterOperator status after installation failure: ", err) } logrus.Error("Bootstrap failed to complete: ", err.Unwrap()) logrus.Error(err.Error()) - if err2 := service.AnalyzeGatherBundle(bundlePath); err2 != nil { - logrus.Error("Attempted to analyze the debug logs after installation failure: ", err2) + if gatherErr == nil { + if err := service.AnalyzeGatherBundle(bundlePath); err != nil { + logrus.Error("Attempted to analyze the debug logs after installation failure: ", err) + } + logrus.Infof("Bootstrap gather logs captured here %q", bundlePath) } logrus.Fatal("Bootstrap failed to complete") } diff --git a/cmd/openshift-install/gather.go b/cmd/openshift-install/gather.go index ce446d8ab09..2d888955bbc 100644 --- a/cmd/openshift-install/gather.go +++ b/cmd/openshift-install/gather.go @@ -66,11 +66,14 @@ func newGatherBootstrapCmd() *cobra.Command { if err != nil { logrus.Fatal(err) } + if !gatherBootstrapOpts.skipAnalysis { if err := service.AnalyzeGatherBundle(bundlePath); err != nil { logrus.Fatal(err) } } + + logrus.Infof("Bootstrap gather logs captured here %q", bundlePath) }, } cmd.PersistentFlags().StringVar(&gatherBootstrapOpts.bootstrap, "bootstrap", "", "Hostname or IP of the bootstrap host") @@ -135,10 +138,10 @@ func runGatherBootstrapCmd(directory string) (string, error) { return "", errors.New("must provide both bootstrap host address and at least one control plane host address when providing one") } - return logGatherBootstrap(bootstrap, port, masters, directory) + return gatherBootstrap(bootstrap, port, masters, directory) } -func logGatherBootstrap(bootstrap string, port int, masters []string, directory string) (string, error) { +func gatherBootstrap(bootstrap string, port int, masters []string, directory string) (string, error) { logrus.Info("Pulling debug logs from the bootstrap machine") client, err := ssh.NewClient("core", net.JoinHostPort(bootstrap, strconv.Itoa(port)), gatherBootstrapOpts.sshKeys) if err != nil { @@ -160,7 +163,6 @@ func logGatherBootstrap(bootstrap string, port int, masters []string, directory if err != nil { return "", errors.Wrap(err, "failed to stat log file") } - logrus.Infof("Bootstrap gather logs captured here %q", path) return path, nil }