mirror of
https://github.com/ansible/awx.git
synced 2026-05-11 11:27:36 -02:30
generate passwords in validate and pass back through context
This commit is contained in:
@@ -1448,7 +1448,8 @@ class JobTemplateLaunch(RetrieveAPIView, GenericAPIView):
|
||||
if 'credential' not in request.DATA and 'credential_id' in request.DATA:
|
||||
request.DATA['credential'] = request.DATA['credential_id']
|
||||
|
||||
serializer = self.serializer_class(data=request.DATA, context={'obj': obj})
|
||||
passwords = {}
|
||||
serializer = self.serializer_class(data=request.DATA, context={'obj': obj, 'data': request.DATA, 'passwords': passwords})
|
||||
if not serializer.is_valid():
|
||||
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
@@ -1456,6 +1457,8 @@ class JobTemplateLaunch(RetrieveAPIView, GenericAPIView):
|
||||
'credential': serializer.object.credential.pk,
|
||||
'extra_vars': serializer.object.extra_vars
|
||||
}
|
||||
kv.update(passwords)
|
||||
|
||||
new_job = obj.create_unified_job(**kv)
|
||||
result = new_job.signal_start(**kv)
|
||||
if not result:
|
||||
|
||||
Reference in New Issue
Block a user