def _subscribe(self, uuid, current_sla, dry_run_result, callback):
        """
        Subscribe to the selected pools.
        """
        try:
            if not current_sla:
                log.info("Saving selected service level for this system.")
                self.backend.cp_provider.get_consumer_auth_cp().updateConsumer(uuid,
                        service_level=dry_run_result.service_level)

            log.info("Binding to subscriptions at service level: %s" %
                    dry_run_result.service_level)
            for pool_quantity in dry_run_result.json:
                pool_id = pool_quantity['pool']['id']
                quantity = pool_quantity['quantity']
                log.info("  pool %s quantity %s" % (pool_id, quantity))
                self.plugin_manager.run("pre_subscribe", consumer_uuid=uuid,
                                        pool_id=pool_id, quantity=quantity)
                ents = self.backend.cp_provider.get_consumer_auth_cp().bindByEntitlementPool(uuid, pool_id, quantity)
                self.plugin_manager.run("post_subscribe", consumer_uuid=uuid, entitlement_data=ents)
            managerlib.fetch_certificates(self.backend.certlib)
        except Exception:
            # Going to try to update certificates just in case we errored out
            # mid-way through a bunch of binds:
            try:
                managerlib.fetch_certificates(self.backend.certlib)
            except Exception, cert_update_ex:
                log.info("Error updating certificates after error:")
                log.exception(cert_update_ex)
            self.queue.put((callback, None, sys.exc_info()))
            return
示例#2
0
    def _subscribe(self, uuid, current_sla, dry_run_result, callback):
        """
        Subscribe to the selected pools.
        """
        try:
            if not current_sla:
                log.info("Saving selected service level for this system.")
                self.backend.uep.updateConsumer(
                    uuid, service_level=dry_run_result.service_level)

            log.info("Binding to subscriptions at service level: %s" %
                     dry_run_result.service_level)
            for pool_quantity in dry_run_result.json:
                pool_id = pool_quantity['pool']['id']
                quantity = pool_quantity['quantity']
                log.info("  pool %s quantity %s" % (pool_id, quantity))
                self.backend.uep.bindByEntitlementPool(uuid, pool_id, quantity)
            managerlib.fetch_certificates(self.backend)
        except Exception, e:
            # Going to try to update certificates just in case we errored out
            # mid-way through a bunch of binds:
            try:
                managerlib.fetch_certificates(self.backend)
            except Exception, cert_update_ex:
                log.info("Error updating certificates after error:")
                log.exception(cert_update_ex)
示例#3
0
    def forward(self):
        """
        Subscribe to the selected pools.
        returns a list of granted entitlement ids.
        """
        entitlement_cert_ids = []
        try:
            if not self.controller.current_sla:
                log.info("Saving selected service level for this system.")
                self.controller.backend.uep.updateConsumer(
                        self.controller.consumer.getConsumerId(),
                        service_level=self.dry_run_result.service_level)

            log.info("Binding to subscriptions at service level: %s" %
                    self.dry_run_result.service_level)
            for pool_quantity in self.dry_run_result.json:
                pool_id = pool_quantity['pool']['id']
                quantity = pool_quantity['quantity']
                log.info("  pool %s quantity %s" % (pool_id, quantity))
                result = self.controller.backend.uep.bindByEntitlementPool(
                        self.controller.consumer.getConsumerId(), pool_id,
                        quantity)
                for entitlement in result:
                    for certificate in entitlement['certificates']:
                        entitlement_cert_ids.append(certificate['serial']['id'])
                fetch_certificates(self.controller.backend)
        except Exception, e:
            # Going to try to update certificates just in case we errored out
            # mid-way through a bunch of binds:
            try:
                fetch_certificates(self.controller.backend)
            except Exception, cert_update_ex:
                log.info("Error updating certificates after error:")
                log.exception(cert_update_ex)
示例#4
0
    def _subscribe(self, uuid, current_sla, dry_run_result, callback):
        """
        Subscribe to the selected pools.
        """
        try:
            if not current_sla:
                log.info("Saving selected service level for this system.")
                self.backend.uep.updateConsumer(uuid,
                        service_level=dry_run_result.service_level)

            log.info("Binding to subscriptions at service level: %s" %
                    dry_run_result.service_level)
            for pool_quantity in dry_run_result.json:
                pool_id = pool_quantity['pool']['id']
                quantity = pool_quantity['quantity']
                log.info("  pool %s quantity %s" % (pool_id, quantity))
                self.backend.uep.bindByEntitlementPool(uuid, pool_id, quantity)
            managerlib.fetch_certificates(self.backend)
        except Exception, e:
            # Going to try to update certificates just in case we errored out
            # mid-way through a bunch of binds:
            try:
                managerlib.fetch_certificates(self.backend)
            except Exception, cert_update_ex:
                log.info("Error updating certificates after error:")
                log.exception(cert_update_ex)
示例#5
0
    def forward(self):
        """
        Subscribe to the selected pools.
        returns a list of granted entitlement ids.
        """
        entitlement_cert_ids = []
        try:
            if not self.controller.current_sla:
                log.info("Saving selected service level for this system.")
                self.controller.backend.uep.updateConsumer(
                    self.controller.consumer.getConsumerId(),
                    service_level=self.dry_run_result.service_level)

            log.info("Binding to subscriptions at service level: %s" %
                     self.dry_run_result.service_level)
            for pool_quantity in self.dry_run_result.json:
                pool_id = pool_quantity['pool']['id']
                quantity = pool_quantity['quantity']
                log.info("  pool %s quantity %s" % (pool_id, quantity))
                result = self.controller.backend.uep.bindByEntitlementPool(
                    self.controller.consumer.getConsumerId(), pool_id,
                    quantity)
                for entitlement in result:
                    for certificate in entitlement['certificates']:
                        entitlement_cert_ids.append(
                            certificate['serial']['id'])
                fetch_certificates(self.controller.backend)
        except Exception, e:
            # Going to try to update certificates just in case we errored out
            # mid-way through a bunch of binds:
            try:
                fetch_certificates(self.controller.backend)
            except Exception, cert_update_ex:
                log.info("Error updating certificates after error:")
                log.exception(cert_update_ex)
    def _subscribe(self, uuid, current_sla, dry_run_result, callback):
        """
        Subscribe to the selected pools.
        """
        try:
            if not current_sla:
                log.info("Saving selected service level for this system.")
                self.backend.cp_provider.get_consumer_auth_cp().updateConsumer(uuid,
                        service_level=dry_run_result.service_level)

            log.info("Binding to subscriptions at service level: %s" %
                    dry_run_result.service_level)
            for pool_quantity in dry_run_result.json:
                pool_id = pool_quantity['pool']['id']
                quantity = pool_quantity['quantity']
                log.info("  pool %s quantity %s" % (pool_id, quantity))
                self.plugin_manager.run("pre_subscribe", consumer_uuid=uuid,
                                        pool_id=pool_id, quantity=quantity)
                ents = self.backend.cp_provider.get_consumer_auth_cp().bindByEntitlementPool(uuid, pool_id, quantity)
                self.plugin_manager.run("post_subscribe", consumer_uuid=uuid, entitlement_data=ents)
            managerlib.fetch_certificates(self.backend)
        except Exception:
            # Going to try to update certificates just in case we errored out
            # mid-way through a bunch of binds:
            try:
                managerlib.fetch_certificates(self.backend)
            except Exception, cert_update_ex:
                log.info("Error updating certificates after error:")
                log.exception(cert_update_ex)
            self.queue.put((callback, None, sys.exc_info()))
            return
 def _fetch_certificates(self, callback):
     """
     method run in the worker thread.
     """
     try:
         managerlib.fetch_certificates(self.backend)
         self.queue.put((callback, None, None))
     except Exception, e:
         self.queue.put((callback, None, e))
 def _fetch_certificates(self, callback):
     """
     method run in the worker thread.
     """
     try:
         managerlib.fetch_certificates(self.backend)
         self.queue.put((callback, None, None))
     except Exception, e:
         self.queue.put((callback, None, e))
示例#9
0
 def _run_bind(self, pool, quantity, bind_callback, cert_callback, except_callback):
     try:
         attach.AttachService(self.cp_provider.get_consumer_auth_cp()).attach_pool(pool['id'], quantity)
         if bind_callback:
             ga_GObject.idle_add(bind_callback)
         fetch_certificates(self.certlib)
         if cert_callback:
             ga_GObject.idle_add(cert_callback)
     except Exception:
         ga_GObject.idle_add(except_callback, sys.exc_info())
示例#10
0
 def _run_bind(self, pool, quantity, bind_callback, cert_callback, except_callback):
     try:
         self.plugin_manager.run("pre_subscribe", consumer_uuid=self.identity.uuid,
                 pool_id=pool['id'], quantity=quantity)
         ents = self.cp_provider.get_consumer_auth_cp().bindByEntitlementPool(self.identity.uuid, pool['id'], quantity)
         self.plugin_manager.run("post_subscribe", consumer_uuid=self.identity.uuid, entitlement_data=ents)
         if bind_callback:
             ga_GObject.idle_add(bind_callback)
         fetch_certificates(self.certlib)
         if cert_callback:
             ga_GObject.idle_add(cert_callback)
     except Exception:
         ga_GObject.idle_add(except_callback, sys.exc_info())
示例#11
0
 def _run_bind(self, pool, quantity, bind_callback, cert_callback, except_callback):
     try:
         self.plugin_manager.run("pre_subscribe", consumer_uuid=self.identity.uuid,
                 pool_id=pool['id'], quantity=quantity)
         ents = self.cp_provider.get_consumer_auth_cp().bindByEntitlementPool(self.identity.uuid, pool['id'], quantity)
         self.plugin_manager.run("post_subscribe", consumer_uuid=self.identity.uuid, entitlement_data=ents)
         if bind_callback:
             ga_GObject.idle_add(bind_callback)
         fetch_certificates(self.certlib)
         if cert_callback:
             ga_GObject.idle_add(cert_callback)
     except Exception, e:
         ga_GObject.idle_add(except_callback, e)
 def _refresh(self, callback):
     try:
         managerlib.fetch_certificates(self.backend.certlib)
         self.queue.put((callback, None, None))
     except Exception:
         self.queue.put((callback, None, sys.exc_info()))
示例#13
0
 def _refresh(self, callback):
     try:
         managerlib.fetch_certificates(self.backend.certlib)
         self.queue.put((callback, None, None))
     except Exception:
         self.queue.put((callback, None, sys.exc_info()))