Blocks creation of Hosts, Groups, and IS for Smart Inventories

* Updated View unit tests

* Refactored Validators

* Validator Fix for Blocking
This commit is contained in:
adamscmRH
2017-07-24 11:52:37 -04:00
parent 6856c77a8e
commit 3dcd6ef2c2
6 changed files with 75 additions and 5 deletions

View File

@@ -2480,6 +2480,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,
@@ -2492,6 +2494,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