From f850d14d6690d3b713be545e9f57623615aa7304 Mon Sep 17 00:00:00 2001 From: Daniel Walton Date: Thu, 20 Aug 2015 13:55:32 -0700 Subject: [PATCH] 'service quagga reload' fails if /etc/quagga/vtysh.conf does not exist Ticket: CM-7146 Reviewed By: teo@cumulusnetworks.com Testing Done: /usr/lib/quagga/quagga-reload.py needs to check that /etc/quagga/vtysh.conf exists before trying to open it --- tools/quagga-reload.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/quagga-reload.py b/tools/quagga-reload.py index d3b06daba2..1744a13365 100755 --- a/tools/quagga-reload.py +++ b/tools/quagga-reload.py @@ -468,16 +468,16 @@ if __name__ == '__main__': # Verify that 'service integrated-vtysh-config' is configured vtysh_filename = '/etc/quagga/vtysh.conf' - fh = open(vtysh_filename, 'r') service_integrated_vtysh_config = False - for line in fh.readlines(): - line = line.strip() + if os.path.isfile(vtysh_filename): + with open(vtysh_filename, 'r') as fh: + for line in fh.readlines(): + line = line.strip() - if line == 'service integrated-vtysh-config': - service_integrated_vtysh_config = True - break - fh.close() + if line == 'service integrated-vtysh-config': + service_integrated_vtysh_config = True + break if not service_integrated_vtysh_config: print "'service integrated-vtysh-config' is not configured, this is required for 'service quagga reload'" -- 2.39.5