mirror of
https://github.com/ansible/awx.git
synced 2026-03-06 19:21:06 -03:30
Always use controlplane as project update backup IG (#10949)
* Always use controlplane as project update backup IG Before, this was done conditionally to container_group jobs this logic changes it so that controlgroup will always be a firm backstop for project updates * Code a little more defensively to make unit tests pass * Fix unit tests
This commit is contained in:
@@ -615,16 +615,22 @@ class ProjectUpdate(UnifiedJob, ProjectOptions, JobNotificationMixin, TaskManage
|
||||
|
||||
@property
|
||||
def preferred_instance_groups(self):
|
||||
'''
|
||||
Project updates should pretty much always run on the control plane
|
||||
however, we are not yet saying no to custom groupings within the control plane
|
||||
Thus, we return custom groups and then unconditionally add the control plane
|
||||
'''
|
||||
if self.organization is not None:
|
||||
organization_groups = [x for x in self.organization.instance_groups.all()]
|
||||
else:
|
||||
organization_groups = []
|
||||
template_groups = [x for x in super(ProjectUpdate, self).preferred_instance_groups]
|
||||
selected_groups = template_groups + organization_groups
|
||||
if not any([not group.is_container_group for group in selected_groups]):
|
||||
selected_groups = selected_groups + list(self.control_plane_instance_group)
|
||||
if not selected_groups:
|
||||
return self.global_instance_groups
|
||||
|
||||
controlplane_ig = self.control_plane_instance_group
|
||||
if controlplane_ig and controlplane_ig[0] and controlplane_ig[0] not in selected_groups:
|
||||
selected_groups += controlplane_ig
|
||||
|
||||
return selected_groups
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user