예제 #1
0
def delete(config):
    """Delete Certbot files associated with a certificate lineage."""
    certname = _get_certname(config, "delete")
    storage.delete_files(config, certname)
    disp = zope.component.getUtility(interfaces.IDisplay)
    disp.notification("Deleted all files relating to certificate {0}."
        .format(certname), pause=False)
예제 #2
0
def delete(config):
    """Delete Certbot files associated with a certificate lineage."""
    certname = _get_certname(config, "delete")
    storage.delete_files(config, certname)
    disp = zope.component.getUtility(interfaces.IDisplay)
    disp.notification("Deleted all files relating to certificate {0}."
        .format(certname), pause=False)
예제 #3
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")

    # what is the new name we want to use?
    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.")

    try:
        # copy files to new name
        new_lineage = storage.duplicate_lineage(config, certname, new_certname)

        # install the new name's files
        config.certname = new_certname
        plugins = plugins_disco.PluginsRegistry.find_all()
        from certbot.main import install
        install(config, plugins, new_lineage, False)
    except (errors.CertStorageError, errors.ConfigurationError, IOError,
            OSError) as e:
        # delete the new files
        config.certname = new_certname
        # we might not have created anything to delete
        try:
            storage.delete_files(config, new_certname)
        except errors.CertStorageError:
            pass
        reporter = zope.component.getUtility(interfaces.IReporter)
        reporter.add_message("Unable to rename certificate",
                             reporter.HIGH_PRIORITY)
        raise e
    else:
        # delete old files
        config.certname = certname
        storage.delete_files(config, certname)
        disp.notification("Renamed files for {0} to {1}.".format(
            certname, new_certname),
                          pause=False)
    finally:
        config.certname = certname
예제 #4
0
 def _call(self):
     from certbot import storage
     with mock.patch("certbot.storage.logger"):
         storage.delete_files(self.config, "example.org")
예제 #5
0
 def _call(self):
     from certbot import storage
     with mock.patch("certbot.storage.logger"):
         storage.delete_files(self.config, "example.org")