diff --git a/awx/api/serializers.py b/awx/api/serializers.py index 347ef1c078..fcdde9e512 100644 --- a/awx/api/serializers.py +++ b/awx/api/serializers.py @@ -2811,10 +2811,6 @@ class JobRelaunchSerializer(BaseSerializer): def validate(self, attrs): obj = self.context.get('obj') - if not obj.credential and not obj.vault_credential: - raise serializers.ValidationError( - dict(credential=[_("Neither credential nor vault credential provided.")]) - ) if obj.project is None: raise serializers.ValidationError(dict(errors=[_("Job Template Project is missing or undefined.")])) if obj.inventory is None or obj.inventory.pending_deletion: diff --git a/awx/main/tests/functional/api/test_job.py b/awx/main/tests/functional/api/test_job.py index ace3771eb4..be87de1870 100644 --- a/awx/main/tests/functional/api/test_job.py +++ b/awx/main/tests/functional/api/test_job.py @@ -39,6 +39,21 @@ def test_job_relaunch_permission_denied_response( assert 'do not have permission' in r.data['detail'] +@pytest.mark.django_db +def test_job_relaunch_without_creds(post, inventory, project, admin_user): + jt = JobTemplate.objects.create( + name='testjt', inventory=inventory, + project=project + ) + job = jt.create_unified_job() + post( + url=reverse('api:job_relaunch', kwargs={'pk':job.pk}), + data={}, + user=admin_user, + expect=201 + ) + + @pytest.mark.django_db @pytest.mark.parametrize("status,hosts", [ ('all', 'host1,host2,host3'),