def __init__(self, lock=ActionLock(), uep=None):
     self.lock = lock
     self.uep = uep
     self.certlib = CertLib(self.lock, uep=self.uep)
     self.repolib = RepoLib(self.lock, uep=self.uep)
     self.factlib = FactLib(self.lock, uep=self.uep)
     self.profilelib = PackageProfileLib(self.lock, uep=self.uep)
     self.installedprodlib = InstalledProductsLib(self.lock, uep=self.uep)
     #healinglib requires a fact set in order to get socket count
     facts = Facts()
     self.healinglib = HealingLib(self.lock,
                                  uep=self.uep,
                                  facts_dict=facts.to_dict())
 def __init__(self,
              lock=ActionLock(),
              uep=None,
              product_dir=None,
              facts=None):
     self.lock = lock
     self.uep = uep
     self.certlib = CertLib(self.lock, uep=self.uep)
     self.repolib = RepoLib(self.lock, uep=self.uep)
     self.factlib = FactLib(self.lock, uep=self.uep, facts=facts)
     self.profilelib = PackageProfileLib(self.lock, uep=self.uep)
     self.installedprodlib = InstalledProductsLib(self.lock, uep=self.uep)
     #healinglib requires a fact set in order to get socket count
     self.healinglib = HealingLib(self.lock, self.uep, product_dir)
     self.idcertlib = IdentityCertLib(self.lock, uep=self.uep)
    def __init__(self):
        self.identity = require(IDENTITY)
        self.cp_provider = require(CP_PROVIDER)

        self.update()

        self.product_dir = inj.require(inj.PROD_DIR)
        self.entitlement_dir = inj.require(inj.ENT_DIR)
        self.certlib = CertLib(uep=self.cp_provider.get_consumer_auth_cp())

        self.cs = require(CERT_SORTER)
 def __init__(self, lock=ActionLock(), uep=None):
     self.lock = lock
     self.uep = uep
     self.certlib = CertLib(self.lock, uep=self.uep)
     self.repolib = RepoLib(self.lock, uep=self.uep)
     self.factlib = FactLib(self.lock, uep=self.uep)
     self.profilelib = PackageProfileLib(self.lock, uep=self.uep)
     self.installedprodlib = InstalledProductsLib(self.lock, uep=self.uep)
     #healinglib requires a fact set in order to get socket count
     facts = Facts()
     self.healinglib = HealingLib(self.lock, uep=self.uep, facts_dict=facts.to_dict())
 def __init__(self, lock=ActionLock(), uep=None, product_dir=None,
         facts=None):
     self.lock = lock
     self.uep = uep
     self.certlib = CertLib(self.lock, uep=self.uep)
     self.repolib = RepoLib(self.lock, uep=self.uep)
     self.factlib = FactLib(self.lock, uep=self.uep, facts=facts)
     self.profilelib = PackageProfileLib(self.lock, uep=self.uep)
     self.installedprodlib = InstalledProductsLib(self.lock, uep=self.uep)
     #healinglib requires a fact set in order to get socket count
     self.healinglib = HealingLib(self.lock, self.uep, product_dir)
     self.idcertlib = IdentityCertLib(self.lock, uep=self.uep)
Exemple #6
0
    def __init__(self):
        self.create_uep(cert_file=ConsumerIdentity.certpath(),
                        key_file=ConsumerIdentity.keypath())

        self.create_content_connection()
        # we don't know the user/pass yet, so no point in
        # creating an admin uep till we need it
        self.admin_uep = None

        self.product_dir = ProductDirectory()
        self.entitlement_dir = EntitlementDirectory()
        self.certlib = CertLib(uep=self.uep)

        self.product_monitor = file_monitor.Monitor(self.product_dir.path)
        self.entitlement_monitor = file_monitor.Monitor(
            self.entitlement_dir.path)
        self.identity_monitor = file_monitor.Monitor(ConsumerIdentity.PATH)
Exemple #7
0
    def __init__(self):
        self.create_uep(cert_file=ConsumerIdentity.certpath(),
                        key_file=ConsumerIdentity.keypath())

        self.create_content_connection()
        # we don't know the user/pass yet, so no point in
        # creating an admin uep till we need it
        self.admin_uep = None

        self.product_dir = ProductDirectory()
        self.entitlement_dir = EntitlementDirectory()
        self.certlib = CertLib(uep=self.uep)

        self.product_monitor = file_monitor.Monitor(self.product_dir.path)
        self.entitlement_monitor = file_monitor.Monitor(
            self.entitlement_dir.path)
        self.identity_monitor = file_monitor.Monitor(ConsumerIdentity.PATH)

        # connect handlers to refresh the cached data when we notice a change.
        # do this before any other handlers might connect
        self.product_monitor.connect(
            "changed", lambda monitor: self.product_dir.refresh())
        self.entitlement_monitor.connect(
            "changed", lambda monitor: self.entitlement_dir.refresh())
Exemple #8
0
class CertManager:
    """
    An object used to update the certficates, yum repos, and facts for
    the system.

    @ivar certlib: The RHSM I{entitlement} certificate management lib.
    @type certlib: L{CertLib}
    @ivar repolib: The RHSM repository management lib.
    @type repolib: L{RepoLib}
    """

    def __init__(self, lock=ActionLock(), uep=None, product_dir=None):
        self.lock = lock
        self.uep = uep
        self.certlib = CertLib(self.lock, uep=self.uep)
        self.repolib = RepoLib(self.lock, uep=self.uep)
        self.factlib = FactLib(self.lock, uep=self.uep)
        self.profilelib = PackageProfileLib(self.lock, uep=self.uep)
        self.installedprodlib = InstalledProductsLib(self.lock, uep=self.uep)
        #healinglib requires a fact set in order to get socket count
        facts = Facts()
        self.healinglib = HealingLib(self.lock, self.uep, facts.to_dict(),
                                     product_dir)
        self.idcertlib = IdentityCertLib(self.lock, uep=self.uep)

    def update(self, autoheal=False):
        """
        Update I{entitlement} certificates and corresponding
        yum repositiories.
        @return: The number of updates required.
        @rtype: int
        """
        updates = 0
        lock = self.lock
        try:
            lock.acquire()

            # WARNING: order is important here, we need to update a number
            # of things before attempting to autoheal, and we need to autoheal
            # before attempting to fetch our certificates:
            if autoheal:
                libset = [self.healinglib]
            else:
                libset = [self.idcertlib, self.repolib, self.factlib, self.profilelib, self.installedprodlib]

            # WARNING
            # Certlib inherits DataLib as well as the above 'lib' objects,
            # but for some reason it's update method returns a tuple instead
            # of an int:
            ret = []
            try:
                ret = self.certlib.update()
            except Exception, e:
                log.exception(e)
                print e
            # run the certlib update first as it will talk to candlepin,
            # and we can find out if we got deleted or not.
            for lib in libset:
                try:
                    updates += lib.update()
                except Exception, e:
                    log.exception(e)
                    print e
            # NOTE: with no consumer cert, most of these actually
            # fail
            if ret:
                updates += ret[0]
                for e in ret[1]:
                    print ' '.join(str(e).split('-')[1:]).strip()
    def create_uep(self):
        # Re-initialize our connection:
        self.cp_provider.set_connection_info()

        # Holds a reference to the old uep:
        self.certlib = CertLib(uep=self.cp_provider.get_consumer_auth_cp())
class CertManager:
    """
    An object used to update the certficates, yum repos, and facts for
    the system.

    @ivar certlib: The RHSM I{entitlement} certificate management lib.
    @type certlib: L{CertLib}
    @ivar repolib: The RHSM repository management lib.
    @type repolib: L{RepoLib}
    """

    def __init__(self, lock=ActionLock(), uep=None, product_dir=None,
            facts=None):
        self.lock = lock
        self.uep = uep
        self.certlib = CertLib(self.lock, uep=self.uep)
        self.repolib = RepoLib(self.lock, uep=self.uep)
        self.factlib = FactLib(self.lock, uep=self.uep, facts=facts)
        self.profilelib = PackageProfileLib(self.lock, uep=self.uep)
        self.installedprodlib = InstalledProductsLib(self.lock, uep=self.uep)
        #healinglib requires a fact set in order to get socket count
        self.healinglib = HealingLib(self.lock, self.uep, product_dir)
        self.idcertlib = IdentityCertLib(self.lock, uep=self.uep)

    def update(self, autoheal=False):
        """
        Update I{entitlement} certificates and corresponding
        yum repositiories.
        @return: The number of updates required.
        @rtype: int
        """
        updates = 0
        lock = self.lock
        try:
            lock.acquire()

            # WARNING: order is important here, we need to update a number
            # of things before attempting to autoheal, and we need to autoheal
            # before attempting to fetch our certificates:
            if autoheal:
                libset = [self.installedprodlib, self.healinglib]
            else:
                libset = [self.idcertlib, self.repolib, self.factlib, self.profilelib, self.installedprodlib]

            # WARNING
            # Certlib inherits DataLib as well as the above 'lib' objects,
            # but for some reason it's update method returns a tuple instead
            # of an int:
            ret = []
            try:
                ret = self.certlib.update()
            # see bz#852706, reraise GoneException so that
            # consumer cert deletion works
            except GoneException, e:
                raise
            # raise this so it can be exposed clearly
            except ExpiredIdentityCertException, e:
                raise
            except Exception, e:
                log.warning("Exception caught while running certlib update")
                log.exception(e)
Exemple #11
0
 def create_uep(self, cert_file=None, key_file=None):
     # Re-initialize our connection:
     self.uep = self._create_uep(cert_file=cert_file, key_file=key_file)
     # Holds a reference to the old uep:
     self.certlib = CertLib(uep=self.uep)
class CertManager:
    """
    An object used to update the certficates, yum repos, and facts for
    the system.

    @ivar certlib: The RHSM I{entitlement} certificate management lib.
    @type certlib: L{CertLib}
    @ivar repolib: The RHSM repository management lib.
    @type repolib: L{RepoLib}
    """
    def __init__(self, lock=ActionLock(), uep=None):
        self.lock = lock
        self.uep = uep
        self.certlib = CertLib(self.lock, uep=self.uep)
        self.repolib = RepoLib(self.lock, uep=self.uep)
        self.factlib = FactLib(self.lock, uep=self.uep)
        self.profilelib = PackageProfileLib(self.lock, uep=self.uep)
        self.installedprodlib = InstalledProductsLib(self.lock, uep=self.uep)
        #healinglib requires a fact set in order to get socket count
        facts = Facts()
        self.healinglib = HealingLib(self.lock,
                                     uep=self.uep,
                                     facts_dict=facts.to_dict())

    def update(self, autoheal=False):
        """
        Update I{entitlement} certificates and corresponding
        yum repositiories.
        @return: The number of updates required.
        @rtype: int
        """
        updates = 0
        lock = self.lock
        try:
            lock.acquire()

            # WARNING: order is important here, we need to update a number
            # of things before attempting to autoheal, and we need to autoheal
            # before attempting to fetch our certificates:
            if autoheal:
                libset = [self.healinglib]
            else:
                libset = [
                    self.repolib, self.factlib, self.profilelib,
                    self.installedprodlib
                ]

            # WARNING
            # Certlib inherits DataLib as well as the above 'lib' objects,
            # but for some reason it's update method returns a tuple instead
            # of an int:
            ret = []
            try:
                ret = self.certlib.update()
            except Exception, e:
                print e
            # run the certlib update first as it will talk to candlepin,
            # and we can find out if we got deleted or not.
            for lib in libset:
                updates += lib.update()

            # NOTE: with no consumer cert, most of these actually
            # fail
            if ret:
                updates += ret[0]
                for e in ret[1]:
                    print ' '.join(str(e).split('-')[1:]).strip()
        finally:
class CertManager:
    """
    An object used to update the certficates, yum repos, and facts for
    the system.

    @ivar certlib: The RHSM I{entitlement} certificate management lib.
    @type certlib: L{CertLib}
    @ivar repolib: The RHSM repository management lib.
    @type repolib: L{RepoLib}
    """
    def __init__(self,
                 lock=ActionLock(),
                 uep=None,
                 product_dir=None,
                 facts=None):
        self.lock = lock
        self.uep = uep
        self.certlib = CertLib(self.lock, uep=self.uep)
        self.repolib = RepoLib(self.lock, uep=self.uep)
        self.factlib = FactLib(self.lock, uep=self.uep, facts=facts)
        self.profilelib = PackageProfileLib(self.lock, uep=self.uep)
        self.installedprodlib = InstalledProductsLib(self.lock, uep=self.uep)
        #healinglib requires a fact set in order to get socket count
        self.healinglib = HealingLib(self.lock, self.uep, product_dir)
        self.idcertlib = IdentityCertLib(self.lock, uep=self.uep)

    def update(self, autoheal=False):
        """
        Update I{entitlement} certificates and corresponding
        yum repositiories.
        @return: The number of updates required.
        @rtype: int
        """
        updates = 0
        lock = self.lock
        try:
            lock.acquire()

            # WARNING: order is important here, we need to update a number
            # of things before attempting to autoheal, and we need to autoheal
            # before attempting to fetch our certificates:
            if autoheal:
                libset = [self.installedprodlib, self.healinglib]
            else:
                libset = [
                    self.idcertlib, self.repolib, self.factlib,
                    self.profilelib, self.installedprodlib
                ]

            # WARNING
            # Certlib inherits DataLib as well as the above 'lib' objects,
            # but for some reason it's update method returns a tuple instead
            # of an int:
            ret = []
            try:
                ret = self.certlib.update()
            # see bz#852706, reraise GoneException so that
            # consumer cert deletion works
            except GoneException, e:
                raise
            # raise this so it can be exposed clearly
            except ExpiredIdentityCertException, e:
                raise
            except Exception, e:
                log.warning("Exception caught while running certlib update")
                log.exception(e)