mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 10:00: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:
parent
7e822c34d5
commit
51a7d403db
@ -1732,19 +1732,9 @@ class SystemJobTemplateLaunch(GenericAPIView):
|
||||
obj = self.get_object()
|
||||
if not request.user.can_access(self.model, 'start', obj):
|
||||
raise PermissionDenied()
|
||||
new_job = obj.create_unified_job()
|
||||
if 'extra_vars' in request.DATA:
|
||||
try:
|
||||
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)
|
||||
|
||||
new_job = obj.create_unified_job(**request.DATA)
|
||||
result = new_job.signal_start(**request.DATA)
|
||||
data = dict(system_job=new_job.id)
|
||||
return Response(data, status=status.HTTP_202_ACCEPTED)
|
||||
|
||||
|
||||
@ -994,25 +994,6 @@ class SystemJob(UnifiedJob, SystemJobOptions):
|
||||
from awx.main.tasks import 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):
|
||||
return {}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user