Exemplo n.º 1
0
 def _run_undo_commands(self, filepath):  # pylint: disable=no-self-use
     """Run all commands in a file."""
     with open(filepath, 'rb') as csvfile:
         csvreader = csv.reader(csvfile)
         for command in reversed(list(csvreader)):
             try:
                 le_util.run_script(command)
             except errors.SubprocessError:
                 logger.error("Unable to run undo command: %s",
                              " ".join(command))
Exemplo n.º 2
0
    def config_test(self):  # pylint: disable=no-self-use
        """Check the configuration of Nginx for errors.

        :raises .errors.MisconfigurationError: If config_test fails

        """
        try:
            le_util.run_script([self.conf('ctl'), "-c", self.nginx_conf, "-t"])
        except errors.SubprocessError as err:
            raise errors.MisconfigurationError(str(err))
Exemplo n.º 3
0
    def config_test(self):  # pylint: disable=no-self-use
        """Check the configuration of Nginx for errors.

        :raises .errors.MisconfigurationError: If config_test fails

        """
        try:
            le_util.run_script([self.conf('ctl'), "-c", self.nginx_conf, "-t"])
        except errors.SubprocessError as err:
            raise errors.MisconfigurationError(str(err))
Exemplo n.º 4
0
    def config_test(self):  # pylint: disable=no-self-use
        """Check the configuration of Apache for errors.

        :raises .errors.MisconfigurationError: If config_test fails

        """
        try:
            le_util.run_script([self.conf("ctl"), "configtest"])
        except errors.SubprocessError as err:
            raise errors.MisconfigurationError(str(err))
Exemplo n.º 5
0
    def config_test(self):  # pylint: disable=no-self-use
        """Check the configuration of Apache for errors.

        :raises .errors.MisconfigurationError: If config_test fails

        """
        try:
            le_util.run_script([self.conf("ctl"), "configtest"])
        except errors.SubprocessError as err:
            raise errors.MisconfigurationError(str(err))
Exemplo n.º 6
0
 def _run_undo_commands(self, filepath):  # pylint: disable=no-self-use
     """Run all commands in a file."""
     with open(filepath, 'rb') as csvfile:
         csvreader = csv.reader(csvfile)
         for command in reversed(list(csvreader)):
             try:
                 le_util.run_script(command)
             except errors.SubprocessError:
                 logger.error(
                     "Unable to run undo command: %s", " ".join(command))
Exemplo n.º 7
0
    def _enable_mod_debian(self, mod_name, temp):
        """Assumes mods-available, mods-enabled layout."""
        # Generate reversal command.
        # Try to be safe here... check that we can probably reverse before
        # applying enmod command
        if not le_util.exe_exists(self.conf("dismod")):
            raise errors.MisconfigurationError(
                "Unable to find a2dismod, please make sure a2enmod and "
                "a2dismod are configured correctly for letsencrypt.")

        self.reverter.register_undo_command(
            temp, [self.conf("dismod"), mod_name])
        le_util.run_script([self.conf("enmod"), mod_name])
Exemplo n.º 8
0
    def _enable_mod_debian(self, mod_name, temp):
        """Assumes mods-available, mods-enabled layout."""
        # Generate reversal command.
        # Try to be safe here... check that we can probably reverse before
        # applying enmod command
        if not le_util.exe_exists(self.conf("dismod")):
            raise errors.MisconfigurationError(
                "Unable to find a2dismod, please make sure a2enmod and "
                "a2dismod are configured correctly for letsencrypt.")

        self.reverter.register_undo_command(
            temp, [self.conf("dismod"), mod_name])
        le_util.run_script([self.conf("enmod"), mod_name])
Exemplo n.º 9
0
    def get_version(self):
        """Return version of Apache Server.

        Version is returned as tuple. (ie. 2.4.7 = (2, 4, 7))

        :returns: version
        :rtype: tuple

        :raises .PluginError: if unable to find Apache version

        """
        try:
            stdout, _ = le_util.run_script([self.conf("ctl"), "-v"])
        except errors.SubprocessError:
            raise errors.PluginError("Unable to run %s -v" % self.conf("ctl"))

        regex = re.compile(r"Apache/([0-9\.]*)", re.IGNORECASE)
        matches = regex.findall(stdout)

        if len(matches) != 1:
            raise errors.PluginError("Unable to find Apache version")

        return tuple([int(i) for i in matches[0].split(".")])
Exemplo n.º 10
0
    def get_version(self):
        """Return version of Apache Server.

        Version is returned as tuple. (ie. 2.4.7 = (2, 4, 7))

        :returns: version
        :rtype: tuple

        :raises .PluginError: if unable to find Apache version

        """
        try:
            stdout, _ = le_util.run_script([self.conf("ctl"), "-v"])
        except errors.SubprocessError:
            raise errors.PluginError("Unable to run %s -v" % self.conf("ctl"))

        regex = re.compile(r"Apache/([0-9\.]*)", re.IGNORECASE)
        matches = regex.findall(stdout)

        if len(matches) != 1:
            raise errors.PluginError("Unable to find Apache version")

        return tuple([int(i) for i in matches[0].split(".")])
Exemplo n.º 11
0
    def _call(cls, params):
        from letsencrypt.le_util import run_script

        return run_script(params)
Exemplo n.º 12
0
 def _call(cls, params):
     from letsencrypt.le_util import run_script
     return run_script(params)