def write(self, filename=None): if self._dirty or filename: # ifcfg-rh is using inotify IN_CLOSE_WRITE event so we don't use # temporary file for new configuration ifcfglog.debug("IfcfgFile.write %s:\n%s" % (self.filename, self.__str__())) SimpleConfigFile.write(self, filename, use_tmp=False) self._dirty = False
def unset(self, *args): for key in args: if self.get(key): self._dirty = True break else: return ifcfglog.debug("IfcfgFile.unset %s: %s" % (self.filename, args)) SimpleConfigFile.unset(self, *args)
def set(self, *args): for (key, data) in args: if self.get(key) != data: break else: return ifcfglog.debug("IfcfgFile.set %s: %s" % (self.filename, args)) SimpleConfigFile.set(self, *args) self._dirty = True
def getDefaultTimeZone(self, instPath): try: return self.localeInfo[self.systemLang][4] except KeyError: # If doing an upgrade and the system language is something not # recognized by anaconda, we should try to see if we can figure # it out from the running system. if os.path.exists(instPath + "/etc/sysconfig/clock"): cfg = SimpleConfigFile() cfg.read(instPath + "/etc/sysconfig/clock") try: return cfg.get("ZONE") except: return self.localeInfo[self._default][4] else: return self.localeInfo[self._default][4]
def TimezoneSet(self, inTimezone): localtimeFile = '/etc/localtime' if os.path.isfile(localtimeFile): os.remove(localtimeFile) os.symlink(self.timezones.cities({})[inTimezone], localtimeFile) file = open('/etc/timezone', 'w') file.write(inTimezone + "\n") file.close() if os.path.exists('/etc/sysconfig/clock'): cfg = SimpleConfigFile() cfg.read('/etc/sysconfig/clock') cfg.info["ZONE"] = inTimezone cfg.write('/etc/sysconfig/clock')
def TimezoneSet(self, inTimezone): localtimeFile = '/etc/localtime' if os.path.isfile(localtimeFile): os.remove(localtimeFile) os.symlink(self.timezones.cities({})[inTimezone], localtimeFile) file = open('/etc/timezone', 'w') file.write(inTimezone+"\n") file.close() if os.path.exists('/etc/sysconfig/clock'): cfg = SimpleConfigFile() cfg.read('/etc/sysconfig/clock') cfg.info["ZONE"] = inTimezone cfg.write('/etc/sysconfig/clock')
def __init__ (self): SimpleConfigFile.__init__ (self) self.runlevel = 3
def write(self, instPath = "/"): SimpleConfigFile.write(self, instPath + "/etc/sysconfig/keyboard") try: os.unlink(instPath + "/etc/sysconfig/console/default.kmap") except: pass
def read(self, instPath = "/"): SimpleConfigFile.read(self, instPath + "/etc/sysconfig/keyboard") self.beenset = 1
def read(self): self.reset() ifcfglog.debug("IfcfFile.read %s" % self.filename) SimpleConfigFile.read(self) self._dirty = False
def __init__(self, filename): SimpleConfigFile.__init__(self, always_quote=True, filename=filename) self._dirty = False
def write(self, instPath="/"): SimpleConfigFile.write(self, instPath + "/etc/sysconfig/keyboard") try: os.unlink(instPath + "/etc/sysconfig/console/default.kmap") except: pass
def read(self, instPath="/"): SimpleConfigFile.read(self, instPath + "/etc/sysconfig/keyboard") self.beenset = 1
def __init__(self): SimpleConfigFile.__init__(self) self.runlevel = 3