The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/7531
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) ===
From 33eb77f92810df43126359773d97a5b082690e17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com> Date: Sun, 14 Jun 2020 20:17:41 -0400 Subject: [PATCH 1/2] lxd/projects: Properly clear empty keys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> --- lxd/db/projects.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lxd/db/projects.go b/lxd/db/projects.go index 295ec8fde1..df19a9601b 100644 --- a/lxd/db/projects.go +++ b/lxd/db/projects.go @@ -162,6 +162,10 @@ DELETE FROM projects_config WHERE projects_config.project_id = ? // Insert new config. stmt = c.stmt(projectCreateConfigRef) for key, value := range object.Config { + if value == "" { + continue + } + _, err := stmt.Exec(id, key, value) if err != nil { return errors.Wrap(err, "Insert config for project") From 698c63a0434a40251fb0d0ff5bca49d1fdcdd1bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com> Date: Sun, 14 Jun 2020 20:19:58 -0400 Subject: [PATCH 2/2] lxd/db: Add missing feature to default project MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ignore failures as new installs would have them already and I couldn't figure out a trivial way to ignore conflicts only. Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> --- lxd/db/cluster/schema.go | 2 +- lxd/db/cluster/update.go | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lxd/db/cluster/schema.go b/lxd/db/cluster/schema.go index fbf24753fc..ed551c5cda 100644 --- a/lxd/db/cluster/schema.go +++ b/lxd/db/cluster/schema.go @@ -553,5 +553,5 @@ CREATE TABLE storage_volumes_snapshots_config ( UNIQUE (storage_volume_snapshot_id, key) ); -INSERT INTO schema (version, updated_at) VALUES (28, strftime("%s")) +INSERT INTO schema (version, updated_at) VALUES (29, strftime("%s")) ` diff --git a/lxd/db/cluster/update.go b/lxd/db/cluster/update.go index fb2c5c73b7..f2bb9f8cfd 100644 --- a/lxd/db/cluster/update.go +++ b/lxd/db/cluster/update.go @@ -65,6 +65,13 @@ var updates = map[int]schema.Update{ 26: updateFromV25, 27: updateFromV26, 28: updateFromV27, + 29: updateFromV28, +} + +// Attempt to add missing project feature +func updateFromV28(tx *sql.Tx) error { + tx.Exec("INSERT INTO projects_config (project_id, key, value) VALUES (1, 'features.storage.volumes', 'true');") + return nil } // Add expiry date to storage volume snapshots
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel