You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spot.apache.org by ev...@apache.org on 2017/01/30 22:15:18 UTC
[2/2] incubator-spot git commit: Added try catch module to handle
errors at Edge file creation
Added try catch module to handle errors at Edge file creation
Project: http://git-wip-us.apache.org/repos/asf/incubator-spot/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-spot/commit/f9729c21
Tree: http://git-wip-us.apache.org/repos/asf/incubator-spot/tree/f9729c21
Diff: http://git-wip-us.apache.org/repos/asf/incubator-spot/diff/f9729c21
Branch: refs/heads/master
Commit: f9729c21884a8fb49a3e3c8756a3363af7f84570
Parents: 8381546
Author: LedaLima <ga...@intel.com>
Authored: Mon Jan 23 11:29:57 2017 -0600
Committer: Everardo Lopez Sandoval (Intel) <el...@elopezsa-mac02.zpn.intel.com>
Committed: Mon Jan 30 16:14:22 2017 -0600
----------------------------------------------------------------------
spot-oa/oa/dns/dns_oa.py | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-spot/blob/f9729c21/spot-oa/oa/dns/dns_oa.py
----------------------------------------------------------------------
diff --git a/spot-oa/oa/dns/dns_oa.py b/spot-oa/oa/dns/dns_oa.py
index abb8cac..59f4c2c 100644
--- a/spot-oa/oa/dns/dns_oa.py
+++ b/spot-oa/oa/dns/dns_oa.py
@@ -297,18 +297,19 @@ class OA(object):
else:
self._logger.info("WARNING: NO IANA configured.")
- # create edge file.
- self._logger.info("Creating edge file:{0}".format(edge_file))
- with open(edge_file,'wb') as dns_details_edge:
- writer = csv.writer(dns_details_edge, quoting=csv.QUOTE_ALL)
- if update_rows:
- writer.writerows(update_rows)
- else:
- shutil.copy(edge_tmp,edge_file)
-
try:
+ # create edge file.
+ self._logger.info("Creating edge file:{0}".format(edge_file))
+ with open(edge_file,'wb') as dns_details_edge:
+ writer = csv.writer(dns_details_edge, quoting=csv.QUOTE_ALL)
+ if update_rows:
+ writer.writerows(update_rows)
+ else:
+ shutil.copy(edge_tmp,edge_file)
+
os.remove(edge_tmp)
- except OSError:
+ except OSError as e:
+ self._logger.info("Error while trying to read/write file: {0}".format(str(e))
pass