1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 15:21:13 +03:00

Fix up direct launching of system jobs

This commit is contained in:
Matthew Jones 2014-11-18 11:38:24 -05:00
parent a40120d1cf
commit fb8d7e5d9c
2 changed files with 9 additions and 2 deletions

View File

@ -1755,7 +1755,14 @@ class SystemJobTemplateLaunch(GenericAPIView):
if not request.user.can_access(self.model, 'start', obj):
raise PermissionDenied()
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)
return Response(data, status=status.HTTP_202_ACCEPTED)

View File

@ -1168,7 +1168,7 @@ class RunSystemJob(BaseTask):
if 'inventory_updates' in json_vars and json_vars['inventory_updates']:
args.extend(['--inventory-updates'])
except Exception, e:
pass
logger.error("Failed to parse system job: " + str(e))
return args
def build_cwd(self, instance, **kwargs):