equal
deleted
inserted
replaced
47 raise VMMNotRootException(_(u"You are not root.\n\tGood bye!\n"), |
47 raise VMMNotRootException(_(u"You are not root.\n\tGood bye!\n"), |
48 ERR.CONF_NOPERM) |
48 ERR.CONF_NOPERM) |
49 if self.__chkCfgFile(): |
49 if self.__chkCfgFile(): |
50 self.__Cfg = Cfg(self.__cfgFileName) |
50 self.__Cfg = Cfg(self.__cfgFileName) |
51 self.__Cfg.load() |
51 self.__Cfg.load() |
|
52 if not os.sys.argv[1] in ['cf', 'configure']: |
52 self.__Cfg.check() |
53 self.__Cfg.check() |
|
54 self.__chkenv() |
53 self.__scheme = self.__Cfg.dget('misc.password_scheme') |
55 self.__scheme = self.__Cfg.dget('misc.password_scheme') |
54 self._postconf = Postconf(self.__Cfg.dget('bin.postconf')) |
56 self._postconf = Postconf(self.__Cfg.dget('bin.postconf')) |
55 if not os.sys.argv[1] in ['cf', 'configure']: |
|
56 self.__chkenv() |
|
57 |
57 |
58 def __findCfgFile(self): |
58 def __findCfgFile(self): |
59 for path in ['/root', '/usr/local/etc', '/etc']: |
59 for path in ['/root', '/usr/local/etc', '/etc']: |
60 tmp = os.path.join(path, 'vmm.cfg') |
60 tmp = os.path.join(path, 'vmm.cfg') |
61 if os.path.isfile(tmp): |
61 if os.path.isfile(tmp): |
434 return self.__Cfg.pget(option) |
434 return self.__Cfg.pget(option) |
435 |
435 |
436 def cfgSet(self, option, value): |
436 def cfgSet(self, option, value): |
437 return self.__Cfg.set(option, value) |
437 return self.__Cfg.set(option, value) |
438 |
438 |
439 def setupIsDone(self): |
|
440 """Checks if vmm is configured, returns bool""" |
|
441 try: |
|
442 return self.__Cfg.dget('config.done') |
|
443 except ValueError, e: |
|
444 raise VMMConfigException(_(u"""Configuration error: "%s" |
|
445 (in section "config", option "done") see also: vmm.cfg(5)\n""") % str(e), |
|
446 ERR.CONF_ERROR) |
|
447 |
|
448 def configure(self, section=None): |
439 def configure(self, section=None): |
449 """Starts interactive configuration. |
440 """Starts interactive configuration. |
450 |
441 |
451 Configures in interactive mode options in the given section. |
442 Configures in interactive mode options in the given section. |
452 If no section is given (default) all options from all sections |
443 If no section is given (default) all options from all sections |
460 self.__Cfg.configure(self.__Cfg.getsections()) |
451 self.__Cfg.configure(self.__Cfg.getsections()) |
461 elif section in self.__Cfg.getsections(): |
452 elif section in self.__Cfg.getsections(): |
462 self.__Cfg.configure([section]) |
453 self.__Cfg.configure([section]) |
463 else: |
454 else: |
464 raise VMMException(_(u"Invalid section: ā%sā") % section, |
455 raise VMMException(_(u"Invalid section: ā%sā") % section, |
465 ERR.INVALID_SECTION) |
456 ERR.INVALID_SECTION) |
466 |
457 |
467 def domainAdd(self, domainname, transport=None): |
458 def domainAdd(self, domainname, transport=None): |
468 dom = self.__getDomain(domainname, transport) |
459 dom = self.__getDomain(domainname, transport) |
469 dom.save() |
460 dom.save() |
470 self.__domDirMake(dom.getDir(), dom.getID()) |
461 self.__domDirMake(dom.getDir(), dom.getID()) |