예제 #1
0
 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
예제 #2
0
 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)
예제 #3
0
 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
예제 #4
0
    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]
예제 #5
0
    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]
예제 #6
0
    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')
예제 #7
0
    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
예제 #9
0
 def write(self, instPath = "/"):
     SimpleConfigFile.write(self, instPath + "/etc/sysconfig/keyboard")
     try:
         os.unlink(instPath + "/etc/sysconfig/console/default.kmap")
     except:
         pass
예제 #10
0
 def read(self, instPath = "/"):
     SimpleConfigFile.read(self, instPath + "/etc/sysconfig/keyboard")
     self.beenset = 1
예제 #11
0
 def read(self):
     self.reset()
     ifcfglog.debug("IfcfFile.read %s" % self.filename)
     SimpleConfigFile.read(self)
     self._dirty = False
예제 #12
0
 def __init__(self, filename):
     SimpleConfigFile.__init__(self, always_quote=True, filename=filename)
     self._dirty = False
예제 #13
0
 def write(self, instPath="/"):
     SimpleConfigFile.write(self, instPath + "/etc/sysconfig/keyboard")
     try:
         os.unlink(instPath + "/etc/sysconfig/console/default.kmap")
     except:
         pass
예제 #14
0
 def read(self, instPath="/"):
     SimpleConfigFile.read(self, instPath + "/etc/sysconfig/keyboard")
     self.beenset = 1
예제 #15
0
 def __init__(self):
     SimpleConfigFile.__init__(self)
     self.runlevel = 3