Esempio n. 1
0
File: cud.py Progetto: beav/pulp
    def delete_repo_group(group_id):
        """
        Delete a repo group.
        @param group_id: unique id of the repo group to delete
        @type group_id: str
        """
        collection = validate_existing_repo_group(group_id)

        # Delete all distributors on the group
        distributors = RepoGroupDistributorManager.find_distributors(group_id)
        for distributor in distributors:
            RepoGroupDistributorManager.remove_distributor(group_id, distributor['id'])

        # Delete the working directory for the group
        working_dir = common_utils.repo_group_working_dir(group_id)
        if os.path.exists(working_dir):
            try:
                shutil.rmtree(working_dir)
            except Exception:
                msg = _('Error while deleting working dir [%(d)s] for repo group [%(g)s]')
                msg = msg % {'d': working_dir, 'g': group_id}
                _logger.exception(msg)
                raise

        # Delete from the database
        collection.remove({'id': group_id}, safe=True)
Esempio n. 2
0
File: cud.py Progetto: nbetm/pulp
    def delete_repo_group(group_id):
        """
        Delete a repo group.
        @param group_id: unique id of the repo group to delete
        @type group_id: str
        """
        collection = validate_existing_repo_group(group_id)

        # Delete all distributors on the group
        distributors = RepoGroupDistributorManager.find_distributors(group_id)
        for distributor in distributors:
            RepoGroupDistributorManager.remove_distributor(group_id, distributor["id"])

        # Delete from the database
        collection.remove({"id": group_id}, safe=True)
Esempio n. 3
0
    def delete_repo_group(group_id):
        """
        Delete a repo group.
        @param group_id: unique id of the repo group to delete
        @type group_id: str
        """
        collection = validate_existing_repo_group(group_id)

        # Delete all distributors on the group
        distributors = RepoGroupDistributorManager.find_distributors(group_id)
        for distributor in distributors:
            RepoGroupDistributorManager.remove_distributor(group_id, distributor['id'])

        # Delete from the database
        collection.remove({'id': group_id})
Esempio n. 4
0
    def delete_repo_group(group_id):
        """
        Delete a repo group.
        @param group_id: unique id of the repo group to delete
        @type group_id: str
        """
        collection = validate_existing_repo_group(group_id)

        # Delete all distributors on the group
        distributors = RepoGroupDistributorManager.find_distributors(group_id)
        for distributor in distributors:
            RepoGroupDistributorManager.remove_distributor(group_id, distributor['id'])

        # Delete the working directory for the group
        working_dir = common_utils.repo_group_working_dir(group_id)
        if os.path.exists(working_dir):
            try:
                shutil.rmtree(working_dir)
            except Exception:
                logger.exception('Error while deleting working dir [%s] for repo group [%s]' % (working_dir, group_id))
                raise

        # Delete from the database
        collection.remove({'id': group_id}, safe=True)