-
Notifications
You must be signed in to change notification settings - Fork 306
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
DAOS-16487 control: Only use hostlist from cfg on cfg-aware dmg cmds #15087
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -284,11 +284,6 @@ and access control settings, along with system wide operations.` | |
return errors.Wrap(err, "Unable to load Certificate Data") | ||
} | ||
|
||
invoker.SetConfig(ctlCfg) | ||
if ctlCmd, ok := cmd.(ctlInvoker); ok { | ||
ctlCmd.setInvoker(invoker) | ||
} | ||
|
||
// Handle the deprecated global hostlist flag | ||
if !opts.HostList.Empty() { | ||
if hlCmd, ok := cmd.(hostListSetter); ok { | ||
|
@@ -301,15 +296,24 @@ and access control settings, along with system wide operations.` | |
} | ||
} | ||
|
||
if hlCmd, ok := cmd.(hostListGetter); ok { | ||
hl := hlCmd.getHostList() | ||
if len(hl) > 0 { | ||
ctlCfg.HostList = hl | ||
if cfgCmd, ok := cmd.(cmdConfigSetter); ok { | ||
// Override hostlist with cli value if provided. | ||
if hlCmd, ok := cmd.(hostListGetter); ok { | ||
hl := hlCmd.getHostList() | ||
if len(hl) > 0 { | ||
ctlCfg.HostList = hl | ||
} | ||
Comment on lines
+299
to
+305
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. This seems pretty hard to understand to me. I would imagine that it will be even more perplexing in a few months. We already have the singleHostCmd type which could probably be reworked a little to make this use case clearer. For example, the type could have a new I think I understand the motivation behind maintaining the hostlist stuff in the implementation of the Another change that I would recommend as part of that refactoring is to get rid of the logic in @kjacque: It looks like you added this type in #11815 ... What do you think about reworking it a bit to make the behavior and usage clearer? 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 agree that currently the implementation is not very clean, and I'm happy to take another pass based on this feedback and anything @kjacque has to add. 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. this isn't quite resolved by #15074 , updating singleHostCmd doesn't resolve the issue where hostlist can be pulled by the config in commands that don't explicitly require config usage |
||
} | ||
cfgCmd.setConfig(ctlCfg) | ||
} else { | ||
// Before setting config on invoker strip hostlist as in the case that the | ||
// command doesn't support config, the host list should be derived from cmd. | ||
ctlCfg.HostList = nil | ||
} | ||
|
||
if cfgCmd, ok := cmd.(cmdConfigSetter); ok { | ||
cfgCmd.setConfig(ctlCfg) | ||
invoker.SetConfig(ctlCfg) | ||
if ctlCmd, ok := cmd.(ctlInvoker); ok { | ||
ctlCmd.setInvoker(invoker) | ||
} | ||
|
||
if argsCmd, ok := cmd.(cmdutil.ArgsHandler); ok { | ||
|
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.
Seems like this is a bit out of order now -- should happen after the dealings with the config so it can override if necessary. Maybe it would be helpful to create a helper function that uses either of the command line flags, so they're processed together.