Example #1
0
 def register(self, log, hostname, ip, options):
     """Implement ServicePlugin.register()."""
     url = self._url.format(hostname)
     if ip:
         url += "&myip=" + ip.v4
     http_basic_auth_setup(url)
     get_response(log, url)
Example #2
0
 def register(self, log, hostname, ip, options):
     """Implement ServicePlugin.register."""
     url = self._url.format(hostname)
     http_basic_auth_setup(url)
     html = get_response(log, url)
     if html.split()[0] not in ['nochg', 'good']:
         raise ServiceError("Bad update reply: " + html)
Example #3
0
 def register(self, log, hostname, ip, options):
     """Implement ServicePlugin.register()."""
     url = self._url.format(hostname)
     if ip and ip.v4:
         url += "&ip=" + ip.v4
     http_basic_auth_setup(url)
     reply = get_response(log, url).strip()
     if reply not in ['ok', 'nochange']:
         raise ServiceError("Unexpected update reply: " + reply)
Example #4
0
 def register(self, log, hostname, ip, options):
     """Implement ServicePlugin.register."""
     url = self._url.format(hostname)
     if ip:
         url += "&ip=" + ip.v4
     http_basic_auth_setup(url)
     html = get_response(log, url)
     if 'uccessful' not in html:
         raise ServiceError("Bad update reply: " + html)
Example #5
0
 def register(self, log, hostname, ip, options):
     """Implement ServicePlugin.register()."""
     url = self._url.format(hostname)
     if ip:
         url += '&myip=' + ip.v4
     http_basic_auth_setup(url)
     html = get_response(log, request)
     if html not in ['good', 'nochg']:
         raise ServiceError('Bad server reply: ' + html)
Example #6
0
 def register(self, log, hostname, ip, options):
     """Implement ServicePlugin.register()."""
     url = self._url.format(hostname)
     if ip and ip.v4:
         url += "&ip=" + ip.v4
     if ip and ip.v6:
         url += "&ip6=" + ip.v6
     http_basic_auth_setup(url)
     html = get_response(log, url)
     key = html.split()[0]
     if key not in ['OK', 'good', 'nochg']:
         raise ServiceError("Bad server reply: " + html)
     log.info("Server reply: " + html)
Example #7
0
    def register(self, log, hostname, ip, options):
        """Implement ServicePlugin.register()."""
        query = {
            'hostname': hostname,
        }

        # IP address is optional for IPv4
        if ip:
            query['myip'] = ip.v6 or ip.v4

        url = "{}?{}".format(self._url, urllib.parse.urlencode(query))
        http_basic_auth_setup(url)
        request = urllib.request.Request(url=url, method='POST')
        html = get_response(log, request)

        code = html.split()[0]
        if code not in ['good', 'nochg']:
            raise ServiceError("Bad server reply: " + html)
Example #8
0
    def register(self, log: Logger, hostname: str, ip: IpAddr, options):
        """Implement ServicePlugin.register.

        Expects the `ip` to be filtered already according to the _global_
        `--ip-version` option.
        """
        url = self._url.format(hostname)

        if ip:
            if ip.v4:
                url += '&ip=' + ip.v4
            if ip.v6:
                url += '&ip6=' + ip.v6

        http_basic_auth_setup(url)

        body = get_response(log, url)  # Get ASCII encoded body-content
        if not DeDnsHomeAddressPlugin.is_success(body):
            raise ServiceError("Bad update reply.\nMessage: " + body)