mirror of https://github.com/hashicorp/consul
Re-add error for loading HCP management token
parent
a8c6609f3c
commit
f1225f5d47
|
@ -457,7 +457,7 @@ func loadManagementToken(dir string) (string, error) {
|
||||||
bytes, err := os.ReadFile(name)
|
bytes, err := os.ReadFile(name)
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
// A missing management token is not an error, if none was provided by HCP
|
// A missing management token is not an error, if none was provided by HCP
|
||||||
return "", nil
|
return "", errors.New("configuration files on disk are incomplete, missing: " + name)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("failed to read: %w", err)
|
return "", fmt.Errorf("failed to read: %w", err)
|
||||||
|
|
|
@ -372,7 +372,7 @@ func Test_loadPersistedBootstrapConfig(t *testing.T) {
|
||||||
existingCluster: true,
|
existingCluster: true,
|
||||||
disableManagementToken: true,
|
disableManagementToken: true,
|
||||||
expect: expect{
|
expect: expect{
|
||||||
loaded: true,
|
loaded: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"existing cluster no files": {
|
"existing cluster no files": {
|
||||||
|
@ -398,7 +398,7 @@ func Test_loadPersistedBootstrapConfig(t *testing.T) {
|
||||||
"new cluster with no token": {
|
"new cluster with no token": {
|
||||||
disableManagementToken: true,
|
disableManagementToken: true,
|
||||||
expect: expect{
|
expect: expect{
|
||||||
loaded: true,
|
loaded: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"new cluster some files": {
|
"new cluster some files": {
|
||||||
|
|
Loading…
Reference in New Issue