cloud-setup: fix primary and secondary address swap in Azure cloud
Summary
The primary address is that placed at position 0 of all the IP Addresses of the interface. Sometimes we put it in a different position in the ipv4s array because we insert them in the order we receive, but it might happen that the HTTP responses comes back in wrong order.
In that case, we reorder the array to make the primary address the first element of the address array.
Resolves: https://issues.redhat.com/browse/RHEL-50855
Purpose
Fix the primary and secondary IP address swap that happens in Azure when the reply is mixed
Checklist
Please read https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/main/CONTRIBUTING.md before opening the merge request. In particular, check that:
-
the subject for all commits is concise and explicative -
the message for all commits explains the reason for the change -
the source is properly formatted -
any relevant documentation is up to date -
you have added unit tests if applicable -
the NEWS file is updated when the change deserves to be mentioned, for example for new features, behavior changes, API deprecations, etc.