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

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 #1800

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
From 88151da8be5a014545fa8d1492d02203da05399a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Wed, 23 Mar 2016 21:26:29 -0400
Subject: [PATCH] List broken containers (with state set to ERROR)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #1800

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 lxd/containers_get.go | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/lxd/containers_get.go b/lxd/containers_get.go
index 080ece5..750782d 100644
--- a/lxd/containers_get.go
+++ b/lxd/containers_get.go
@@ -45,11 +45,14 @@ func doContainersGet(d *Daemon, recursion bool) 
(interface{}, error) {
                        url := fmt.Sprintf("/%s/containers/%s", 
shared.APIVersion, container)
                        resultString = append(resultString, url)
                } else {
-                       container, response := doContainerGet(d, container)
-                       if response != nil {
-                               continue
+                       c, err := doContainerGet(d, container)
+                       if err != nil {
+                               c = &shared.ContainerInfo{
+                                       Name:       container,
+                                       Status:     shared.Error.String(),
+                                       StatusCode: shared.Error}
                        }
-                       resultList = append(resultList, container)
+                       resultList = append(resultList, c)
                }
        }
 
@@ -60,21 +63,15 @@ func doContainersGet(d *Daemon, recursion bool) 
(interface{}, error) {
        return resultList, nil
 }
 
-func doContainerGet(d *Daemon, cname string) (*shared.ContainerInfo, Response) 
{
+func doContainerGet(d *Daemon, cname string) (*shared.ContainerInfo, error) {
        c, err := containerLoadByName(d, cname)
        if err != nil {
-               return nil, SmartError(err)
+               return nil, err
        }
 
        cts, err := c.Render()
-       if err == LxcMonitorStateError {
-               return &shared.ContainerInfo{
-                       Name:       cname,
-                       Status:     shared.Error.String(),
-                       StatusCode: shared.Error,
-               }, nil
-       } else if err != nil {
-               return nil, SmartError(err)
+       if err != nil {
+               return nil, err
        }
 
        return cts.(*shared.ContainerInfo), nil
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to