mirror of
https://github.com/ansible/awx.git
synced 2026-03-04 02:01:01 -03:30
removed system job code that handles extra_vars in favor using common (unified job) code alread in use by normal jobs
This commit is contained in:
@@ -1732,19 +1732,9 @@ class SystemJobTemplateLaunch(GenericAPIView):
|
|||||||
obj = self.get_object()
|
obj = self.get_object()
|
||||||
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()
|
|
||||||
if 'extra_vars' in request.DATA:
|
new_job = obj.create_unified_job(**request.DATA)
|
||||||
try:
|
result = new_job.signal_start(**request.DATA)
|
||||||
if type(request.DATA['extra_vars']) == dict:
|
|
||||||
extra_vars = request.DATA['extra_vars']
|
|
||||||
else:
|
|
||||||
extra_vars = json.loads(request.DATA['extra_vars'])
|
|
||||||
except Exception, e:
|
|
||||||
extra_vars = {}
|
|
||||||
else:
|
|
||||||
extra_vars = {}
|
|
||||||
ev = {'extra_vars': extra_vars}
|
|
||||||
result = new_job.signal_start(**ev)
|
|
||||||
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)
|
||||||
|
|
||||||
|
|||||||
@@ -994,25 +994,6 @@ class SystemJob(UnifiedJob, SystemJobOptions):
|
|||||||
from awx.main.tasks import RunSystemJob
|
from awx.main.tasks import RunSystemJob
|
||||||
return RunSystemJob
|
return RunSystemJob
|
||||||
|
|
||||||
def handle_extra_data(self, extra_data):
|
|
||||||
if extra_data == "" or extra_data is None:
|
|
||||||
return
|
|
||||||
try:
|
|
||||||
evars = json.loads(self.extra_vars)
|
|
||||||
except Exception, e:
|
|
||||||
evars = {}
|
|
||||||
if type(extra_data) == str:
|
|
||||||
try:
|
|
||||||
extra_data = json.loads(extra_data)
|
|
||||||
except Exception, e:
|
|
||||||
extra_data = {}
|
|
||||||
if evars is None:
|
|
||||||
evars = extra_data
|
|
||||||
else:
|
|
||||||
evars.update(extra_data)
|
|
||||||
self.update_fields(extra_vars=json.dumps(evars))
|
|
||||||
|
|
||||||
|
|
||||||
def socketio_emit_data(self):
|
def socketio_emit_data(self):
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user