mirror of
https://github.com/ansible/awx.git
synced 2026-03-07 19:51:08 -03:30
Fix up direct launching of system jobs
This commit is contained in:
@@ -1755,7 +1755,14 @@ class SystemJobTemplateLaunch(GenericAPIView):
|
|||||||
if not request.user.can_access(self.model, 'start', obj):
|
if not request.user.can_access(self.model, 'start', obj):
|
||||||
raise PermissionDenied()
|
raise PermissionDenied()
|
||||||
new_job = obj.create_unified_job()
|
new_job = obj.create_unified_job()
|
||||||
result = new_job.signal_start()
|
if 'extra_vars' in request.DATA:
|
||||||
|
try:
|
||||||
|
extra_vars = json.loads(request.DATA['extra_vars'])
|
||||||
|
except Exception:
|
||||||
|
extra_vars = {}
|
||||||
|
else:
|
||||||
|
extra_vars = {}
|
||||||
|
result = new_job.signal_start(**extra_vars)
|
||||||
data = dict(system_job=new_job.id)
|
data = dict(system_job=new_job.id)
|
||||||
return Response(data, status=status.HTTP_202_ACCEPTED)
|
return Response(data, status=status.HTTP_202_ACCEPTED)
|
||||||
|
|
||||||
|
|||||||
@@ -1168,7 +1168,7 @@ class RunSystemJob(BaseTask):
|
|||||||
if 'inventory_updates' in json_vars and json_vars['inventory_updates']:
|
if 'inventory_updates' in json_vars and json_vars['inventory_updates']:
|
||||||
args.extend(['--inventory-updates'])
|
args.extend(['--inventory-updates'])
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
pass
|
logger.error("Failed to parse system job: " + str(e))
|
||||||
return args
|
return args
|
||||||
|
|
||||||
def build_cwd(self, instance, **kwargs):
|
def build_cwd(self, instance, **kwargs):
|
||||||
|
|||||||
Reference in New Issue
Block a user