-
Notifications
You must be signed in to change notification settings - Fork 223
USHIFT-528: Mop up removal of manifests, configFile, and dataDir config fields. #1076
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
Merged
openshift-merge-robot
merged 1 commit into
openshift:main
from
benluddy:configfile-datadir-manifests-mop-up
Nov 2, 2022
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -183,8 +183,6 @@ func StringInList(s string, list []string) bool { | |
| return false | ||
| } | ||
|
|
||
| // Note: add a configFile parameter here because of unit test requiring custom | ||
| // local directory | ||
| func (c *MicroshiftConfig) ReadFromConfigFile(configFile string) error { | ||
| contents, err := os.ReadFile(configFile) | ||
| if err != nil { | ||
|
|
@@ -243,11 +241,10 @@ func (c *MicroshiftConfig) ReadFromCmdLine(flags *pflag.FlagSet) error { | |
| // Note: add a configFile parameter here because of unit test requiring custom | ||
| // local directory | ||
| func (c *MicroshiftConfig) ReadAndValidate(configFile string, flags *pflag.FlagSet) error { | ||
| if configFile == "" { | ||
| configFile = findConfigFile() | ||
| } | ||
| if err := c.ReadFromConfigFile(configFile); err != nil { | ||
| return err | ||
| if configFile != "" { | ||
| if err := c.ReadFromConfigFile(configFile); err != nil { | ||
| return err | ||
| } | ||
| } | ||
| if err := c.ReadFromEnv(); err != nil { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we could drop the environment variable stuff at some point, too. That was for configuring a container version, and we don't support deploying that way. |
||
| return err | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should an empty filename be an error now?
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.
It wasn't in the past -- that seems to have been an inadvertent change of the original PR.
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.
Maybe it makes sense to bring that back when we drop the environment variable stuff? Let's think about it and do it separately if we decide we want it.
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.
/hold
For this PR, are you proposing that it should be a fatal error if neither a user nor a global config file exists? This has historically been treated as though there were an existent-but-empty config file, and only became an error in #1026 (comment). My first reaction was to restore the original behavior since there had been no discussion/intent to change it.
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 was proposing that this function consider an empty string an invalid filename. If we're saying the file doesn't have to exist (that makes sense), and the caller might pass an empty string when there is no file to read, then this function could treat the empty string as not an error.
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.
As it is, MicroShift follows your latter logic. The
configFileis set by thefindConfigFile()func (L143), which will return an empty string if no file is found. The empty string value should continue to be interpreted as "use defaults" rather than throwing a fatal error.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.
/unhold
The original behavior (i.e. to work without a config file) makes sense to me. I'm going to proceed with restoring it in this PR. If that behavior's not desirable, it can be changed deliberately sometime later.