Exemple #1
0
 def _write_hostname(self, hostname, filename):
     conf = None
     try:
         # Try to update the previous one
         # Let's see if we can read it first.
         conf = HostnameConf(util.load_file(filename))
         conf.parse()
     except IOError:
         pass
     if not conf:
         conf = HostnameConf('')
     conf.set_hostname(hostname)
     util.write_file(filename, str(conf), mode=0o644)
Exemple #2
0
 def _read_hostname_conf(self, filename):
     conf = HostnameConf(util.load_file(filename))
     conf.parse()
     return conf
Exemple #3
0
 def _read_hostname_conf(self, filename):
     conf = HostnameConf(util.load_file(filename))
     conf.parse()
     return conf