[lxc-devel] [lxd/master] lxd/db/networks: Populate description col with empty string in CreatePendingNetwork

tomponline on Github lxc-bot at linuxcontainers.org
Mon Aug 17 21:31:42 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 487 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200817/c1be7fe8/attachment.bin>
-------------- next part --------------
From 719e9e8265ea0b5b32661f5f0b7400edbcad027d Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Mon, 17 Aug 2020 22:29:49 +0100
Subject: [PATCH] lxd/db/networks: Populate description col with empty string
 in CreatePendingNetwork

To avoid returning pending networks with null description.

Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
 lxd/db/networks.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lxd/db/networks.go b/lxd/db/networks.go
index 99b046cf43..6290f30f4f 100644
--- a/lxd/db/networks.go
+++ b/lxd/db/networks.go
@@ -244,8 +244,8 @@ func (c *ClusterTx) CreatePendingNetwork(node, name string, netType NetworkType,
 	var networkID = network.id
 	if networkID == 0 {
 		// No existing network with the given name was found, let's create one.
-		columns := []string{"name", "type"}
-		values := []interface{}{name, netType}
+		columns := []string{"name", "type", "description"}
+		values := []interface{}{name, netType, ""}
 		networkID, err = query.UpsertObject(c.tx, "networks", columns, values)
 		if err != nil {
 			return err


More information about the lxc-devel mailing list