Example #1
0
 def _webroot_map_test(self, map_arg, path_arg, domains_arg, # pylint: disable=too-many-arguments
                       expected_map, expectect_domains, extra_args=None):
     parse = self._get_argument_parser()
     webroot_map_args = extra_args if extra_args else []
     if map_arg:
         webroot_map_args.extend(["--webroot-map", map_arg])
     if path_arg:
         webroot_map_args.extend(["-w", path_arg])
     if domains_arg:
         webroot_map_args.extend(["-d", domains_arg])
     namespace = parse(webroot_map_args)
     domains = cli._find_domains(namespace, mock.MagicMock()) # pylint: disable=protected-access
     self.assertEqual(namespace.webroot_map, expected_map)
     self.assertEqual(set(domains), set(expectect_domains))
Example #2
0
 def _webroot_map_test(self, map_arg, path_arg, domains_arg, # pylint: disable=too-many-arguments
                       expected_map, expectect_domains, extra_args=None):
     parse = self._get_argument_parser()
     webroot_map_args = extra_args if extra_args else []
     if map_arg:
         webroot_map_args.extend(["--webroot-map", map_arg])
     if path_arg:
         webroot_map_args.extend(["-w", path_arg])
     if domains_arg:
         webroot_map_args.extend(["-d", domains_arg])
     namespace = parse(webroot_map_args)
     domains = cli._find_domains(namespace, mock.MagicMock()) # pylint: disable=protected-access
     self.assertEqual(namespace.webroot_map, expected_map)
     self.assertEqual(set(domains), set(expectect_domains))
Example #3
0
    if args.domains and args.csr is not None:
        # TODO: --csr could have a priority, when --domains is
        # supplied, check if CSR matches given domains?
        return "--domains and --csr are mutually exclusive"

    try:
        # installers are used in auth mode to determine domain names
        installer, authenticator = choose_configurator_plugins(args, config, plugins, "certonly")
    except errors.PluginSelectionError, e:
        return e.message

    # TODO: Handle errors from _init_le_client?
    le_client = init_le_client(args, config, authenticator, installer)

    # This is a special case; cert and chain are simply saved
    if args.csr is not None:
        certr, chain = le_client.obtain_certificate_from_csr(le_util.CSR(
            file=args.csr[0], data=args.csr[1], form="der"))
        cert_path, _, cert_fullchain = le_client.save_certificate(
            certr, chain, args.cert_path, args.chain_path, args.fullchain_path)
        _report_new_cert(cert_path, cert_fullchain)
    elif args.private_key:
        domains = _find_domains(args, installer)
        auth_from_domains_with_key(le_client, config, domains, key=args.private_key)
    else:
        domains = _find_domains(args, installer)
        _auth_from_domains(le_client, config, domains)

    _suggest_donate()