[lxc-devel] [lxd/master] only print profile applied message on success

tych0 on Github lxc-bot at linuxcontainers.org
Tue Feb 9 15:33:02 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 377 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160209/1c0b4858/attachment.bin>
-------------- next part --------------
From f83b583e37097bb1e95c52e0dfcfdbdfed7b53c6 Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.andersen at canonical.com>
Date: Tue, 9 Feb 2016 08:32:34 -0700
Subject: [PATCH] only print profile applied message on success

Closes #1577

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 lxc/profile.go | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lxc/profile.go b/lxc/profile.go
index 8357733..f86a421 100644
--- a/lxc/profile.go
+++ b/lxc/profile.go
@@ -211,15 +211,19 @@ func doProfileDelete(client *lxd.Client, p string) error {
 
 func doProfileApply(client *lxd.Client, c string, p string) error {
 	resp, err := client.ApplyProfile(c, p)
+	if err != nil {
+		return err
+	}
+
+	err = client.WaitForSuccess(resp.Operation)
 	if err == nil {
 		if p == "" {
 			p = i18n.G("(none)")
 		}
 		fmt.Printf(i18n.G("Profile %s applied to %s")+"\n", p, c)
-	} else {
-		return err
 	}
-	return client.WaitForSuccess(resp.Operation)
+
+	return err
 }
 
 func doProfileShow(client *lxd.Client, p string) error {


More information about the lxc-devel mailing list