Esempio n. 1
0
def rename_lineage(config):
    """Rename the specified lineage to the new name.

    :param config: Configuration.
    :type config: :class:`certbot.configuration.NamespaceConfig`

    """
    disp = zope.component.getUtility(interfaces.IDisplay)

    certname = _get_certname(config, "rename")

    new_certname = config.new_certname
    if not new_certname:
        code, new_certname = disp.input(
            "Enter the new name for certificate {0}".format(certname),
            flag="--updated-cert-name",
            force_interactive=True)
        if code != display_util.OK or not new_certname:
            raise errors.Error("User ended interaction.")

    lineage = lineage_for_certname(config, certname)
    if not lineage:
        raise errors.ConfigurationError("No existing certificate with name "
                                        "{0} found.".format(certname))
    storage.rename_renewal_config(certname, new_certname, config)
    disp.notification("Successfully renamed {0} to {1}.".format(
        certname, new_certname),
                      pause=False)
Esempio n. 2
0
def rename_lineage(config):
    """Rename the specified lineage to the new name.

    :param config: Configuration.
    :type config: :class:`certbot.configuration.NamespaceConfig`

    """
    disp = zope.component.getUtility(interfaces.IDisplay)

    certname = _get_certname(config, "rename")

    new_certname = config.new_certname
    if not new_certname:
        code, new_certname = disp.input(
            "Enter the new name for certificate {0}".format(certname),
            flag="--updated-cert-name", force_interactive=True)
        if code != display_util.OK or not new_certname:
            raise errors.Error("User ended interaction.")

    lineage = lineage_for_certname(config, certname)
    if not lineage:
        raise errors.ConfigurationError("No existing certificate with name "
            "{0} found.".format(certname))
    storage.rename_renewal_config(certname, new_certname, config)
    disp.notification("Successfully renamed {0} to {1}."
        .format(certname, new_certname), pause=False)
Esempio n. 3
0
def rename_lineage(config):
    """Rename the specified lineage to the new name.

    :param config: Configuration.
    :type config: :class:`certbot.interfaces.IConfig`

    """
    disp = zope.component.getUtility(interfaces.IDisplay)
    renewer_config = configuration.RenewerConfiguration(config)

    certname = config.certname
    if not certname:
        filenames = renewal.renewal_conf_files(renewer_config)
        choices = [
            storage.lineagename_for_filename(name) for name in filenames
        ]
        if not choices:
            raise errors.Error("No existing certificates found.")
        code, index = disp.menu("Which certificate would you like to rename?",
                                choices,
                                ok_label="Select",
                                flag="--cert-name")
        if code != display_util.OK or not index in range(0, len(choices)):
            raise errors.Error("User ended interaction.")
        certname = choices[index]

    new_certname = config.new_certname
    if not new_certname:
        code, new_certname = disp.input(
            "Enter the new name for certificate {0}".format(certname),
            flag="--updated-cert-name")
        if code != display_util.OK or not new_certname:
            raise errors.Error("User ended interaction.")

    lineage = lineage_for_certname(config, certname)
    if not lineage:
        raise errors.ConfigurationError("No existing certificate with name "
                                        "{0} found.".format(certname))
    storage.rename_renewal_config(certname, new_certname, renewer_config)
    disp.notification("Successfully renamed {0} to {1}.".format(
        certname, new_certname),
                      pause=False)
Esempio n. 4
0
def rename_lineage(config):
    """Rename the specified lineage to the new name.

    :param config: Configuration.
    :type config: :class:`certbot.interfaces.IConfig`

    """
    disp = zope.component.getUtility(interfaces.IDisplay)
    renewer_config = configuration.RenewerConfiguration(config)

    certname = config.certname
    if not certname:
        filenames = renewal.renewal_conf_files(renewer_config)
        choices = [storage.lineagename_for_filename(name) for name in filenames]
        if not choices:
            raise errors.Error("No existing certificates found.")
        code, index = disp.menu("Which certificate would you like to rename?",
            choices, ok_label="Select", flag="--cert-name")
        if code != display_util.OK or not index in range(0, len(choices)):
            raise errors.Error("User ended interaction.")
        certname = choices[index]

    new_certname = config.new_certname
    if not new_certname:
        code, new_certname = disp.input("Enter the new name for certificate {0}"
            .format(certname), flag="--updated-cert-name")
        if code != display_util.OK or not new_certname:
            raise errors.Error("User ended interaction.")

    lineage = lineage_for_certname(config, certname)
    if not lineage:
        raise errors.ConfigurationError("No existing certificate with name "
            "{0} found.".format(certname))
    storage.rename_renewal_config(certname, new_certname, renewer_config)
    disp.notification("Successfully renamed {0} to {1}."
        .format(certname, new_certname), pause=False)