The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/4795
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) === Closes #4791 Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
From d1d4d027da630026f6711d7490f305a71ea84576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com> Date: Mon, 16 Jul 2018 12:29:24 -0400 Subject: [PATCH] lxd/profiles: Prevent rename/remove of default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #4791 Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> --- lxd/profiles.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lxd/profiles.go b/lxd/profiles.go index 5cb6bf963..a32a4a1b4 100644 --- a/lxd/profiles.go +++ b/lxd/profiles.go @@ -297,6 +297,10 @@ func profilePost(d *Daemon, r *http.Request) Response { } // Sanity checks + if name == "default" { + return BadRequest(fmt.Errorf("The default profile cannot be renamed")) + } + if req.Name == "" { return BadRequest(fmt.Errorf("No name provided")) } @@ -327,6 +331,10 @@ func profilePost(d *Daemon, r *http.Request) Response { func profileDelete(d *Daemon, r *http.Request) Response { name := mux.Vars(r)["name"] + if name == "default" { + return BadRequest(fmt.Errorf("The default profile cannot be removed")) + } + _, err := doProfileGet(d.State(), name) if err != nil { return SmartError(err)
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel