ssconf: Small error message fixes
authorMichael Hanselmann <hansmi@google.com>
Tue, 27 Nov 2012 11:27:38 +0000 (12:27 +0100)
committerMichael Hanselmann <hansmi@google.com>
Wed, 28 Nov 2012 07:45:54 +0000 (08:45 +0100)
- Include filename in error message
- s/ip/IP/
- Stop using superfluous variable

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>

lib/ssconf.py

index bbc9606..1936837 100644 (file)
@@ -328,10 +328,10 @@ class SimpleStore(object):
     except EnvironmentError, err:
       if err.errno == errno.ENOENT and default is not None:
         return default
-      raise errors.ConfigurationError("Can't read from the ssconf file:"
-                                      " '%s'" % str(err))
-    data = data.rstrip("\n")
-    return data
+      raise errors.ConfigurationError("Can't read ssconf file %s: %s" %
+                                      (filename, str(err)))
+
+    return data.rstrip("\n")
 
   def WriteFiles(self, values):
     """Writes ssconf files used by external scripts.
@@ -513,7 +513,7 @@ class SimpleStore(object):
       return int(self._ReadFile(constants.SS_PRIMARY_IP_FAMILY,
                                 default=netutils.IP4Address.family))
     except (ValueError, TypeError), err:
-      raise errors.ConfigurationError("Error while trying to parse primary ip"
+      raise errors.ConfigurationError("Error while trying to parse primary IP"
                                       " family: %s" % err)