summaryrefslogtreecommitdiff
path: root/cloudinit/net/freebsd.py
diff options
context:
space:
mode:
authorGonéri Le Bouder <goneri@lebouder.net>2021-06-14 15:39:05 -0400
committerGitHub <noreply@github.com>2021-06-14 14:39:05 -0500
commit59a848c5929cbfca45d95860eb60dfebd0786c94 (patch)
treea962355634c51c6cc03b56c0dceca8c2b345a550 /cloudinit/net/freebsd.py
parent05b0e35026db3789c56ee9f8192d4a81067325e5 (diff)
downloadvyos-cloud-init-59a848c5929cbfca45d95860eb60dfebd0786c94.tar.gz
vyos-cloud-init-59a848c5929cbfca45d95860eb60dfebd0786c94.zip
add DragonFlyBSD support (#904)
- Mostly based on FreeBSD, the main exception is that `find_devs_with_on_freebsd` does not work. - Since we cannot get the CDROM or the partition labels, `find_devs_with_on_dragonflybsd()` has a more naive approach and returns all the block devices.
Diffstat (limited to 'cloudinit/net/freebsd.py')
-rw-r--r--cloudinit/net/freebsd.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/cloudinit/net/freebsd.py b/cloudinit/net/freebsd.py
index c843d792..f8faf240 100644
--- a/cloudinit/net/freebsd.py
+++ b/cloudinit/net/freebsd.py
@@ -32,6 +32,13 @@ class Renderer(cloudinit.net.bsd.BSDRenderer):
LOG.debug("freebsd generate postcmd disabled")
return
+ for dhcp_interface in self.dhcp_interfaces():
+ # Observed on DragonFlyBSD 6. If we use the "restart" parameter,
+ # the routes are not recreated.
+ subp.subp(['service', 'dhclient', 'stop', dhcp_interface],
+ rcs=[0, 1],
+ capture=True)
+
subp.subp(['service', 'netif', 'restart'], capture=True)
# On FreeBSD 10, the restart of routing and dhclient is likely to fail
# because
@@ -42,7 +49,7 @@ class Renderer(cloudinit.net.bsd.BSDRenderer):
subp.subp(['service', 'routing', 'restart'], capture=True, rcs=[0, 1])
for dhcp_interface in self.dhcp_interfaces():
- subp.subp(['service', 'dhclient', 'restart', dhcp_interface],
+ subp.subp(['service', 'dhclient', 'start', dhcp_interface],
rcs=[0, 1],
capture=True)
@@ -57,4 +64,4 @@ class Renderer(cloudinit.net.bsd.BSDRenderer):
def available(target=None):
- return util.is_FreeBSD()
+ return util.is_FreeBSD() or util.is_DragonFlyBSD()