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

feat: fixed batch delete happy stack #2613

Merged

Conversation

naihsuanshao
Copy link
Contributor

@naihsuanshao naihsuanshao commented Oct 18, 2023

CCIE-1748
Summary Batch Multiple Deletes Using Happy Delete
Type Task Task
Status In Review

This is for slack request for batch deleting happy stack. See Jira issue here.

Verified the change by cd into examples/typical_app folder then create two test stacks, then run happy delete test-stack1 test-stack-2 to verify that the change works.

The for loop does iterate through all the arguments but one of the test stack deletion got terminated early when it ran into unauthorized error.

Used this launch.json in debugger to step through the code change

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch Package",
            "type": "go",
            "request": "launch",
            "mode": "debug",
            "program": "../happy/cli",
            "args": ["delete", "test-nshao","-v"],
            "cwd": "../happy/examples/typical_app"
        }
    ]
}

@naihsuanshao naihsuanshao requested a review from a team as a code owner October 18, 2023 21:17
@naihsuanshao naihsuanshao requested review from dspadea, jakeyheath and alexlokshin-czi and removed request for a team and dspadea October 18, 2023 21:17
@@ -32,7 +32,16 @@ var deleteCmd = &cobra.Command{
Short: "Delete an existing stack",
Long: "Delete the stack with the given name.",
SilenceUsage: true,
RunE: runDelete,
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println("Running delete")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change to our standard logging. Use of fmt.Print* is frowned upon.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to using logrus.

fmt.Println("Running delete")
for _, stackName := range args {
err := runDelete(cmd, stackName)
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might make sense to message and continue to the next stack.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to log error and continue.

@jakeyheath
Copy link
Contributor

LGTM TY!

@naihsuanshao naihsuanshao merged commit 21f927b into main Oct 23, 2023
29 checks passed
@naihsuanshao naihsuanshao deleted the CCIE-1748-batch-multiple-deletes-using-happy-delete branch October 23, 2023 18:26
@czi-github-helper czi-github-helper bot mentioned this pull request Oct 23, 2023
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.

3 participants