Skip to content

Commit 6139581

Browse files
authored
fix(application): skip managed_namespace_metadata if type-conversion causes an error (#605)
Signed-off-by: Nathanael Liechti <[email protected]>
1 parent 7259769 commit 6139581

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

argocd/structure_application.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -469,15 +469,16 @@ func expandApplicationSyncPolicy(sp interface{}) (*application.SyncPolicy, error
469469
}
470470

471471
if _mnm, ok := p["managed_namespace_metadata"].([]interface{}); ok && len(_mnm) > 0 {
472-
mnm := _mnm[0].(map[string]interface{})
473-
syncPolicy.ManagedNamespaceMetadata = &application.ManagedNamespaceMetadata{}
472+
if mnm, ok := _mnm[0].(map[string]interface{}); ok {
473+
syncPolicy.ManagedNamespaceMetadata = &application.ManagedNamespaceMetadata{}
474474

475-
if a, ok := mnm["annotations"]; ok {
476-
syncPolicy.ManagedNamespaceMetadata.Annotations = expandStringMap(a.(map[string]interface{}))
477-
}
475+
if a, ok := mnm["annotations"]; ok {
476+
syncPolicy.ManagedNamespaceMetadata.Annotations = expandStringMap(a.(map[string]interface{}))
477+
}
478478

479-
if l, ok := mnm["labels"]; ok {
480-
syncPolicy.ManagedNamespaceMetadata.Labels = expandStringMap(l.(map[string]interface{}))
479+
if l, ok := mnm["labels"]; ok {
480+
syncPolicy.ManagedNamespaceMetadata.Labels = expandStringMap(l.(map[string]interface{}))
481+
}
481482
}
482483
}
483484

0 commit comments

Comments
 (0)