The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6202

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
This allows modifying cluster.https_address when LXD isn't clustered yet.

Closes #6167

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
From fc3feba953b01976d251cff328769040ebc4ae53 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Sat, 14 Sep 2019 23:15:57 +0200
Subject: [PATCH] lxd/config: Allow modifying cluster.https_address
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This allows modifying cluster.https_address when LXD isn't clustered yet.

Closes #6167

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 lxd/api_1.0.go | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lxd/api_1.0.go b/lxd/api_1.0.go
index cf0b1aea2e..7339ca26b7 100644
--- a/lxd/api_1.0.go
+++ b/lxd/api_1.0.go
@@ -334,9 +334,14 @@ func doApi10Update(d *Daemon, req api.ServerPut, patch 
bool) Response {
                }
        }
 
+       clustered, err := cluster.Enabled(d.db)
+       if err != nil {
+               return InternalError(errors.Wrap(err, "Failed to check for 
cluster state"))
+       }
+
        nodeChanged := map[string]string{}
        var newNodeConfig *node.Config
-       err := d.db.Transaction(func(tx *db.NodeTx) error {
+       err = d.db.Transaction(func(tx *db.NodeTx) error {
                var err error
                newNodeConfig, err = node.ConfigLoad(tx)
                if err != nil {
@@ -348,7 +353,7 @@ func doApi10Update(d *Daemon, req api.ServerPut, patch 
bool) Response {
                curClusterAddress := newNodeConfig.ClusterAddress()
                newClusterAddress, ok := nodeValues["cluster.https_address"]
 
-               if ok && curClusterAddress != "" && 
!util.IsAddressCovered(newClusterAddress.(string), curClusterAddress) {
+               if clustered && ok && curClusterAddress != "" && 
!util.IsAddressCovered(newClusterAddress.(string), curClusterAddress) {
                        return fmt.Errorf("Changing cluster.https_address is 
currently not supported")
                }
 
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to