-
Notifications
You must be signed in to change notification settings - Fork 29
Init config refactor #2035
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
base: main
Are you sure you want to change the base?
Init config refactor #2035
Conversation
42bf05f
to
f55f544
Compare
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.
With this change, the log file initialization code runs when InitServer
is executed. However, some code is executed before InitServer
is reached. Because of this, all logs generated before InitServer
runs will be output to the console even if the log file is configured. This could be problematic if something goes wrong before InitServer
is reached, as the log file would not contain the relevant information.
f55f544
to
40118c7
Compare
40118c7
to
9e7b6d0
Compare
787ec30
to
3b0c518
Compare
2c139bc
to
11d53b7
Compare
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.
Getting close! I suspect both of the change requests are related to your epic rebase adventure.
Bumping this to the 7.18 milestone since it's not critical for 7.17 (which we'd like to release today), but we can still try to merge soon before there's time to accumulate more merge conflicts. |
-- Moved InitConfig into InitServer and InitClient -- Replaced calls of InitConfig with InitServer and InitClient where possible -- Removed calls to InitConfigDir where possible -- Adjusted the tests where needed due to the changes made
-- Mostly due to unset ConfigDir that should be a tempDir -- Adjusted some params and a few other tests as well
9047a7b
to
4887d9c
Compare
@@ -1275,12 +1291,10 @@ func InitServer(ctx context.Context, currentServers server_structs.ServerType) e | |||
webConfigPath := param.Server_WebConfigFile.GetString() | |||
if webConfigPath != "" { | |||
if err := os.MkdirAll(filepath.Dir(webConfigPath), 0700); err != nil { | |||
logging.FlushLogs(true) |
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 we still need the log flush here -- otherwise we throw away any logs up until this point when the error is triggered.
cobra.CheckErr(errors.Wrapf(err, "failed to create directory for web config file at %s", webConfigPath)) | ||
} | ||
} | ||
if err := setWebConfigOverride(viper.GetViper(), webConfigPath); err != nil { | ||
logging.FlushLogs(true) |
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.
Here as well
By the way, the failing tests look like a bug I must have introduced to main recently. I'll dig into it. |
Some tests use IP addresses from http test servers for various Pelican server configs (e.g. 'Server.ExternalWebUrl'). When we do this, the certificates Pelican generates for itself are invalid because they contain a SAN that says the IP is a DNS entry. This was exposed in tests for PelicanPlatform#2035 after it picked up the new verification code that checks the cert against configured hostnames.
Moved InitConfig into InitServer and InitClient and adjusts the tests as needed.
Also made InitConfigDir platform agnostic.
Ideally, I would like to be able to make InitConfig private, but its use in the cmd/config_printer test makes that impossible.
I'm worried InitConfig will keep being used in tests until we figure out a solution for that if the author/reviewer don't catch it organically.