diff --git a/awx/main/models/jobs.py b/awx/main/models/jobs.py index 6e5bdf3a28..774f4a4d4a 100644 --- a/awx/main/models/jobs.py +++ b/awx/main/models/jobs.py @@ -444,6 +444,11 @@ class Job(UnifiedJob, JobOptions): dependencies.append(source.create_inventory_update(launch_type='dependency')) return dependencies + def handle_extra_data(self, extra_data): + evars = json.loads(self.extra_vars) + evars.update(extra_data) + self.update_fields(extra_vars=json.dumps(evars)) + def copy(self): presets = {} for kw in self.job_template._get_unified_job_field_names(): diff --git a/awx/main/models/unified_jobs.py b/awx/main/models/unified_jobs.py index 29b9e8839c..2a6220b9fd 100644 --- a/awx/main/models/unified_jobs.py +++ b/awx/main/models/unified_jobs.py @@ -567,6 +567,9 @@ class UnifiedJob(PolymorphicModel, PasswordFieldsModel, CommonModelNameNotUnique def get_passwords_needed_to_start(self): return [] + def handle_extra_data(self, extra_data): + return + @property def can_start(self): return bool(self.status in ('new', 'waiting')) @@ -631,6 +634,8 @@ class UnifiedJob(PolymorphicModel, PasswordFieldsModel, CommonModelNameNotUnique opts = dict([(field, kwargs.get(field, '')) for field in needed]) if not all(opts.values()): return False + extra_data = dict([(field, kwargs[field]) for field in kwargs if field not in needed]) + self.handle_extra_data(extra_data) self.update_fields(start_args=json.dumps(kwargs), status='pending') self.socketio_emit_status("pending") task_type = get_type_for_model(self)