-
Notifications
You must be signed in to change notification settings - Fork 30
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
ORION-3127: initial implementation for fsoc solution delete #324
ORION-3127: initial implementation for fsoc solution delete #324
Conversation
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #324 +/- ##
===========================================
- Coverage 26.88% 10.33% -16.56%
===========================================
Files 44 135 +91
Lines 4564 10513 +5949
===========================================
- Hits 1227 1086 -141
- Misses 3242 9352 +6110
+ Partials 95 75 -20 ☔ View full report in Codecov by Sentry. |
…and user wants to delete it again and wait for deletion to complete
cmd/solution/delete.go
Outdated
Please also note this is an asynchronous operation and thus it may take some time for the status to reflect properly.`, | ||
Example: `fsoc solution delete mysolution`, | ||
Run: deleteSolution, | ||
Annotations: map[string]string{config.AnnotationForConfigBypass: ""}, |
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.
This command relies on the configuration, as it reaches out to the API.
Annotations: map[string]string{config.AnnotationForConfigBypass: ""}, |
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.
Resolved
cmd/solution/delete.go
Outdated
|
||
var solutionDeleteCmd = &cobra.Command{ | ||
Use: "delete <solution-name>", | ||
Args: cobra.MinimumNArgs(1), |
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.
Args: cobra.MinimumNArgs(1), | |
Args: cobra.NArgs(1), |
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.
Resolved
cmd/solution/delete.go
Outdated
Use: "delete <solution-name>", | ||
Args: cobra.MinimumNArgs(1), | ||
Short: "Delete a non-stable tagged version of a solution", | ||
Long: `This command deletes a non-stable tagged version of a solution uploaded by your tenant. |
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.
In the descriptions, I propose we remove the "non-stable tagged" from most places and just have a simple sentence in the Long text that says something along the lines of "Solutions with stable
tag cannot be deleted" (or may not be deleted), mostly to set expectations. Fsoc doesn't enforce this / we rely on the backend.
WRT removing "all active subscriptions": given that we support deleting only non-stable solutions and non-stable solutions are tenant-private, I propose we do unsubscribe as part of the delete (and there are no other subscriptions possible). This will remove the incidental complexity around subscriptions.
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.
I agree that we should remove "non-stable tagged" from here and will replace it like you have suggested. Regarding the auto-unsubscribe functionality: I think this should be behind a cli flag as we want our users to be cognizant of their subscriptions to solutions and the subscription process. Wdyt?
cmd/solution/delete.go
Outdated
} | ||
|
||
if !skipConfirmationMessage { | ||
fmt.Printf("WARNING! This command will remove all of the objects and types that are associated with this solution and will purge all data related to those objects and types. It will also remove all solution metadata (including, but not limited to, subscriptions and other related objects).\nProceed with caution! \nPlease type the name of the solution you want to delete and hit enter confirm that you want to delete the solution with name: %s and tag: %s \n", solutionName, solutionTag) |
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.
fmt.Printf("WARNING! This command will remove all of the objects and types that are associated with this solution and will purge all data related to those objects and types. It will also remove all solution metadata (including, but not limited to, subscriptions and other related objects).\nProceed with caution! \nPlease type the name of the solution you want to delete and hit enter confirm that you want to delete the solution with name: %s and tag: %s \n", solutionName, solutionTag) | |
fmt.Printf("WARNING! This command will remove all objects and types that are associated with this solution and will purge all data related to those objects and types. It will also remove all solution metadata (including, but not limited to, subscriptions and other related objects).\nProceed with caution! \nPlease type the name of the solution you want to delete and hit enter confirm that you want to delete the solution with name: %s and tag: %s \n", solutionName, solutionTag) |
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.
Resolved
cmd/solution/delete.go
Outdated
if !noWait { | ||
output.PrintCmdStatus(cmd, fmt.Sprintf("Solution deletion initiated for solution with name: %s and tag: %s\n", solutionName, solutionTag)) |
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.
if !noWait { | |
output.PrintCmdStatus(cmd, fmt.Sprintf("Solution deletion initiated for solution with name: %s and tag: %s\n", solutionName, solutionTag)) | |
output.PrintCmdStatus(cmd, fmt.Sprintf("Solution deletion initiated for solution with name: %s and tag: %s\n", solutionName, solutionTag)) | |
if !noWait { |
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.
Resolved
cmd/solution/delete.go
Outdated
} else { | ||
output.PrintCmdStatus(cmd, "Solution deletion initiated, skip waiting for transaction to complete") | ||
} |
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.
} else { | |
output.PrintCmdStatus(cmd, "Solution deletion initiated, skip waiting for transaction to complete") | |
} |
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.
Resolved
cmd/solution/delete.go
Outdated
for deletionObjData.Status == "" || deletionObjData.Status == "inProgress" || deletionObjData.IsEmpty() || newDeletionObjectId == existingSolutionDeletionObjectId { | ||
output.PrintCmdStatus(cmd, fmt.Sprintf("Waited %f seconds for solution with name: %s and tag: %s to be marked as deleted\n", time.Since(waitStartTime).Seconds(), solutionName, solutionTag)) | ||
if time.Since(waitStartTime).Seconds() > float64(waitForDeletionDuration) { | ||
log.Fatalf("Failed to validate solution with name %s and tag: %s was deleted: timed out", solutionName, solutionTag) |
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.
log.Fatalf("Failed to validate solution with name %s and tag: %s was deleted: timed out", solutionName, solutionTag) | |
log.Fatalf("Timed out waiting for solution with name %s and tag: %s to be deleted. Deletion continues, please check status for outcome.", solutionName, solutionTag) |
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.
Resolved
cmd/solution/delete.go
Outdated
if deletionObjData.Status == "successful" { | ||
output.PrintCmdStatus(cmd, fmt.Sprintf("Solution with name: %s and tag: %s deleted successfully", solutionName, solutionTag)) | ||
} else { | ||
output.PrintCmdStatus(cmd, fmt.Sprintf("Issue deleting solution with name: %s and tag %s. Error message: %s", solutionName, solutionTag, deletionObjData.DeleteMessage)) |
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.
output.PrintCmdStatus(cmd, fmt.Sprintf("Issue deleting solution with name: %s and tag %s. Error message: %s", solutionName, solutionTag, deletionObjData.DeleteMessage)) | |
output.PrintCmdStatus(cmd, fmt.Sprintf("Failed to delete solution with name: %s and tag %s. Error message: %s", solutionName, solutionTag, deletionObjData.DeleteMessage)) |
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.
Resolved
cmd/solution/delete.go
Outdated
deletionObj := getSolutionDeletionObject(solutionTag, solutionName) | ||
deletionObjData = deletionObj.DeletionData | ||
newDeletionObjectId = deletionObj.ID | ||
log.Infof("Got value of new deletion objectID :%s", newDeletionObjectId) |
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.
log.Infof("Got value of new deletion objectID :%s", newDeletionObjectId) |
Do you still need this? OK if yes, just let's use WithField or similar and reflect not only the objectID but maybe the status
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.
Resolved
…waiting if deletion is already in progress
Description
This PR contains changes to add a new solution command: fsoc solution delete. This will allow our users to delete non-stable tagged versions of their solutions via fsoc.
Type of Change
Checklist