add slot filter 'target_name: bosh-lite'
This commit is contained in:
parent
58464be790
commit
6e29d304b7
|
@ -33,6 +33,7 @@ type Slot struct {
|
|||
Name string `yaml:"name"`
|
||||
Filter struct {
|
||||
BoshUUID string `yaml:"bosh_uuid"`
|
||||
TargetName string `yaml:"target_name"`
|
||||
TargetURI string `yaml:"target_uri"`
|
||||
DeploymentNameRegexp string `yaml:"deployment_name_regexp"`
|
||||
} `yaml:"filter"`
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package rendertemplates
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"sort"
|
||||
|
||||
|
@ -39,6 +40,7 @@ func PrepareRenderData(config *config.PipelinesConfig, db data.DeploymentsPerBOS
|
|||
func (renderdata *RenderData) DiscoverDeploymentsForSlot(db data.DeploymentsPerBOSH, configTier config.Tier, configSlot config.Slot, filterTag string) Deployments {
|
||||
var deployments Deployments
|
||||
for _, boshDeployments := range db {
|
||||
fmt.Printf("BOSH deployments: %#v\n", boshDeployments)
|
||||
keys := make([]string, 0)
|
||||
for key := range boshDeployments.Deployments {
|
||||
keys = append(keys, key)
|
||||
|
@ -67,6 +69,15 @@ func (renderdata *RenderData) DiscoverDeploymentsForSlot(db data.DeploymentsPerB
|
|||
}
|
||||
}
|
||||
}
|
||||
if !match && configSlot.Filter.TargetName != "" {
|
||||
if boshDeployments.Name == configSlot.Filter.TargetName {
|
||||
match = true
|
||||
deployment := NewDeployment(configTier, configSlot, boshDeployment)
|
||||
if deployment.ContainsFilterTag(filterTag) {
|
||||
deployments = append(deployments, deployment)
|
||||
}
|
||||
}
|
||||
}
|
||||
if !match && configSlot.Filter.TargetURI != "" {
|
||||
if boshDeployments.Target == configSlot.Filter.TargetURI {
|
||||
match = true
|
||||
|
|
Loading…
Reference in New Issue