Skip to content

Commit

Permalink
check existence of resources to avoid creation of empty one in Withou…
Browse files Browse the repository at this point in the history
…tUnnecessaryResources function

Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
  • Loading branch information
glours committed Nov 1, 2022
1 parent 7ae3153 commit 48e4ed6
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions types/project.go
Expand Up @@ -258,25 +258,33 @@ func (p *Project) WithoutUnnecessaryResources() {

networks := Networks{}
for k := range requiredNetworks {
networks[k] = p.Networks[k]
if value, ok := p.Networks[k]; ok {
networks[k] = value
}
}
p.Networks = networks

volumes := Volumes{}
for k := range requiredVolumes {
volumes[k] = p.Volumes[k]
if value, ok := p.Volumes[k]; ok {
volumes[k] = value
}
}
p.Volumes = volumes

secrets := Secrets{}
for k := range requiredSecrets {
secrets[k] = p.Secrets[k]
if value, ok := p.Secrets[k]; ok {
secrets[k] = value
}
}
p.Secrets = secrets

configs := Configs{}
for k := range requiredConfigs {
configs[k] = p.Configs[k]
if value, ok := p.Configs[k]; ok {
configs[k] = value
}
}
p.Configs = configs
}
Expand Down

0 comments on commit 48e4ed6

Please sign in to comment.