JT param everything (#12646)

* Making almost all fields promptable on job templates and config models
* Adding EE, IG and label access checks
* Changing jobs preferred instance group function to handle the new IG cache field
* Adding new ask fields to job template modules
* Address unit/functional tests
* Adding migration file
This commit is contained in:
John Westcott IV
2022-08-16 12:24:02 -04:00
committed by Alan Rominger
parent 04d0e3915c
commit 33c0fb79d6
20 changed files with 781 additions and 38 deletions

View File

@@ -531,6 +531,12 @@ def copy_m2m_relationships(obj1, obj2, fields, kwargs=None):
src_field_value = getattr(obj1, field_name)
if kwargs and field_name in kwargs:
override_field_val = kwargs[field_name]
# TODO: Should we spike this our or just put the for loop inside the next if and make everything respect order?
if field_name == 'instance_groups':
# instance_groups are a list but we need to preserve the order
for ig_id in override_field_val:
getattr(obj2, field_name).add(ig_id)
continue
if isinstance(override_field_val, (set, list, QuerySet)):
getattr(obj2, field_name).add(*override_field_val)
continue