usr/src/lib/install_common/__init__.py.src
changeset 1717 10cb4d15a248
parent 1666 e9d4b6b42777
child 1718 4cec97c628bb
--- a/usr/src/lib/install_common/__init__.py.src	Tue Jun 19 02:42:18 2012 -0600
+++ b/usr/src/lib/install_common/__init__.py.src	Tue Jun 19 12:18:37 2012 -0600
@@ -428,12 +428,14 @@
     - Work Directory, defaulting to /system/volatile
     """
 
-    def __init__(self, application_name, work_dir="/system/volatile/"):
+    def __init__(self, application_name, work_dir="/system/volatile/",
+        logname=None):
         super(ApplicationData, self).__init__(application_name)
 
         self._application_name = application_name
         self._work_dir = work_dir
         self.data_dict = dict()
+        self._logname = logname
 
     @property
     def application_name(self):
@@ -445,6 +447,11 @@
         """Read-only Work Directory - set at initialisation"""
         return self._work_dir
 
+    @property
+    def logname(self):
+        """Read-only logname - set at initialization"""
+        return self._work_dir + "/" + self._logname
+
     # Implement no-op XML methods
     def to_xml(self):
         return None
@@ -554,8 +561,17 @@
                                       "required to perform this operation." % \
                                       auth))
 
-    # raise error if euid is not 0 
+    # raise error if euid is not 0
     if os.geteuid() != 0:
         raise UnauthorizedUserError(_("Insufficient permission to perform "
                                       "operation.\neuid required to be "
                                       "0 to perform this operation."))
+
+
+def check_log_level(level):
+    """ Checks the log level being passed in"""
+    try:
+        logging.getLevelName(level)
+        return True
+    except NameError:
+        return False