mirror of
https://github.com/ansible/awx.git
synced 2026-02-22 21:46:00 -03:30
Disallow deleting controller or isolated instance groups
Added two new properties to the InstanceGroup model - `is_controller` and `is_isolated`. Used these properties to hide the trash icon for instance groups that are either controller or isolated. Signed-off-by: Vismay Golwala <vgolwala@redhat.com>
This commit is contained in:
@@ -4881,6 +4881,15 @@ class InstanceGroupSerializer(BaseSerializer):
|
||||
read_only=True
|
||||
)
|
||||
instances = serializers.SerializerMethodField()
|
||||
is_controller = serializers.BooleanField(
|
||||
help_text=_('Indicates whether instance group controls any other group'),
|
||||
read_only=True
|
||||
)
|
||||
is_isolated = serializers.BooleanField(
|
||||
help_text=_('Indicates whether instances in this group are isolated.'
|
||||
'Isolated groups have a designated controller group.'),
|
||||
read_only=True
|
||||
)
|
||||
# NOTE: help_text is duplicated from field definitions, no obvious way of
|
||||
# both defining field details here and also getting the field's help_text
|
||||
policy_instance_percentage = serializers.IntegerField(
|
||||
@@ -4906,7 +4915,7 @@ class InstanceGroupSerializer(BaseSerializer):
|
||||
fields = ("id", "type", "url", "related", "name", "created", "modified",
|
||||
"capacity", "committed_capacity", "consumed_capacity",
|
||||
"percent_capacity_remaining", "jobs_running", "jobs_total",
|
||||
"instances", "controller",
|
||||
"instances", "controller", "is_controller", "is_isolated",
|
||||
"policy_instance_percentage", "policy_instance_minimum", "policy_instance_list")
|
||||
|
||||
def get_related(self, obj):
|
||||
|
||||
Reference in New Issue
Block a user