Esempio n. 1
0
 def remove_config_file_domains_for_renewal(self, parsed_args):
     """Make "certbot renew" safe if domains are set in cli.ini."""
     # Works around https://github.com/certbot/certbot/issues/4096
     if self.verb == "renew":
         for source, flags in self.parser._source_to_settings.items(): # pylint: disable=protected-access
             if source.startswith("config_file") and "domains" in flags:
                 parsed_args.domains = _Default() if self.detect_defaults else []
Esempio n. 2
0
    def modify_kwargs_for_default_detection(self, **kwargs):
        """Modify an arg so we can check if it was set by the user.

        Changes the parameters given to argparse when adding an argument
        so we can properly detect if the value was set by the user.

        :param dict kwargs: various argparse settings for this argument

        :returns: a modified versions of kwargs
        :rtype: dict

        """
        action = kwargs.get("action", None)
        if action not in EXIT_ACTIONS:
            kwargs["action"] = ("store_true"
                                if action in ZERO_ARG_ACTIONS else "store")
            kwargs["default"] = _Default()
            for param in ARGPARSE_PARAMS_TO_REMOVE:
                kwargs.pop(param, None)

        return kwargs
Esempio n. 3
0
 def setUp(self):
     # pylint: disable=protected-access
     self.default1 = cli._Default()
     self.default2 = cli._Default()