[systemd-devel] [PATCH] systemctl: list-units -r should not fail with older systemd in container

Lukas Nykryn lnykryn at redhat.com
Tue Mar 31 07:10:33 PDT 2015


Older version of systemd does not have d-bus method "ListUnitsFiltered",
so systemctl -r will fail just with:

Failed to list units: Method "ListUnitsFiltered" with signature "as" on
interface "org.freedesktop.systemd1.Manager" doesn't exist

So lets skip such machines.
---
 src/systemctl/systemctl.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 3158a38..6d2db23 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -620,8 +620,10 @@ static int get_unit_list_recursive(
                         }
 
                         k = get_unit_list(container, *i, patterns, &unit_infos, c, &reply);
-                        if (k < 0)
-                                return k;
+                        if (k < 0) {
+                                log_error_errno(k, "Failed to get unit list from container %s: %m", *i);
+                                continue;
+                        }
 
                         c = k;
 
-- 
1.8.3.1



More information about the systemd-devel mailing list