示例#1
0
 def get_hostname_record(self):
     hostname_record = conf.get_published_hostname()
     if not os.path.exists(hostname_record):
         # this file is created at provisioning time with agents >= 2.2.3
         hostname = socket.gethostname()
         logger.warn(
             'Hostname record does not exist, '
             'creating [{0}] with hostname [{1}]', hostname_record,
             hostname)
         self.set_hostname_record(hostname)
     record = fileutil.read_file(hostname_record)
     return record
示例#2
0
 def get_hostname_record(self):
     hostname_record = conf.get_published_hostname()
     if not os.path.exists(hostname_record):
         # this file is created at provisioning time with agents >= 2.2.3
         hostname = socket.gethostname()
         logger.warn('Hostname record does not exist, '
                     'creating [{0}] with hostname [{1}]',
                     hostname_record,
                     hostname)
         self.set_hostname_record(hostname)
     record = fileutil.read_file(hostname_record)
     return record
示例#3
0
 def set_hostname_record(self, hostname):
     fileutil.write_file(conf.get_published_hostname(), contents=hostname)
示例#4
0
 def set_hostname_record(self, hostname):
     fileutil.write_file(conf.get_published_hostname(), contents=hostname)