mirror of
https://github.com/ansible/awx.git
synced 2026-05-18 06:47:41 -02:30
@@ -357,9 +357,9 @@ def handle_work_success(self, result, task_actual):
|
|||||||
run_job_complete.delay(instance.id)
|
run_job_complete.delay(instance.id)
|
||||||
|
|
||||||
|
|
||||||
@shared_task(bind=True, queue='tower', base=LogErrorsTask)
|
@shared_task(queue='tower', base=LogErrorsTask)
|
||||||
def handle_work_error(self, task_id, subtasks=None):
|
def handle_work_error(request, exc, traceback, task_id, subtasks=None):
|
||||||
logger.debug('Executing error task id %s, subtasks: %s' % (str(self.request.id), str(subtasks)))
|
logger.debug('Executing error task id %s, subtasks: %s' % (request.id, str(subtasks)))
|
||||||
first_instance = None
|
first_instance = None
|
||||||
first_instance_type = ''
|
first_instance_type = ''
|
||||||
if subtasks is not None:
|
if subtasks is not None:
|
||||||
@@ -678,11 +678,12 @@ class BaseTask(LogErrorsTask):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def build_inventory(self, instance, **kwargs):
|
def build_inventory(self, instance, **kwargs):
|
||||||
path = os.path.join(kwargs['private_data_dir'], 'inventory')
|
json_data = json.dumps(instance.inventory.get_script_data(hostvars=True))
|
||||||
with open(path, 'w') as f:
|
handle, path = tempfile.mkstemp(dir=kwargs.get('private_data_dir', None))
|
||||||
json_data = json.dumps(instance.inventory.get_script_data(hostvars=True))
|
f = os.fdopen(handle, 'w')
|
||||||
f.write('#! /usr/bin/env python\n# -*- coding: utf-8 -*-\nprint %r\n' % json_data)
|
f.write('#! /usr/bin/env python\n# -*- coding: utf-8 -*-\nprint %r\n' % json_data)
|
||||||
os.chmod(path, stat.S_IRUSR | stat.S_IXUSR)
|
f.close()
|
||||||
|
os.chmod(path, stat.S_IRUSR | stat.S_IXUSR | stat.S_IWUSR)
|
||||||
return path
|
return path
|
||||||
|
|
||||||
def build_args(self, instance, **kwargs):
|
def build_args(self, instance, **kwargs):
|
||||||
|
|||||||
Reference in New Issue
Block a user