From 26a22667b2adf5b61ea6abae3db09856781e9b43 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sat, 2 Jun 2018 17:38:17 +0200 Subject: [PATCH] netconfig: missing lease.json is no error --- internal/netconfig/netconfig.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/netconfig/netconfig.go b/internal/netconfig/netconfig.go index 78e18d4..da65793 100644 --- a/internal/netconfig/netconfig.go +++ b/internal/netconfig/netconfig.go @@ -37,6 +37,9 @@ func subnetMaskSize(mask string) (int, error) { func applyDhcp4(iface, dir string) error { b, err := ioutil.ReadFile(filepath.Join(dir, "dhcp4/wire/lease.json")) if err != nil { + if os.IsNotExist(err) { + return nil // dhcp4 might not have obtained a lease yet + } return err } var got dhcp4.Config @@ -105,6 +108,9 @@ func applyDhcp4(iface, dir string) error { func applyDhcp6(iface, dir string) error { b, err := ioutil.ReadFile(filepath.Join(dir, "dhcp6/wire/lease.json")) if err != nil { + if os.IsNotExist(err) { + return nil // dhcp6 might not have obtained a lease yet + } return err } var got dhcp6.Config