Unverified Commit 6761b182 authored by Tianxin Dong's avatar Tianxin Dong Committed by GitHub
Browse files

Fix: fix up command add debug policy (#3770)

Signed-off-by: default avatarFogDong <dongtianxin.tx@alibaba-inc.com>
parent 7b2f4af6
Showing with 13 additions and 4 deletions
+13 -4
......@@ -175,10 +175,7 @@ func (opt *UpCommandOptions) deployExistingApp(f velacmd.Factory, cmd *cobra.Com
}
oam.SetPublishVersion(app, opt.PublishVersion)
if opt.Debug {
app.Spec.Policies = append(app.Spec.Policies, v1beta1.AppPolicy{
Name: "debug",
Type: "debug",
})
addDebugPolicy(app)
}
return cli.Update(ctx, app)
}); err != nil {
......@@ -188,6 +185,18 @@ func (opt *UpCommandOptions) deployExistingApp(f velacmd.Factory, cmd *cobra.Com
return nil
}
func addDebugPolicy(app *v1beta1.Application) {
for _, policy := range app.Spec.Policies {
if policy.Type == "debug" {
return
}
}
app.Spec.Policies = append(app.Spec.Policies, v1beta1.AppPolicy{
Name: "debug",
Type: "debug",
})
}
func (opt *UpCommandOptions) deployApplicationFromFile(f velacmd.Factory, cmd *cobra.Command) error {
cli := f.Client()
body, err := common.ReadRemoteOrLocalPath(opt.File)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment