Re-add error for loading HCP management token

pull/18229/head
Jeremy Jacobson 2023-07-17 10:23:43 -07:00
parent a8c6609f3c
commit f1225f5d47
2 changed files with 3 additions and 3 deletions

View File

@ -457,7 +457,7 @@ func loadManagementToken(dir string) (string, error) {
bytes, err := os.ReadFile(name)
if os.IsNotExist(err) {
// 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 {
return "", fmt.Errorf("failed to read: %w", err)

View File

@ -372,7 +372,7 @@ func Test_loadPersistedBootstrapConfig(t *testing.T) {
existingCluster: true,
disableManagementToken: true,
expect: expect{
loaded: true,
loaded: false,
},
},
"existing cluster no files": {
@ -398,7 +398,7 @@ func Test_loadPersistedBootstrapConfig(t *testing.T) {
"new cluster with no token": {
disableManagementToken: true,
expect: expect{
loaded: true,
loaded: false,
},
},
"new cluster some files": {