Ubuntu Pastebin

Paste from smoser at Tue, 20 Sep 2016 15:35:50 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
=== modified file 'cloudinit/net/__init__.py'
--- cloudinit/net/__init__.py	2016-07-14 02:45:19 +0000
+++ cloudinit/net/__init__.py	2016-09-20 15:35:26 +0000
@@ -116,9 +116,14 @@
     fname = os.path.join(SYS_CLASS_NET, name, field)
     if not os.path.exists(fname):
         raise OSError("%s: could not find sysfs entry: %s" % (name, fname))
-    data = util.load_file(fname)
-    if data[-1] == '\n':
-        data = data[:-1]
+    try:
+        data = util.load_file(fname)
+        if data[-1] == '\n':
+            data = data[:-1]
+    except IOError as e:
+        msg = "%s: load file failed with %s" % (fname, e))
+        util.logexc(LOG, msg)
+        raise OSError(msg)
     return data
 
 
Download as text