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

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) ===
Signed-off-by: Tycho Andersen <tycho.ander...@canonical.com>
From d38553aa7b1afbb53c0a1ecb86986082a2fbb79b Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.ander...@canonical.com>
Date: Fri, 11 Mar 2016 15:35:44 -0700
Subject: [PATCH] devices client: only print success message when successful

Signed-off-by: Tycho Andersen <tycho.ander...@canonical.com>
---
 lxc/config.go | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/lxc/config.go b/lxc/config.go
index 7bf88f0..0f94945 100644
--- a/lxc/config.go
+++ b/lxc/config.go
@@ -603,11 +603,13 @@ func (c *configCmd) deviceAdd(config *lxd.Config, which 
string, args []string) e
        if err != nil {
                return err
        }
-       fmt.Printf(i18n.G("Device %s added to %s")+"\n", devname, name)
-       if which == "profile" {
-               return nil
+       if which != "profile" {
+               err = client.WaitForSuccess(resp.Operation)
+       }
+       if err == nil {
+               fmt.Printf(i18n.G("Device %s added to %s")+"\n", devname, name)
        }
-       return client.WaitForSuccess(resp.Operation)
+       return err
 }
 
 func (c *configCmd) deviceRm(config *lxd.Config, which string, args []string) 
error {
@@ -631,11 +633,13 @@ func (c *configCmd) deviceRm(config *lxd.Config, which 
string, args []string) er
        if err != nil {
                return err
        }
-       fmt.Printf(i18n.G("Device %s removed from %s")+"\n", devname, name)
-       if which == "profile" {
-               return nil
+       if which != "profile" {
+               err = client.WaitForSuccess(resp.Operation)
+       }
+       if err == nil {
+               fmt.Printf(i18n.G("Device %s removed from %s")+"\n", devname, 
name)
        }
-       return client.WaitForSuccess(resp.Operation)
+       return err
 }
 
 func (c *configCmd) deviceList(config *lxd.Config, which string, args 
[]string) error {
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to