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

refactor: ApplyClusterCmd clearly returns results #16655

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions cmd/kops/update_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,15 @@ func RunUpdateCluster(ctx context.Context, f *util.Factory, out io.Writer, c *Up
DeletionProcessing: deletionProcessing,
}

if err := applyCmd.Run(ctx); err != nil {
applyResults, err := applyCmd.Run(ctx)
if err != nil {
return results, err
}

results.Target = applyCmd.Target
results.TaskMap = applyCmd.TaskMap
results.ImageAssets = applyCmd.ImageAssets
results.FileAssets = applyCmd.FileAssets
results.ImageAssets = applyResults.AssetBuilder.ImageAssets
results.FileAssets = applyResults.AssetBuilder.FileAssets
results.Cluster = cluster

if isDryrun && !c.GetAssets {
Expand Down
3 changes: 1 addition & 2 deletions examples/kops-api-example/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ func apply(vfsContext *vfs.VFSContext, ctx context.Context) error {
Clientset: clientset,
TargetName: cloudup.TargetDirect,
}
err = applyCmd.Run(ctx)
if err != nil {
if _, err = applyCmd.Run(ctx); err != nil {
return err
}

Expand Down
3 changes: 2 additions & 1 deletion pkg/instancegroups/instancegroups.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,8 @@ func (c *RollingUpdateCluster) reconcileInstanceGroup() error {
DeletionProcessing: fi.DeletionProcessingModeDeleteIfNotDeferrred,
}

return applyCmd.Run(c.Ctx)
_, err := applyCmd.Run(c.Ctx)
return err
}

func (c *RollingUpdateCluster) maybeValidate(operation string, validateCount int, group *cloudinstances.CloudInstanceGroup) error {
Expand Down
Loading
Loading