From 9d2ccc9324512c91d04fe4707e55ddf59768b5be Mon Sep 17 00:00:00 2001 From: Benoit Depail Date: Fri, 26 Jul 2013 14:43:27 +0200 Subject: [PATCH] Fix #6326: bridge.show returns none when no bridge is found --- salt/modules/bridge.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/salt/modules/bridge.py b/salt/modules/bridge.py index 6d4333b63e..7efd1b27ed 100644 --- a/salt/modules/bridge.py +++ b/salt/modules/bridge.py @@ -74,7 +74,10 @@ def _linux_brshow(br=None): brs[brname]['interfaces'].append(vals[0]) if br: - return brs[br] + try: + return brs[br] + except KeyError, ke : + return None return brs @@ -151,7 +154,10 @@ def _netbsd_brshow(br=None): brs[brname]['stp'] = 'yes' if br: - return brs[br] + try: + return brs[br] + except KeyError, ke : + return None return brs