If host_dns (hostDnsConfig) is initialized to host.config.network.dnsConfig, it will never be empty, and this test (and error message) no longer make sense. You should just depend on the value @pending_changes to indicate that *some* change was made and that the API call should be done.