Skip to content

Commit

Permalink
Fix apache#2834: don't enable registry trait if explicitely disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
johnpoth authored and bouskaJ committed Apr 7, 2022
1 parent ad4e6c7 commit 5c93f8f
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions pkg/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -580,8 +580,10 @@ func (o *runCmdOptions) createOrUpdateIntegration(cmd *cobra.Command, c client.C
// TODO: accept URLs
if strings.HasPrefix(item, "file://") {
if platform == nil {
// let's also enable the registry trait
o.Traits = append(o.Traits, "registry.enabled=true")
// let's also enable the registry trait if not explicitely disabled
if !contains(o.Traits, "registry.enabled=false") {
o.Traits = append(o.Traits, "registry.enabled=true")
}
platform, err = getPlatform(c, o.Context, integration.Namespace)
if err != nil {
return nil, err
Expand Down Expand Up @@ -1109,3 +1111,13 @@ func getDirName(path string) (string, error) {
}
return parentDir, nil
}

func contains(s []string, str string) bool {
for _, v := range s {
if v == str {
return true
}
}

return false
}

0 comments on commit 5c93f8f

Please sign in to comment.