From 6912d0c9ffcc6c81b0764a373dcc7f99093c5d3b Mon Sep 17 00:00:00 2001
From: Christian Poessinger <christian@poessinger.com>
Date: Thu, 20 Jun 2019 22:14:36 +0200
Subject: firewall: T1461: deleting 'firewall options' causes Python TypeError

[ firewall options interface wg01 ]
Traceback (most recent call last):
  File "/usr/libexec/vyos/conf_mode/firewall_options.py", line 139, in <module>
    apply(c)
  File "/usr/libexec/vyos/conf_mode/firewall_options.py", line 97, in apply
    if tcp['new_chain4']:
TypeError: 'NoneType' object is not subscriptable

delete [ firewall options ] failed
delete [ firewall ] failed
Commit failed

(cherry picked from commit efb1a1c88f436a3704c4ca6e15b65aeded4b9654)
---
 src/conf_mode/firewall_options.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'src')

diff --git a/src/conf_mode/firewall_options.py b/src/conf_mode/firewall_options.py
index e2c306904..2be80cdbf 100755
--- a/src/conf_mode/firewall_options.py
+++ b/src/conf_mode/firewall_options.py
@@ -32,7 +32,8 @@ def get_config():
     opts = copy.deepcopy(default_config_data)
     conf = Config()
     if not conf.exists('firewall options'):
-        return None
+        # bail out early
+        return opts
     else:
         conf.set_level('firewall options')
 
-- 
cgit v1.2.3