diff --git a/apps/ops/api/playbook.py b/apps/ops/api/playbook.py index d848e029c..9d74aa565 100644 --- a/apps/ops/api/playbook.py +++ b/apps/ops/api/playbook.py @@ -4,6 +4,7 @@ import zipfile from django.conf import settings from django.shortcuts import get_object_or_404 +from django.utils.translation import ugettext_lazy as _ from rest_framework import status from common.exceptions import JMSException @@ -12,7 +13,6 @@ from rbac.permissions import RBACPermission from ..exception import PlaybookNoValidEntry from ..models import Playbook from ..serializers.playbook import PlaybookSerializer -from django.utils.translation import ugettext_lazy as _ __all__ = ["PlaybookViewSet", "PlaybookFileBrowserAPIView"] @@ -33,7 +33,6 @@ class PlaybookViewSet(OrgBulkModelViewSet): search_fields = ('name', 'comment') def perform_destroy(self, instance): - instance = self.get_object() if instance.job_set.exists(): raise JMSException(code='playbook_has_job', detail={"msg": _("Currently playbook is being used in a job")}) instance_id = instance.id