From 7d4dfba45fda8d9154829f618ce7ef412738d746 Mon Sep 17 00:00:00 2001 From: Benjamin Yang Date: Fri, 21 Nov 2025 14:08:41 -0600 Subject: [PATCH 1/2] applying fixes to global and local --app flag --- cli/cmd/customer_archive.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/cli/cmd/customer_archive.go b/cli/cmd/customer_archive.go index 8d86e5d7b..88383b478 100644 --- a/cli/cmd/customer_archive.go +++ b/cli/cmd/customer_archive.go @@ -8,10 +8,7 @@ import ( ) func (r *runners) InitCustomersArchiveCommand(parent *cobra.Command) *cobra.Command { - var ( - customer string - app string - ) + var customer string cmd := &cobra.Command{ Use: "archive ", @@ -43,18 +40,18 @@ replicated customer archive --app myapp "Acme Inc"`, customers = args } - return r.archiveCustomer(cmd, customers, app) + return r.archiveCustomer(customers) }, SilenceUsage: true, } parent.AddCommand(cmd) cmd.Flags().StringVar(&customer, "customer", "", "The Customer Name or ID to archive") cmd.Flags().MarkHidden("customer") - cmd.Flags().StringVar(&app, "app", "", "The app to archive the customer in (not required when using a customer id)") + // Local --app flag removed - will use global flag from parent return cmd } -func (r *runners) archiveCustomer(cmd *cobra.Command, customers []string, app string) error { +func (r *runners) archiveCustomer(customers []string) error { if !r.hasApp() { return errors.New("no app specified") } @@ -81,7 +78,7 @@ func (r *runners) archiveCustomer(cmd *cobra.Command, customers []string, app st if c == nil { // try to get the customer as if we have a name - cc, err := r.api.GetCustomerByName(app, customer) + cc, err := r.api.GetCustomerByName(r.appID, customer) if err != nil { return errors.Wrapf(err, "find customer %q", customer) } From 31a38ad357ae52d6dd36ad02c2ad8dc775a80113 Mon Sep 17 00:00:00 2001 From: Gerard Nguyen Date: Wed, 3 Dec 2025 15:02:59 +1100 Subject: [PATCH 2/2] fix error comparision --- cli/cmd/customer_archive.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/cmd/customer_archive.go b/cli/cmd/customer_archive.go index 88383b478..9f2c62830 100644 --- a/cli/cmd/customer_archive.go +++ b/cli/cmd/customer_archive.go @@ -2,7 +2,7 @@ package cmd import ( "github.com/pkg/errors" - "github.com/replicatedhq/replicated/pkg/kotsclient" + "github.com/replicatedhq/replicated/pkg/platformclient" "github.com/replicatedhq/replicated/pkg/types" "github.com/spf13/cobra" ) @@ -69,7 +69,7 @@ func (r *runners) archiveCustomer(customers []string) error { // try to get the customer as if we have an id first cc, err := r.api.GetCustomerByID(customer) - if err != nil && err != kotsclient.ErrNotFound { + if err != nil && errors.Cause(err) != platformclient.ErrNotFound { return errors.Wrapf(err, "find customer %q", customer) } if cc != nil {