Merge pull request #82 from rooftopcellist/smart_inventory

Blocks creation of Hosts, Groups, and IS for Smart Inventories
This commit is contained in:
Christian Adams
2017-07-28 16:33:50 -04:00
committed by GitHub
6 changed files with 75 additions and 5 deletions

View File

@@ -2493,6 +2493,8 @@ class InventoryInventorySourcesUpdate(RetrieveAPIView):
def retrieve(self, request, *args, **kwargs):
inventory = self.get_object()
if inventory.kind =='smart':
return Response(dict(error=_("Smart Inventories cannot host dynamic inventory sources.")), status=status.HTTP_400_BAD_REQUEST)
update_data = []
for inventory_source in inventory.inventory_sources.exclude(source=''):
details = {'inventory_source': inventory_source.pk,
@@ -2505,6 +2507,8 @@ class InventoryInventorySourcesUpdate(RetrieveAPIView):
update_data = []
successes = 0
failures = 0
if inventory.kind =='smart':
return Response(dict(error=_("Action cannot be completed with Smart Inventory.")), status=status.HTTP_400_BAD_REQUEST)
for inventory_source in inventory.inventory_sources.exclude(source=''):
details = {'inventory_source': inventory_source.pk, 'status': None}
can_update = inventory_source.can_update