mirror of
https://github.com/ZwareBear/awx.git
synced 2026-03-26 18:53:35 -05:00
remove facts_latest in favor of ansible_facts
* Closer align our facts data structure with ansible facts data structure for purposes of ... wait for it ... 2-way fact caching
This commit is contained in:
@@ -1157,7 +1157,7 @@ class HostSerializer(BaseSerializerWithVariables):
|
||||
ad_hoc_commands = self.reverse('api:host_ad_hoc_commands_list', kwargs={'pk': obj.pk}),
|
||||
ad_hoc_command_events = self.reverse('api:host_ad_hoc_command_events_list', kwargs={'pk': obj.pk}),
|
||||
fact_versions = self.reverse('api:host_fact_versions_list', kwargs={'pk': obj.pk}),
|
||||
facts_latest = self.reverse('api:host_facts_latest_list', kwargs={'pk': obj.pk}),
|
||||
ansible_facts = self.reverse('api:host_ansible_facts_detail', kwargs={'pk': obj.pk}),
|
||||
))
|
||||
if obj.inventory:
|
||||
res['inventory'] = self.reverse('api:inventory_detail', kwargs={'pk': obj.inventory.pk})
|
||||
@@ -1237,6 +1237,14 @@ class HostSerializer(BaseSerializerWithVariables):
|
||||
return ret
|
||||
|
||||
|
||||
class AnsibleFactsSerializer(BaseSerializer):
|
||||
class Meta:
|
||||
model = Host
|
||||
|
||||
def to_representation(self, obj):
|
||||
return obj.ansible_facts
|
||||
|
||||
|
||||
class GroupSerializer(BaseSerializerWithVariables):
|
||||
inventory_source = serializers.SerializerMethodField(
|
||||
help_text=_('Dedicated inventory source for the group, will be removed in 3.3.'))
|
||||
|
||||
@@ -114,7 +114,7 @@ host_urls = patterns('awx.api.views',
|
||||
#url(r'^(?P<pk>[0-9]+)/single_fact/$', 'host_single_fact_view'),
|
||||
url(r'^(?P<pk>[0-9]+)/fact_versions/$', 'host_fact_versions_list'),
|
||||
url(r'^(?P<pk>[0-9]+)/fact_view/$', 'host_fact_compare_view'),
|
||||
url(r'^(?P<pk>[0-9]+)/facts_latest/$', 'host_facts_latest_list'),
|
||||
url(r'^(?P<pk>[0-9]+)/ansible_facts/$', 'host_ansible_facts_detail'),
|
||||
)
|
||||
|
||||
group_urls = patterns('awx.api.views',
|
||||
|
||||
@@ -1725,6 +1725,13 @@ class HostDetail(RetrieveUpdateDestroyAPIView):
|
||||
serializer_class = HostSerializer
|
||||
|
||||
|
||||
class HostAnsibleFactsDetail(RetrieveAPIView):
|
||||
|
||||
model = Host
|
||||
serializer_class = AnsibleFactsSerializer
|
||||
new_in_320 = True
|
||||
|
||||
|
||||
class InventoryHostsList(SubListCreateAttachDetachAPIView):
|
||||
|
||||
model = Host
|
||||
@@ -1842,15 +1849,6 @@ class HostFactCompareView(SystemTrackingEnforcementMixin, SubDetailAPIView):
|
||||
return Response(self.serializer_class(instance=fact_entry).data)
|
||||
|
||||
|
||||
class HostFactsLatestList(SubListAPIView):
|
||||
|
||||
model = FactLatest
|
||||
parent_model = Host
|
||||
relationship = 'facts_latest'
|
||||
serializer_class = FactSerializer
|
||||
new_in_320 = True
|
||||
|
||||
|
||||
class GroupList(ListCreateAPIView):
|
||||
|
||||
model = Group
|
||||
|
||||
Reference in New Issue
Block a user