diff --git a/src/nm-cloud-setup/main.c b/src/nm-cloud-setup/main.c index 9de934187..49c068920 100644 --- a/src/nm-cloud-setup/main.c +++ b/src/nm-cloud-setup/main.c @@ -387,17 +387,6 @@ _nmc_skip_connection_by_user_data(NMConnection *connection) return FALSE; } -static gboolean -_nmc_skip_connection_by_type(NMConnection *connection, const char *connection_type) -{ - if (!nm_streq0(nm_connection_get_connection_type(connection), connection_type)) - return TRUE; - if (!nm_connection_get_setting_ip4_config(connection)) - return TRUE; - - return FALSE; -} - static void _nmc_mangle_connection(NMDevice *device, NMConnection *connection, @@ -618,8 +607,14 @@ try_again: return any_changes; } - if (_nmc_skip_connection_by_type(applied_connection, connection_type)) { - _LOGD("config device %s: device has no suitable applied connection. Skip", hwaddr); + if (!nm_streq0(nm_connection_get_connection_type(applied_connection), connection_type)) { + _LOGD("config device %s: skip applied connection due to type mismatch", hwaddr); + return any_changes; + } + + if (!nm_connection_get_setting_ip4_config(applied_connection)) { + _LOGD("config device %s: skip applied connection due to missing IPv4 configuration", + hwaddr); return any_changes; } diff --git a/src/tests/client/test-client.py b/src/tests/client/test-client.py index ff734d1ab..9289c4ed2 100755 --- a/src/tests/client/test-client.py +++ b/src/tests/client/test-client.py @@ -2532,7 +2532,7 @@ class TestNmCloudSetup(unittest.TestCase): pexp.expect("get-config: success") pexp.expect("meta data received") # One of the devices has no IPv4 configuration to be modified - pexp.expect("device has no suitable applied connection. Skip") + pexp.expect("skip applied connection due to missing IPv4 configuration") # The other one was lacking an address set it up. pexp.expect("some changes were applied for provider aliyun") (exitstatus, signalstatus, valgrind_log) = self.ctx.cmd_close_pexpect(pexp) @@ -2628,7 +2628,7 @@ class TestNmCloudSetup(unittest.TestCase): pexp.expect("get-config: success") pexp.expect("meta data received") # One of the devices has no IPv4 configuration to be modified - pexp.expect("device has no suitable applied connection. Skip") + pexp.expect("skip applied connection due to missing IPv4 configuration") # The other one was lacking an address set it up. pexp.expect("some changes were applied for provider azure") (exitstatus, signalstatus, valgrind_log) = self.ctx.cmd_close_pexpect(pexp) @@ -2707,7 +2707,7 @@ class TestNmCloudSetup(unittest.TestCase): pexp.expect("get-config: success") pexp.expect("meta data received") # One of the devices has no IPv4 configuration to be modified - pexp.expect("device has no suitable applied connection. Skip") + pexp.expect("skip applied connection due to missing IPv4 configuration") # The other one was lacking an address set it up. pexp.expect("some changes were applied for provider ec2") (exitstatus, signalstatus, valgrind_log) = self.ctx.cmd_close_pexpect(pexp) @@ -2778,7 +2778,7 @@ class TestNmCloudSetup(unittest.TestCase): pexp.expect("get-config: success") pexp.expect("meta data received") # One of the devices has no IPv4 configuration to be modified - pexp.expect("device has no suitable applied connection. Skip") + pexp.expect("skip applied connection due to missing IPv4 configuration") # The other one was lacking an address set it up. pexp.expect("some changes were applied for provider GCP") (exitstatus, signalstatus, valgrind_log) = self.ctx.cmd_close_pexpect(pexp) @@ -2869,7 +2869,7 @@ class TestNmCloudSetup(unittest.TestCase): pexp.expect("get-config: success") pexp.expect("meta data received") # One of the devices has no IPv4 configuration to be modified - pexp.expect("device has no suitable applied connection. Skip") + pexp.expect("skip applied connection due to missing IPv4 configuration") # The other one was lacking an address set it up. pexp.expect("some changes were applied for provider oci") (exitstatus, signalstatus, valgrind_log) = self.ctx.cmd_close_pexpect(pexp) @@ -2973,7 +2973,7 @@ class TestNmCloudSetup(unittest.TestCase): # No configuration for the ethernets pexp.expect('configuring "eth0"') - pexp.expect("device has no suitable applied connection. Skip") + pexp.expect("skip applied connection due to missing IPv4 configuration") # Setting up the VLAN pexp.expect("creating macvlan2 connection for VLAN 700 on CC:00:00:00:00:01...") @@ -3013,7 +3013,7 @@ class TestNmCloudSetup(unittest.TestCase): pexp.expect("get-config: success") pexp.expect("meta data received") pexp.expect('configuring "eth0"') - pexp.expect("device has no suitable applied connection. Skip") + pexp.expect("skip applied connection due to missing IPv4 configuration") pexp.expect("no changes were applied for provider oci") (exitstatus, signalstatus, valgrind_log) = self.ctx.cmd_close_pexpect(pexp)