Description of problem: When using nmstatectl service if the nmpolicy feature is using and the state specify "capture" and "desiredState" then the command fails with Mar 02 13:59:48 qemu0 kola-runext-test.sh[1762]: [2023-03-02T13:59:48Z ERROR nmstatectl::service] Failed to apply state file /etc/nmstate/br-ex-policy.yml: serde_yaml::Error: Unsupported keys found: ["capture", "desiredState"] Version-Release number of selected component (if applicable): 2.2.5 How reproducible: Always Steps to Reproduce: 1. Create file at /etc/nmstate/state.yml with the content capture: default-gw-route: routes.running.destination=="0.0.0.0/0" default-gw-iface: interfaces.name==capture.default-gw-route.routes.running.0.next-hop-interface desiredState: interfaces: - name: "{{ capture.default-gw-iface.interfaces.0.name }}" description: configured by nmstatectl type: ethernet state: up - name: br-ex type: linux-bridge copy-mac-from: "{{ capture.default-gw-iface.interfaces.0.name }}" state: up ipv4: enabled: true dhcp: true ipv6: enabled: true dhcp: true autoconf: true bridge: port: - name: "{{ capture.default-gw-iface.interfaces.0.name }}" 2. Run nmstatectl service 3. Actual results: Mar 02 13:59:48 qemu0 kola-runext-test.sh[1762]: [2023-03-02T13:59:48Z ERROR nmstatectl::service] Failed to apply state file /etc/nmstate/br-ex-policy.yml: serde_yaml::Error: Unsupported keys found: ["capture", "desiredState"] Expected results: Apply the state as expected Additional info: We need this at RHEL 9.2 to have RHCOS configure networking with nmstate.service using nmpolicy
Patch posted to upstream: https://github.com/nmstate/nmstate/pull/2264 To test this: * Create dummy interface with iproute or nmstate. * Store below content as /etc/nmstate/remove_dummy_iface.yml ```yml capture: dummy_iface: interfaces.type == "dummy" desired: interfaces: - name: "{{ capture.dummy_iface.interfaces.0.name }}" state: absent ``` * The dummy interface should be removed after `systemctl start nmstate`.
Verified with: nmstate-2.2.9-1.el9.x86_64 nispor-1.2.10-1.el9.x86_64 NetworkManager-1.43.6-1.el9.x86_64 DISTRO=RHEL-9.3.0-20230423.30