Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dhcp): Make dhcpcd the default dhcp client #4912

Merged
merged 2 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cloudinit/net/dhcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -967,4 +967,4 @@ def parse_static_routes(routes: str) -> List[Tuple[str, str]]:
return []


ALL_DHCP_CLIENTS = [IscDhclient, Dhcpcd, Udhcpc]
ALL_DHCP_CLIENTS = [Dhcpcd, IscDhclient, Udhcpc]
2 changes: 1 addition & 1 deletion config/cloud.cfg.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ system_info:
{% elif variant in ["ubuntu", "unknown"] %}
{# SRU_BLOCKER: do not ship network renderers on Xenial, Bionic or Eoan #}
network:
dhcp_client_priority: [dhclient, dhcpcd, udhcpc]
dhcp_client_priority: [dhcpcd, dhclient, udhcpc]
renderers: ['netplan', 'eni', 'sysconfig']
activators: ['netplan', 'eni', 'network-manager', 'networkd']
{% elif is_rhel %}
Expand Down
4 changes: 2 additions & 2 deletions tests/unittests/distros/test__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,10 +543,10 @@ def test_get_tmp_exec_path(
id="first_client_is_found_from_config_udhcpc",
),
pytest.param(
IscDhclient,
Dhcpcd,
{"network": {"dhcp_client_priority": []}},
None,
id="first_client_is_found_no_config_dhclient",
id="first_client_is_found_no_config_dhcpcd",
),
pytest.param(
Dhcpcd,
Expand Down
4 changes: 2 additions & 2 deletions tests/unittests/net/test_dhcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ class TestDHCPDiscoveryClean(CiTestCase):
@mock.patch("cloudinit.net.dhcp.os.remove")
@mock.patch("cloudinit.net.dhcp.subp.subp")
@mock.patch("cloudinit.net.dhcp.subp.which")
def test_dhclient_exits_with_error(
def test_dhcpcd_exits_with_error(
self, m_which, m_subp, m_remove, m_fallback
):
"""Log and do nothing when nic is absent and no fallback is found."""
Expand All @@ -394,7 +394,7 @@ def test_dhclient_exits_with_error(
maybe_perform_dhcp_discovery(Distro("fake but not", {}, None))

self.assertIn(
"DHCP client selected: dhclient",
"DHCP client selected: dhcpcd",
self.logs.getvalue(),
)

Expand Down
22 changes: 14 additions & 8 deletions tests/unittests/sources/test_cloudstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,17 +268,23 @@ def test_get_hostname_fqdn_fallback(self):
)
)

lease = {
"interface": "eth0",
"fixed-address": "192.168.0.1",
"subnet-mask": "255.255.255.0",
"routers": "192.168.0.1",
"renew": "4 2017/07/27 18:02:30",
"expire": "5 2017/07/28 07:08:15",
}
self.patches.enter_context(
mock.patch(
DHCP_MOD_PATH + ".IscDhclient.get_newest_lease",
return_value={
"interface": "eth0",
"fixed-address": "192.168.0.1",
"subnet-mask": "255.255.255.0",
"routers": "192.168.0.1",
"renew": "4 2017/07/27 18:02:30",
"expire": "5 2017/07/28 07:08:15",
},
return_value=lease,
)
)
self.patches.enter_context(
mock.patch(
DHCP_MOD_PATH + ".Dhcpcd.get_newest_lease", return_value=lease
)
)

Expand Down
Loading