]> git.puffer.fish Git - matthieu/frr.git/commitdiff
'service quagga reload' fails if /etc/quagga/vtysh.conf does not exist
authorDaniel Walton <dwalton@cumulusnetworks.com>
Thu, 20 Aug 2015 20:55:32 +0000 (13:55 -0700)
committerDaniel Walton <dwalton@cumulusnetworks.com>
Thu, 20 Aug 2015 20:55:32 +0000 (13:55 -0700)
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

index d3b06daba24697d51a0773aa0d1054ddab2e4ec1..1744a133652417e41f2f210ba75e971d2b4ed4e4 100755 (executable)
@@ -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'"