Skip to content

Commit a9ba921

Browse files
committed
check existence of resources to avoid creation of empty one in WithoutUnnecessaryResources function
Signed-off-by: Guillaume Lours <[email protected]>
1 parent 8570d50 commit a9ba921

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

types/project.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,25 +258,33 @@ func (p *Project) WithoutUnnecessaryResources() {
258258

259259
networks := Networks{}
260260
for k := range requiredNetworks {
261-
networks[k] = p.Networks[k]
261+
if value, ok := p.Networks[k]; ok {
262+
networks[k] = value
263+
}
262264
}
263265
p.Networks = networks
264266

265267
volumes := Volumes{}
266268
for k := range requiredVolumes {
267-
volumes[k] = p.Volumes[k]
269+
if value, ok := p.Volumes[k]; ok {
270+
volumes[k] = value
271+
}
268272
}
269273
p.Volumes = volumes
270274

271275
secrets := Secrets{}
272276
for k := range requiredSecrets {
273-
secrets[k] = p.Secrets[k]
277+
if value, ok := p.Secrets[k]; ok {
278+
secrets[k] = value
279+
}
274280
}
275281
p.Secrets = secrets
276282

277283
configs := Configs{}
278284
for k := range requiredConfigs {
279-
configs[k] = p.Configs[k]
285+
if value, ok := p.Configs[k]; ok {
286+
configs[k] = value
287+
}
280288
}
281289
p.Configs = configs
282290
}

0 commit comments

Comments
 (0)