Exemplo n.º 1
0
    def install(self, bundle):
        """Persist an ent cert and it's key after splitting it from the bundle."""
        self.pre_install(bundle)

        cert_bundle_writer = Writer()
        try:
            key, cert = self.build_cert(bundle)
            cert_bundle_writer.write(key, cert)

            self.report.added.append(cert)
        except Exception, e:
            self.install_exception(bundle, e)
Exemplo n.º 2
0
    def install(self, bundle):
        """Persist an ent cert and it's key after splitting it from the bundle."""
        self.pre_install(bundle)

        cert_bundle_writer = Writer()
        try:
            key, cert = self.build_cert(bundle)
            cert_bundle_writer.write(key, cert)

            self.report.added.append(cert)
        except Exception, e:
            self.install_exception(bundle, e)
Exemplo n.º 3
0
 def install(self, serials, report):
     br = Writer()
     exceptions = []
     for bundle in self.getCertificatesBySerialList(serials):
         try:
             key, cert = self.build(bundle)
             br.write(key, cert)
             report.added.append(cert)
         except Exception, e:
             log.exception(e)
             log.error('Bundle not loaded:\n%s\n%s', bundle, e)
             exceptions.append(e.message)
Exemplo n.º 4
0
 def install(self, serials, report):
     br = Writer()
     exceptions = []
     for bundle in self.get_certificates_by_serial_list(serials):
         try:
             key, cert = self.build(bundle)
             br.write(key, cert)
             report.added.append(cert)
         except Exception, e:
             log.exception(e)
             log.error(
                 'Bundle not loaded:\n%s\n%s',
                 bundle,
                 e)
             exceptions.append(e)
                print _("RHIC was deleted by upstream server. See rhsm.log for more detail.")
                RhicCertificate.move()
                sys.exit(-1)
            else:
                raise
        except connection.RemoteServerException, e:
            if e.code == 404:
                print _("RHIC was not found by upstream server. See rhsm.log for more detail.")
                RhicCertificate.move()
                sys.exit(-1)
            else:
                raise

        if certs:
            try:
                writer = Writer()
                cert = certificate.create_from_pem(certs['cert'])
                key = certificate.Key(certs['key'])
                writer.write(key, cert)
            except:
                raise

        rhiclib.cleanExpiredCerts(ProductDirectory(), EntitlementDirectory(), facts.to_dict())

        sys.exit(0)

    if not ConsumerIdentity.existsAndValid():
        log.error('Either the consumer is not registered or the certificates' +
                  ' are corrupted. Certificate update using daemon failed.')
        sys.exit(-1)
    print _('Updating entitlement certificates & repositories')