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
StringSliceTrySplit: return a copy of the underlying slice #3870
Conversation
Hi @rhafer. Thanks for your PR. I'm waiting for a cri-o member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
1 similar comment
Hi @rhafer. Thanks for your PR. I'm waiting for a cri-o member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/ok-to-test |
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.
LGTM
/retest
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhafer, saschagrunert The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
1 similar comment
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhafer, saschagrunert The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/ok-to-test |
/test integration_crun |
LGTM |
cmd/crio/config.go
Outdated
conf, ok := c.App.Metadata["config"].(*libconfig.Config) | ||
if !ok { | ||
return errors.New("type assertion error when accessing server config") |
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.
what's the motivation for dropping this? I personally liked having this clunky piece of code in a function and not duplicated
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.
ah! I see
instead of duplicating this code, we should rip out this part of the function
func GetConfigFromContext(c *cli.Context) (*libconfig.Config, error) {
config, ok := c.App.Metadata["config"].(*libconfig.Config)
if !ok {
return nil, fmt.Errorf("type assertion error when accessing server config")
}
}
func GetAndMergeConfigFromContext(c *cli.Context) (*libconfig.Config, error) {
config, err := GetConfigFromContext(c)
if err != nil {
return nil, err
}
if err := mergeConfig(config, c); err != nil {
return nil, err
}
return config, nil
}
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.
Done
Otherwise the underlying flags in the ctx might be overriden, which can cause issue when the config is reloaded (or GetConfigFromContext() is called more than once). Closes cri-o#3862 Signed-off-by: Ralf Haferkamp <rhafer@suse.com>
This splits out the config file loading and commandline argument processing from GetConfigFromContext() so that subcommand like `crio config' and `crio wipe` are able to fetch the configuration from the context without reloading the config files. Apart from being inefficient this also caused issues with StringSlice values being handled wrong. Closes cri-o#3862 Signed-off-by: Ralf Haferkamp <rhafer@suse.com>
/lgtm |
/kind bug
What this PR does / why we need it:
Make StringSliceTrySplit return a copy of the underlying slice as otherwise the underlying flags in the ctx might be overriden, which can cause issue when the config is reloaded (GetConfigFromContext() is called more than once).
Which issue(s) this PR fixes:
Fixes #3862
Special notes for your reviewer:
Does this PR introduce a user-facing change?