Fix diagnose panic when configuration file does not exist (#11932)

* Fix diagnose panic when configuration file does not exist

* Addressing comments

* Update command/operator_diagnose.go

Co-authored-by: Hridoy Roy <roy@hashicorp.com>

Co-authored-by: Hridoy Roy <roy@hashicorp.com>
This commit is contained in:
hghaf099
2021-06-23 18:35:52 -04:00
committed by GitHub
parent 8096e7d856
commit a6d73e3dc2
2 changed files with 4 additions and 1 deletions

View File

@@ -242,6 +242,9 @@ func (c *OperatorDiagnoseCommand) offlineDiagnostics(ctx context.Context) error
}
return nil
})
if config == nil {
return fmt.Errorf("No vault server configuration found.")
}
var metricSink *metricsutil.ClusterMetricSink
var metricsHelper *metricsutil.MetricsHelper

View File

@@ -2,12 +2,12 @@ package configutil
import (
"fmt"
"github.com/hashicorp/hcl/hcl/token"
"io/ioutil"
"time"
"github.com/hashicorp/hcl"
"github.com/hashicorp/hcl/hcl/ast"
"github.com/hashicorp/hcl/hcl/token"
"github.com/hashicorp/vault/sdk/helper/parseutil"
)