Exemplo n.º 1
0
    def perform(self, achalls):  # pylint: disable=missing-docstring
        if any(util.already_listening(port) for port in
               (self.config.dvsni_port, self.config.simple_http_port)):
            raise errors.MisconfigurationError(
                "At least one of the (possibly) required ports is "
                "already taken.")

        try:
            return self.perform2(achalls)
        except errors.StandaloneBindError as error:
            display = zope.component.getUtility(interfaces.IDisplay)

            if error.socket_error.errno == socket.errno.EACCES:
                display.notification(
                    "Could not bind TCP port {0} because you don't have "
                    "the appropriate permissions (for example, you "
                    "aren't running this program as "
                    "root).".format(error.port))
            elif error.socket_error.errno == socket.errno.EADDRINUSE:
                display.notification(
                    "Could not bind TCP port {0} because it is already in "
                    "use by another process on this system (such as a web "
                    "server). Please stop the program in question and then "
                    "try again.".format(error.port))
            else:
                raise  # XXX: How to handle unknown errors in binding?
Exemplo n.º 2
0
 def _call(self, *args, **kwargs):
     from letsencrypt.plugins.util import already_listening
     return already_listening(*args, **kwargs)
Exemplo n.º 3
0
 def check_required_ports(self):
     """Check if required ports are available, else raise an Error."""
     if any(util.already_listening(port) for port in self._necessary_ports):
         raise errors.MisconfigurationError("At least one of the (possibly) required ports is " "already taken.")