Skip to content

Commit

Permalink
Remove environment flag from graph (#8099)
Browse files Browse the repository at this point in the history
# Description
As the environment flag has no impact on `app graph` the best option is
to remove.

## Type of change
- This pull request fixes a bug in Radius and has an approved issue
(issue link required).

Fixes: #7507

Signed-off-by: Garry Taylor <[email protected]>
Co-authored-by: Yetkin Timocin <[email protected]>
  • Loading branch information
gpltaylor and ytimocin authored Dec 2, 2024
1 parent a99c7fc commit 1f241e3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
12 changes: 1 addition & 11 deletions pkg/cli/cmd/app/graph/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/radius-project/radius/pkg/cli/framework"
"github.com/radius-project/radius/pkg/cli/output"
"github.com/radius-project/radius/pkg/cli/workspaces"
"github.com/radius-project/radius/pkg/ucp/resources"
"github.com/spf13/cobra"
)

Expand All @@ -39,7 +38,6 @@ rad app graph my-application`,

commonflags.AddWorkspaceFlag(cmd)
commonflags.AddResourceGroupFlag(cmd)
commonflags.AddEnvironmentNameFlag(cmd)
commonflags.AddApplicationNameFlag(cmd)

return cmd, runner
Expand All @@ -52,7 +50,6 @@ type Runner struct {
Output output.Interface

ApplicationName string
EnvironmentName string
Workspace *workspaces.Workspace
}

Expand Down Expand Up @@ -89,20 +86,13 @@ func (r *Runner) Validate(cmd *cobra.Command, args []string) error {
}

// Validate that the application exists
app, err := client.GetApplication(cmd.Context(), r.ApplicationName)
_, err = client.GetApplication(cmd.Context(), r.ApplicationName)
if clients.Is404Error(err) {
return clierrors.Message("Application %q does not exist or has been deleted.", r.ApplicationName)
} else if err != nil {
return err
}

parsed, err := resources.ParseResource(*app.Properties.Environment)
if err != nil {
return err
}

r.EnvironmentName = parsed.Name()

return nil
}

Expand Down
3 changes: 0 additions & 3 deletions pkg/cli/cmd/app/graph/graph_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ func Test_Validate(t *testing.T) {
runner := r.(*Runner)
// These values are used by Run()
require.Equal(t, "test-app", runner.ApplicationName)
require.Equal(t, "test-env", runner.EnvironmentName)
},
},
{
Expand All @@ -79,7 +78,6 @@ func Test_Validate(t *testing.T) {
runner := r.(*Runner)
// These values are used by Run()
require.Equal(t, "test-app", runner.ApplicationName)
require.Equal(t, "test-env", runner.EnvironmentName)
},
},
{
Expand Down Expand Up @@ -181,7 +179,6 @@ func Test_Run(t *testing.T) {

// Populated by Validate()
ApplicationName: "test-app",
EnvironmentName: "test-env",
}

err := runner.Run(context.Background())
Expand Down

0 comments on commit 1f241e3

Please sign in to comment.