Update the DNS record
550457
def update_dns(config, record, sa_version):
    ""
    try:
        domain = config.get('domain_name', 'sa.baruwa.com.')
        dns_key = config.get('domain_key')
        dns_ip = config.get('domain_ip', '127.0.0.1')
        keyring = tsigkeyring.from_text({domain: dns_key})
        transaction = update.Update(
            domain,
            keyring=keyring,
            keyalgorithm=tsig.HMAC_SHA512)
        txtrecord = '%s.%s' % (sa_version, domain)
        transaction.replace(txtrecord, 120, 'txt', record)
        query.tcp(transaction, dns_ip)
        return True
    except DNSException, msg:
        raise SaChannelUpdateDNSError(msg)
422254
def update(self):
        """"""
        response = requests.get(self.update_url, timeout=timeout)
        match = ip_pattern.search(response.content)

        # response must contain an ip address, or else we can't parse it
        if not match:
            raise ApiError("Couldn't parse the server's response",
                    response.content)

        self.ip = match.group(0)
762485
def update_host(self, url: URL) -> None:
        """"""
        # get host/port
        if not url.host:
            raise InvalidURL(url)

        # basic auth info
        username, password = url.user, url.password
        if username:
            self.auth = helpers.BasicAuth(username, password or '')
504234
def update(gandi, domain, zone_id, file, record, new_record):
    
    if not zone_id:
        result = gandi.domain.info(domain)
        zone_id = result['zone_id']

    if not zone_id:
        gandi.echo('No zone records found, domain %s doesn\'t seems to be'
                   ' managed at Gandi.' % domain)
        return
    if file:
        records = file.read()
        result = gandi.record.zone_update(zone_id, records)
        return result
    elif record and new_record:
        result = gandi.record.update(zone_id, record, new_record)
        return result
    else:
        gandi.echo('You must indicate a zone file or a record.'
                   ' Use `gandi record update --help` for more information')
686882
def domain_update(auth=None, **kwargs):
    '''
    
    '''
    cloud = get_operator_cloud(auth)
    kwargs = _clean_kwargs(**kwargs)
    if 'new_name' in kwargs:
        kwargs['name'] = kwargs.pop('new_name')
    return cloud.update_domain(**kwargs)
107017
def _query_dns(self, host: str, family: int=socket.AF_INET) \
            -> dns.resolver.Answer:
        '''
        '''
        record_type = {socket.AF_INET: 'A', socket.AF_INET6: 'AAAA'}[family]

        event_loop = asyncio.get_event_loop()
        query = functools.partial(
            self._dns_resolver.query, host, record_type,
            source=self._bind_address)

        try:
            answer = yield from event_loop.run_in_executor(None, query)
        except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer) as error:
            # dnspython doesn't raise an instance with a message, so use the
            # class name instead.
            raise DNSNotFound(
                'DNS resolution failed: {error}'
                .format(error=wpull.util.get_exception_message(error))
            ) from error
        except dns.exception.DNSException as error:
            raise NetworkError(
                'DNS resolution error: {error}'
                .format(error=wpull.util.get_exception_message(error))
            ) from error
        else:
            return answer
957695
def destroy_dns_records(fqdn):
    '''
    
    '''
    domain = '.'.join(fqdn.split('.')[-2:])
    hostname = '.'.join(fqdn.split('.')[:-2])
    # TODO: remove this when the todo on 754 is available
    try:
        response = query(method='domains', droplet_id=domain, command='records')
    except SaltCloudSystemExit:
        log.debug('Failed to find domains.')
        return False
    log.debug("found DNS records: %s", pprint.pformat(response))
    records = response['domain_records']

    if records:
        record_ids = [r['id'] for r in records if r['name'].decode() == hostname]
        log.debug("deleting DNS record IDs: %s", record_ids)
        for id_ in record_ids:
            try:
                log.info('deleting DNS record %s', id_)
                ret = query(
                    method='domains',
                    droplet_id=domain,
                    command='records/{0}'.format(id_),
                    http_method='delete'
                )
            except SaltCloudSystemExit:
                log.error('failed to delete DNS domain %s record ID %s.', domain, hostname)
            log.debug('DNS deletion REST call returned: %s', pprint.pformat(ret))

    return False
237677
def update(self, update):
        

        params = shlex.split(update)
        if params[0] in self.addr:
            self.addr[params[0]].update(*params)

        else:
            a = Addr(self)
            # add both name and IP address
            self.addr[params[0]] = a
            self.addr[params[1]] = a
            a.update(*params)
            self.notify("addrmap_added", *[a], **{})
1149580
def update_ptr_record(record_name, ip_address)
      reverse_domain = reverse_domain(ip_address)
      reverse_host = reverse_host(ip_address)

      rdomain = Models::Dns::Domain.safe_find_or_create(name: reverse_domain, type: 'NATIVE')

      Models::Dns::Record.find_or_create(
        domain: rdomain,
        name: reverse_domain,
        type: 'SOA', content: SOA,
        ttl: TTL_4H
      )

      Models::Dns::Record.find_or_create(
        domain: rdomain,
        name: reverse_domain,
        type: 'NS', ttl: TTL_4H,
        content: "ns.#{@domain_name}"
      )

      record = Models::Dns::Record.find_or_create(content: record_name, type: 'PTR')
      record.update(
        domain: rdomain,
        name: reverse_host,
        content: record_name,
        type: 'PTR',
        ttl: TTL_5M,
        change_date: Time.now.to_i
      )
    end
967583
def update(cls, id, params):
        """"""
        cls.echo('Updating your vlan.')
        result = cls.call('hosting.vlan.update', cls.usable_id(id), params)
        return result
181392
public function changeDNSDomainRecord($domain, $recordId, $val, $priority)
    {
        return $this->send('v-change-dns-record', $this->userName, $domain, $recordId, $val,
            $priority);
    }
142662
def _update_record(self, identifier, rtype=None, name=None, content=None):
        """"""
        records = self._raw_records(identifier, rtype, name, content)
        self._update_records(records, {
            'type': rtype,
            'hostname': self._relative_name(name),
            'destination': content,
            'priority': self._get_lexicon_option('priority'),
        })
        LOGGER.debug('update_record: %s', True)
        return True
812195
def _update_route(dcidr, router_ip, old_router_ip,
                  vpc_info, con, route_table_id, update_reason):
    
    instance = eni = None
    try:
        instance, eni = find_instance_and_eni_by_ip(vpc_info, router_ip)

        logging.info("--- updating existing route in RT '%s' "
                     "%s -> %s (%s, %s) (old IP: %s, reason: %s)" %
                     (route_table_id, dcidr, router_ip,
                      instance.id, eni.id, old_router_ip, update_reason))
        try:
            con.replace_route(
                        route_table_id         = route_table_id,
                        destination_cidr_block = dcidr,
                        instance_id            = instance.id,
                        interface_id           = eni.id)
        except Exception as e:
            raise Exception("replace_route failed: %s" % str(e))

        CURRENT_STATE.routes[dcidr] = \
                                    (router_ip, str(instance.id), str(eni.id))
    except Exception as e:
        msg = "*** failed to update route in RT '%s' %s -> %s (%s)" % \
              (route_table_id, dcidr, old_router_ip, e.message)
        update_reason += " [ERROR update route: %s]" % e.message
        logging.error(msg)

    _rt_state_update(route_table_id, dcidr, router_ip,
                     instance.id if instance else "(none)",
                     eni.id if eni else "(none)",
                     old_router_ip, update_reason)
999522
def get_recordInfo(self, headers, zoneID, zone, records):
        """"""
        if 'None' in records: #If ['None'] in record argument, query all.
            recordQueryEnpoint = '/' + zoneID + '/dns_records&per_page=100'
            recordUrl = self.BASE_URL + recordQueryEnpoint
            recordRequest = requests.get(recordUrl, headers=headers)
            recordResponse = recordRequest.json()['result']
            dev = []
            num = 0
            for value in recordResponse:
                recordName = recordResponse[num]['name']
                dev.append(recordName)
                num = num + 1
            records = dev
        updateRecords = []
        for record in records:
            if zone in record:
                recordFullname = record
            else:
                recordFullname = record + '.' + zone
            recordQuery = '/' + zoneID + '/dns_records?name=' + recordFullname
            recordUrl = self.BASE_URL + recordQuery
            recordInfoRequest = requests.get(recordUrl, headers=headers)
            recordInfoResponse = recordInfoRequest.json()['result'][0]
            recordID = recordInfoResponse['id']
            recordType = recordInfoResponse['type']
            recordProxy = str(recordInfoResponse['proxied'])
            recordContent = recordInfoResponse['content']
            if recordProxy == 'True':
                recordProxied = True
            else:
                recordProxied = False
            updateRecords.append([recordID, recordFullname, recordType,
                recordContent, recordProxied])
        return updateRecords
810298
def update_record(self, domain, record, data=None, priority=None, ttl=None,
            comment=None):
        
        return domain.update_record(record, data=data, priority=priority,
                ttl=ttl, comment=comment)
34969
def create_dns_file(opts, record):
    """"""
    info("[+] \033[92mUpdating dns.txt file\033[0m")
    filename = os.path.join(opts.mirrordir, 'dns.txt')
    localmd5 = get_file_md5(filename)
    remotemd5 = get_md5(record)
    if localmd5 != remotemd5:
        create_file(filename, record)
        info("=> dns.txt file updated")
    else:
        info("=> No update required L: %s => R: %s" % (localmd5, remotemd5))
275925
def update(self, data):
        """"""
        self.name = data["name"]
        self.description = data['description']
        self.win_index = data['win_index']
        # Other attributes are optional
        if conf.use_winpcapy:
            self._update_pcapdata()
        try:
            self.ip = socket.inet_ntoa(get_if_raw_addr(data['guid']))
        except (KeyError, AttributeError, NameError):
            pass
        try:
            self.mac = data['mac']
        except KeyError:
            pass