예제 #1
0
파일: repo_publish.py 프로젝트: omps/pulp
    def last_publish(self):
        """
        Returns the timestamp of the last time this repo was published,
        regardless of the success or failure of the publish. If
        the repo was never published, this call returns None.

        @return: timestamp instance describing the last publish
        @rtype:  datetime.datetime or None
        """
        try:
            repo_publish_manager = manager_factory.repo_publish_manager()
            last = repo_publish_manager.last_publish(self.repo_id, self.distributor_id)
            return last
        except Exception, e:
            _LOG.exception('Error getting last publish time for repo [%s]' % self.repo_id)
            raise DistributorConduitException(e), None, sys.exc_info()[2]
예제 #2
0
    def last_publish(self):
        """
        Returns the timestamp of the last time this repository group was
        publishe, regardless of the success or failure of the publish. If
        the group was never published, this call returns None.

        @return: timestamp describing the last publish
        @rtype:  datetime
        """
        try:
            manager = manager_factory.repo_group_publish_manager()
            last = manager.last_publish(self.group_id, self.distributor_id)
            return last
        except Exception, e:
            _logger.exception('Error getting last publish time for group [%s]' % self.group_id)
            raise DistributorConduitException(e), None, sys.exc_info()[2]
예제 #3
0
    def last_publish(self):
        """
        Returns the timestamp of the last time this repo was successfully published. If the repo
        was never published, this call returns None.

        :return: timestamp instance describing the last publish
        :rtype:  datetime.datetime or None

        :raises DistributorConduitException: if any errors occur
        """
        try:
            dist = model.Distributor.objects.only('last_publish').get_or_404(
                repo_id=self.repo_id, distributor_id=self.distributor_id)
            return dist.last_publish
        except Exception, e:
            _logger.exception('Error getting last publish time for repo [%s]' % self.repo_id)
            raise DistributorConduitException(e), None, sys.exc_info()[2]
예제 #4
0
    def last_publish(self):
        """
        Returns the timestamp of the last time this repo was published, regardless of the success
        or failure of the publish. If the repo was never published, this call returns None.

        :return: timestamp instance describing the last publish
        :rtype:  datetime.datetime or None

        :raises DistributorConduitException: if any errors occur
        """
        try:
            collection = RepoDistributor.get_collection()
            distributor = collection.find_one({
                'repo_id': self.repo_id,
                'id': self.distributor_id
            })
            if distributor is None:
                raise pulp_exceptions.MissingResource(self.repo_id)
            return distributor['last_publish']
        except Exception, e:
            _logger.exception('Error getting last publish time for repo [%s]' %
                              self.repo_id)
            raise DistributorConduitException(e), None, sys.exc_info()[2]