From ae61b8078d7dc8b27f74f8f6ca9b8577c0f784d5 Mon Sep 17 00:00:00 2001
From: Simon Janos <4@2a.hu>
Date: Sun, 25 May 2014 12:02:38 +0200
Subject: [PATCH] =?UTF-8?q?f=C3=A1jl=20=C3=ADr=C3=A1ssal/olvas=C3=A1ssal?=
 =?UTF-8?q?=20kapcsolatos=20hib=C3=A1k=20kezel=C3=A9se?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 irf_2P-1_242/src/getRouteRules.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/irf_2P-1_242/src/getRouteRules.py b/irf_2P-1_242/src/getRouteRules.py
index aa1b724..fee2cb7 100644
--- a/irf_2P-1_242/src/getRouteRules.py
+++ b/irf_2P-1_242/src/getRouteRules.py
@@ -13,7 +13,12 @@ args = parser.parse_args()
 
 uri = "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/MSFT_NetRoute"
 
-machines = csv.reader(open(args.machines, newline=''))
+try:
+	machines = csv.reader(open(args.machines, newline=''))
+except FileNotFoundError:
+	print("Cannot open input file (" + args.machines + ")")
+	exit(1)
+
 for row in machines:
 	wsman = ["wsman", "-h", row[0], "-u", row[2], "-p", row[3], "--auth", "basic", "--non-interactive", "enumerate", "-N", "root/standardcimv2", uri]
 	try:
@@ -53,6 +58,8 @@ for row in machines:
 	except subprocess.CalledProcessError:
 		print("ERROR: could not connect to " + row[0])
 
+	except FileNotFoundError:
+		print("Cannot write output file, directory does not exist or not writable.")
 
 
 	#et = etree.XML(rt.encode('utf-8'))
-- 
GitLab