generalize add cabinet workflow by moving cobra command down to provider layer #158
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.
Summary and Scope
MergeProviderCommand()
function, which can be re-used by each subcommand. This allows the CANI cobra command to be merged with the provider-specific commandMergeProviderCommand()
is used with theadd cabinet
andadd blade
workflowsadd_cabinet.go
and moved downinternal/provider/csm
package. This generalizes the command and opens the door for other providers to use the command and adding their customizations on topAddCabinet()
and is instead generated in the CSM package using the cobra command. This required some domino-effect changes throughout the packageRecommendHardware()
andBuildHardwareMetadata()
interface modified to accept the cobra command and argsfunc (r HardwareRecommendations) Print()
printing is used instead of printing provider-specific things instead of baking this currently-csm-specific info into the cmd layerinternal/provider/csm/csv.go
was slightly adjusted to account for the new metadata changesRisks and Mitigations
Medium to low.
metadata_test.go
, which was required since the function needed new arguments. The change is relatively minor, still proving the code remains as stable as is was in main