Add or update a host in the infoblox, overwriting any IP address
        entries.

        :param str hostname: Hostname to add/set
        :param str ipv4addr: IP Address to add/set
        :param str comment: The comment for the record
15948
def add_new_host(self, hostname, ipv4addr, comment=None):
        
        host = Host(self.session, name=hostname)
        if host.ipv4addrs:
            host.ipv4addrs = []
        host.add_ipv4addr(ipv4addr)
        host.comment = comment
        return host.save()
576092
def modify_server(self, UUID, **kwargs):
        
        body = dict()
        body['server'] = {}
        for arg in kwargs:
            if arg not in Server.updateable_fields:
                Exception('{0} is not an updateable field'.format(arg))
            body['server'][arg] = kwargs[arg]

        res = self.request('PUT', '/server/{0}'.format(UUID), body)
        server = res['server']

        # Populate subobjects
        IPAddresses = IPAddress._create_ip_address_objs(server.pop('ip_addresses'),
                                                          cloud_manager=self)

        storages = Storage._create_storage_objs(server.pop('storage_devices'),
                                                cloud_manager=self)

        return Server(
            server,
            ip_addresses=IPAddresses,
            storage_devices=storages,
            populated=True,
            cloud_manager=self
        )
450543
def get_host(name=None, ipv4addr=None, mac=None, return_fields=None, **api_opts):
    '''
    
    '''
    infoblox = _get_infoblox(**api_opts)
    host = infoblox.get_host(name=name, mac=mac, ipv4addr=ipv4addr, return_fields=return_fields)
    return host
453747
def update_hostname(self, prompt):
        """"""
        result = re.search(self.prompt_re, prompt)
        if result:
            hostname = result.group('hostname')
            self.log("Hostname detected: {}".format(hostname))
        else:
            hostname = self.device.hostname
            self.log("Hostname not set: {}".format(prompt))
        return hostname
582019
def _add_comments(
        self,
        comments: Optional[Sequence[str]],
        original_string: str = ""
    ) -> str:
        
        if self.config['ignore_comments']:
            return self._strip_comments(original_string)[0]

        if not comments:
            return original_string
        else:
            return "{0}{1} {2}".format(self._strip_comments(original_string)[0],
                                       self.config['comment_prefix'],
                                       "; ".join(comments))
648769
def update_hosts(self, host_names):

        

        if self.host_access:
            curr_hosts = [access.host.name for access in self.host_access]
        else:
            curr_hosts = []

        if set(curr_hosts) == set(host_names):
            log.info('Hosts for updating is equal to current hosts, '
                     'skip modification.')
            return None

        new_hosts = [UnityHostList.get(cli=self._cli, name=host_name)[0]
                     for host_name in host_names]
        new_access = [{'host': item,
                       'accessMask': HostLUNAccessEnum.PRODUCTION}
                      for item in new_hosts]
        resp = self.modify(host_access=new_access)
        resp.raise_if_err()
        return resp
785670
def update_hosts_file(self, ip, entry):
        
        log = logging.getLogger(self.cls_logger + '.update_hosts_file')

        if get_os() in ['Linux', 'Darwin']:
            update_hosts_file_linux(ip=ip, entry=entry)
        elif get_os() == 'Windows':
            update_hosts_file_windows(ip=ip, entry=entry)
        else:
            log.warn('OS detected was not Windows nor Linux')
112005
def add_ipv4addr(self, ipv4addr):
        
        for addr in self.ipv4addrs:
            if ((isinstance(addr, dict) and addr['ipv4addr'] == ipv4addr) or
                (isinstance(addr, HostIPv4) and addr.ipv4addr == ipv4addr)):
                raise ValueError('Already exists')
        self.ipv4addrs.append({'ipv4addr': ipv4addr})
723731
def pin(self, hostname, x509):
        

        key = self._x509_key(x509)
        self._storage.setdefault(hostname, set()).add(key)
165532
def remove_ipv4addr(self, ipv4addr):
        
        for addr in self.ipv4addrs:
            if ((isinstance(addr, dict) and addr['ipv4addr'] == ipv4addr) or
                (isinstance(addr, HostIPv4) and addr.ipv4addr == ipv4addr)):
                self.ipv4addrs.remove(addr)
                break
983652
def put(self, request, *args, **kwargs):
        
        with reversion.create_revision():
            reversion.set_user(request.user)
            reversion.set_comment('changed through the RESTful API from ip %s' % request.META['REMOTE_ADDR'])
            return self.update(request, *args, **kwargs)
482521
def accept(self, addr):
        

        # Add the address to the set
        ip_addr = _parse_ip(addr)
        if ip_addr is None:
            LOG.warn("Cannot add address %r to proxy %s: "
                     "invalid address" % (addr, self.address))
        else:
            self.accepted.add(addr)
371467
public void setHost( String host )
    {
        _host = null;
        if ( host != null && host.length() > 0 )
        {
            //
            // Here's some very minimal support for IPv6 addresses.
            // If the literal IPv6 address is not enclosed in square brackets
            // then add them.
            //
            boolean needBrackets = ( ( host.indexOf( ':' ) >= 0 )
                    && !host.startsWith( "[" )
                    && !host.endsWith( "]" ) );

            if ( needBrackets )
            {
                _host = '[' + host + ']';
            }
            else
            {
                _host = host;
            }

            _opaque = false;
            setSchemeSpecificPart( null );
        }

        if ( _host == null )
        {
            setUserInfo( null );
            setPort( UNDEFINED_PORT );
        }
    }
595156
def update(self, *args, **kwargs):
        """"""
        # first find the update_url for the provided account + hostname:
        update_url = next((r.update_url for r in
                           records(self._credentials, self._url)
                           if r.hostname == self.hostname), None)
        if update_url is None:
            LOG.warning("Could not find hostname '%s' at '%s'",
                        self.hostname, self._url)
            return None
        return update(update_url)
264497
def set_address(self, host, port):
        """"""
        self.host = host
        self.port = port
907736
def add_comment(self, comment):
        
        if not comment:
            return

        self.__comments[comment.name] = comment
        self.comment_added_signal(self, comment)
231743
def add(self, host, **kwargs):
        
        if host in self.hosts_:
            raise ValueError("Host %s: exists (use update)." % host)
        self.hosts_.add(host)
        self.lines_.append(ConfigLine(line="", host=None))
        self.lines_.append(ConfigLine(line="Host %s" % host, host=host, key="Host", value=host))
        for k, v in kwargs.items():
            if type(v) not in [list, tuple]:
                v = [v]
            mapped_k = _remap_key(k)
            for value in v:
                self.lines_.append(ConfigLine(line="  %s %s" % (mapped_k, str(value)), host=host, key=mapped_k, value=value))
        self.lines_.append(ConfigLine(line="", host=None))