Exemple #1
0
 def worker(self, ip):
     hosts = self.config['hosts'].split(',')
     host_records = self._get_records(self.zones[self.zone])
     put_url = f"zones/{self.zones[self.zone]}/records"
     for host in hosts:
         if host == '@':
             host = self.zone
         else:
             host += '.' + self.zone
         if not host.endswith('.'):
             host += '.'
         if host not in host_records:
             Logger.warning(f"Attempted to update host '{host}' "
                            "that is not found under this account!")
             continue
         data = {
             "type": "A",
             "name": host,
             "content": ip,
             "ttl": self.ttl,
         }
         ret = self.rest.put(f"{put_url}/{host_records[host]}", data)
         if not ret:
             Logger.error(f"Unable to update host record for '{host}' at "
                          "zone '{self.zone}'")
             continue
Exemple #2
0
 def worker(self, ip):
     hosts = self.config['hosts'].split(',')
     for host in hosts:
         if host == '@':
             host = self.zone
         else:
             host += '.' + self.zone
         if host not in self._zones:
             Logger.warning(f"Attempted to update host '{host}' "
                            "that is not found under this account!")
             continue
         ret = HttpProvider.get(self.update_url + host)
         if not ret:
             Logger.error("Unable to update host record "
                          f"for '{host}' at zone '{self.zone}'")
             continue