diff --git a/apps/assets/const/host.py b/apps/assets/const/host.py index 97233e284..0a5ff60da 100644 --- a/apps/assets/const/host.py +++ b/apps/assets/const/host.py @@ -71,7 +71,7 @@ class HostTypes(BaseType): {'name': 'Linux'}, { 'name': GATEWAY_NAME, - 'domain_enabled': False, + 'domain_enabled': True, } ], cls.UNIX: [ diff --git a/apps/assets/serializers/domain.py b/apps/assets/serializers/domain.py index 33dcffbe1..74eb1117a 100644 --- a/apps/assets/serializers/domain.py +++ b/apps/assets/serializers/domain.py @@ -34,6 +34,13 @@ class DomainSerializer(BulkOrgResourceModelSerializer): data['assets'] = [i for i in assets if str(i['id']) not in gateway_ids] return data + def update(self, instance, validated_data): + assets = validated_data.pop('assets', []) + assets = assets + list(instance.gateways) + validated_data['assets'] = assets + instance = super().update(instance, validated_data) + return instance + class DomainWithGatewaySerializer(serializers.ModelSerializer): gateways = GatewayWithAccountSecretSerializer(many=True, read_only=True)