From bc93ee6352171a324db4914f15df21dd11582337 Mon Sep 17 00:00:00 2001 From: Pavlos Parissis Date: Wed, 10 Apr 2019 22:11:31 +0200 Subject: [PATCH] Return empty list if a map doesn't have any entries If a map doesn't have entries haproxy returns an empty string. Returning one element list with an empty string isn't the right approach. Close #6 --- haproxyadmin/haproxy.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/haproxyadmin/haproxy.py b/haproxyadmin/haproxy.py index 16e5a33..cc5be8c 100644 --- a/haproxyadmin/haproxy.py +++ b/haproxyadmin/haproxy.py @@ -953,7 +953,10 @@ def show_map(self, mapid=None): if not check_output(map_info_proc1): raise CommandFailed(map_info_proc1[0]) - return map_info_proc1 + if len(map_info_proc1) == 1 and not map_info_proc1[0]: + return [] + else: + return map_info_proc1 @property def uptime(self):