mirror of
https://github.com/ansible/awx.git
synced 2026-01-18 21:21:21 -03:30
Merge pull request #1292 from ryanpetrello/fix-1291
don't require credentials to relaunch a job
This commit is contained in:
commit
90bb43ce74
@ -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:
|
||||
|
||||
@ -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'),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user