-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds check to ensure config file exists. Fixes: #4513 #5387
Conversation
The test failure seems legit |
24d5e3d
to
fbbeef1
Compare
cmd/cli/app/auth/auth_login.go
Outdated
// If config file is specified but doesn't exist, that's an error | ||
if configFile := v.GetString("config"); configFile != "" { | ||
if _, err := os.Stat(configFile); os.IsNotExist(err) { | ||
return cli.MessageAndError("Config file does not exist", fmt.Errorf("file %s not found", configFile)) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this only on auth login
and not on other commands (i.e. in ReadConfigFromViper
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. I'll move the logic up to that function and update the unit test as well.
Unit tests continue to fail during CI, but pass locally. I don't know enough to know what's different between the two envs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think #5399 will fix the test failures
5a8458b
to
c75ff4c
Compare
Summary
Added to check to ensure config file actually exists if flag is used.
Fixes #4513
Change Type
Mark the type of change your PR introduces:
Testing
No flag (minder auth login) - SAME AS PREVIOUSLY
Works as intended
Flag + no file (minder auth login --config) - SAME AS PREVIOUSLY
Usage
“Details: flag needs an argument: --config”
Flag + non-existant file (minder auth login --config blah) - FIXED
Message: Config file does not exist
Details: file blah not found
Flag + valid file (minder auth login --config config.yaml) - SAME AS PREVIOUSLY
Works as intended
Flag + invalid file(minder auth login --config go.sum) - SAME AS PREVIOUSLY
Error reading config file: While parsing config: yaml: unmarshal errors:
line 1: cannot unmarshal !!str
buf.bui...
into map[string]interface {}Still took user to login page
Flag + invalid file (minder auth login --config LICENSE) - SAME AS PREVIOUSLY
yaml: line 92: mapping values are not allowed in this context
Review Checklist: