AC-601 Add groups/hosts collections to inventory sources, add inventory sources collections to groups/hosts to indicate which inventory source(s) have created/updated the given groups/hosts. Prevent setting an explicit inventory source for a group that is being managed by another parent with cloud inventory source.

This commit is contained in:
Chris Church
2014-03-31 19:26:03 -04:00
parent d7f31f9777
commit 008ec8f86e
5 changed files with 82 additions and 9 deletions

View File

@@ -722,6 +722,14 @@ class HostAllGroupsList(SubListAPIView):
sublist_qs = parent.all_groups.distinct()
return qs & sublist_qs
class HostInventorySourcesList(SubListAPIView):
model = InventorySource
serializer_class = InventorySourceSerializer
parent_model = Host
relationship = 'inventory_sources'
new_in_148 = True
class HostActivityStreamList(SubListAPIView):
model = ActivityStream
@@ -815,6 +823,14 @@ class GroupAllHostsList(SubListAPIView):
sublist_qs = parent.all_hosts.distinct()
return qs & sublist_qs
class GroupInventorySourcesList(SubListAPIView):
model = InventorySource
serializer_class = InventorySourceSerializer
parent_model = Group
relationship = 'inventory_sources'
new_in_148 = True
class GroupActivityStreamList(SubListAPIView):
model = ActivityStream
@@ -980,7 +996,6 @@ class InventorySourceDetail(RetrieveUpdateAPIView):
serializer_class = InventorySourceSerializer
new_in_14 = True
class InventorySourceSchedulesList(SubListCreateAPIView):
view_name = "Inventory Source Schedules"
@@ -1000,6 +1015,22 @@ class InventorySourceActivityStreamList(SubListAPIView):
relationship = 'activitystream_set'
new_in_145 = True
class InventorySourceHostsList(SubListAPIView):
model = Host
serializer_class = HostSerializer
parent_model = InventorySource
relationship = 'hosts'
new_in_148 = True
class InventorySourceGroupsList(SubListAPIView):
model = Group
serializer_class = GroupSerializer
parent_model = InventorySource
relationship = 'groups'
new_in_148 = True
class InventorySourceUpdatesList(SubListAPIView):
model = InventoryUpdate