47 self.__warnings = [] |
47 self.__warnings = [] |
48 self.__Cfg = None |
48 self.__Cfg = None |
49 self.__dbh = None |
49 self.__dbh = None |
50 |
50 |
51 if os.geteuid(): |
51 if os.geteuid(): |
52 raise VMMNotRootException("You are not root.\n\tGood bye!\n") |
52 raise VMMNotRootException(("You are not root.\n\tGood bye!\n", |
|
53 ERR.CONF_NOPERM)) |
53 if self.__chkCfgFile(): |
54 if self.__chkCfgFile(): |
54 self.__Cfg = Cfg(self.__cfgFileName) |
55 self.__Cfg = Cfg(self.__cfgFileName) |
55 self.__Cfg.load() |
56 self.__Cfg.load() |
|
57 self.__Cfg.check() |
56 self.__cfgSections = self.__Cfg.getsections() |
58 self.__cfgSections = self.__Cfg.getsections() |
57 self.__chkenv() |
59 self.__chkenv() |
58 |
60 |
59 def __chkCfgFile(self): |
61 def __chkCfgFile(self): |
60 """Checks the configuration file, returns bool""" |
62 """Checks the configuration file, returns bool""" |
61 if not os.path.isfile(self.__cfgFileName): |
63 if not os.path.isfile(self.__cfgFileName): |
62 raise IOError("Fatal error: The file "+self.__cfgFileName+ \ |
64 raise VMMException(("The file »%s« does not exists." % |
63 " does not exists.\n") |
65 self.__cfgFileName, ERR.CONF_NOFILE)) |
64 fstat = os.stat(self.__cfgFileName) |
66 fstat = os.stat(self.__cfgFileName) |
65 try: |
67 try: |
66 fmode = self.__getFileMode() |
68 fmode = self.__getFileMode() |
67 except: |
69 except: |
68 raise |
70 raise |
69 if fmode % 100 and fstat.st_uid != fstat.st_gid \ |
71 if fmode % 100 and fstat.st_uid != fstat.st_gid \ |
70 or fmode % 10 and fstat.st_uid == fstat.st_gid: |
72 or fmode % 10 and fstat.st_uid == fstat.st_gid: |
71 raise VMMPermException(self.__permWarnMsg) |
73 raise VMMPermException((self.__permWarnMsg, ERR.CONF_ERROR)) |
72 else: |
74 else: |
73 return True |
75 return True |
74 |
76 |
75 def __chkenv(self): |
77 def __chkenv(self): |
76 """""" |
78 """""" |