Skip to content
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

generalize add cabinet workflow by moving cobra command down to provider layer #158

Merged
merged 1 commit into from
Nov 27, 2023

Conversation

jacobsalmela
Copy link
Collaborator

@jacobsalmela jacobsalmela commented Nov 21, 2023

Summary and Scope

  • adds a MergeProviderCommand() function, which can be re-used by each subcommand. This allows the CANI cobra command to be merged with the provider-specific command
  • MergeProviderCommand() is used with the add cabinet and add blade workflows
  • CSM-specific things are removed from add_cabinet.go and moved down internal/provider/csm package. This generalizes the command and opens the door for other providers to use the command and adding their customizations on top
  • As part of this change, metadata is no longer passed to AddCabinet() and is instead generated in the CSM package using the cobra command. This required some domino-effect changes throughout the package
  • RecommendHardware() and BuildHardwareMetadata()interface modified to accept the cobra command and args
  • A method for func (r HardwareRecommendations) Print() printing is used instead of printing provider-specific things instead of baking this currently-csm-specific info into the cmd layer
  • logic in internal/provider/csm/csv.go was slightly adjusted to account for the new metadata changes

Risks and Mitigations

Medium to low.

  • only one test was changed, 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
  • new code/logic is introduced so it can introduce new issues but is necessary to support multiple providers

@jacobsalmela jacobsalmela self-assigned this Nov 21, 2023
@jacobsalmela jacobsalmela force-pushed the solid-reaper branch 4 times, most recently from b155c7b to 7355915 Compare November 27, 2023 13:06
@jacobsalmela jacobsalmela force-pushed the solid-reaper branch 4 times, most recently from a3a6543 to d7369a1 Compare November 27, 2023 17:38
Signed-off-by: Jacob Salmela <jacob.salmela@hpe.com>
@jacobsalmela jacobsalmela marked this pull request as ready for review November 27, 2023 18:00
@jacobsalmela jacobsalmela merged commit a911201 into develop Nov 27, 2023
5 checks passed
@jacobsalmela jacobsalmela deleted the solid-reaper branch November 27, 2023 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants