[lxc-devel] [lxd/master] share/usbid: Don't print error when missing

stgraber on Github lxc-bot at linuxcontainers.org
Sat Apr 25 15:49:42 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 480 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200425/648a4d16/attachment.bin>
-------------- next part --------------
From b16e8eca99acbd0477da2749fe2594e4011ec6a4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sat, 25 Apr 2020 11:48:58 -0400
Subject: [PATCH] share/usbid: Don't print error when missing
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

It's always missing during `lxd init` when run from the snap, even if
the daemon itself has access to it.

Closes #7256

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 shared/usbid/load.go | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/shared/usbid/load.go b/shared/usbid/load.go
index acbefc1e12..39f6c4d831 100644
--- a/shared/usbid/load.go
+++ b/shared/usbid/load.go
@@ -31,7 +31,9 @@ var (
 func init() {
 	usbids, err := os.Open("/usr/share/misc/usb.ids")
 	if err != nil {
-		log.Printf("usbid: failed to load: %s", err)
+		if !os.IsNotExist(err) {
+			log.Printf("usbid: failed to load: %s", err)
+		}
 		return
 	}
 	defer usbids.Close()


More information about the lxc-devel mailing list