diff --git a/pkg/state/filter.go b/pkg/state/filter.go index 381a01ffc..8b85e19da 100644 --- a/pkg/state/filter.go +++ b/pkg/state/filter.go @@ -78,7 +78,9 @@ func filterOutInterfaces(ifaces []interface{}, ifacesNames []Interface, interfac for i, iface := range ifaces { name := ifacesNames[i].Name if !interfacesFilterGlob.Match(name) { - filterOutDynamicAttributes(iface.(map[string]interface{})) + ifaceState := iface.(map[string]interface{}) + ifaceState["name"] = name + filterOutDynamicAttributes(ifaceState) filteredInterfaces = append(filteredInterfaces, iface) } } diff --git a/pkg/state/filter_test.go b/pkg/state/filter_test.go index 0e2050578..0f5913b3b 100644 --- a/pkg/state/filter_test.go +++ b/pkg/state/filter_test.go @@ -342,7 +342,7 @@ interfaces: filteredState = nmstate.NewState(` interfaces: - name: eth0 -- name: 1101010 +- name: "1101010" `) interfacesFilterGlob = glob.MustCompile("0*") }) @@ -366,8 +366,8 @@ interfaces: filteredState = nmstate.NewState(` interfaces: - name: eth0 -- name: 0 -- name: 254 +- name: "0" +- name: "254" `) interfacesFilterGlob = glob.MustCompile("1*") })