mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 10:00:01 -03:30
force kind to readonly field and set kind to constructed in create
This commit is contained in:
parent
3e5467b472
commit
aa06940df5
@ -1785,6 +1785,7 @@ class ConstructedInventorySerializer(InventorySerializer):
|
||||
class Meta:
|
||||
model = Inventory
|
||||
fields = ('*', '-host_filter', 'source_vars', 'update_cache_timeout', 'limit', 'verbosity')
|
||||
read_only_fields = ('*', 'kind')
|
||||
|
||||
def pop_inv_src_data(self, data):
|
||||
inv_src_data = {}
|
||||
@ -1808,6 +1809,7 @@ class ConstructedInventorySerializer(InventorySerializer):
|
||||
inv_src.save(update_fields=update_fields)
|
||||
|
||||
def create(self, validated_data):
|
||||
validated_data['kind'] = 'constructed'
|
||||
inv_src_data = self.pop_inv_src_data(validated_data)
|
||||
inventory = super().create(validated_data)
|
||||
self.apply_inv_src_data(inventory, inv_src_data)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user