Skip to content

Commit

Permalink
feat: added function check_collections_hosts for Collections
Browse files Browse the repository at this point in the history
  • Loading branch information
SteBaum committed Aug 2, 2024
1 parent 1e5daa0 commit 321f838
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tdp/core/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from tdp.core.collection import Collection
from tdp.core.entities.hostable_entity_name import ServiceComponentName
from tdp.core.entities.operation import Operations
from tdp.core.inventory_reader import InventoryReader
from tdp.core.operation import Operation
from tdp.core.variables.schema.service_schema import ServiceSchema

Expand Down Expand Up @@ -242,3 +243,13 @@ def get_components_from_service(
if operation.service_name == service_name
and not operation.is_service_operation()
}

def check_collections_hosts(self):
"""Checks if hosts has not been removed from the inventory.ini file"""
inventory = InventoryReader().inventory
inventory.refresh_inventory()

inventory_list = [str(name) for name in inventory.get_hosts()]
for host in self.get_collections_hosts():
if host not in inventory_list:
return host

0 comments on commit 321f838

Please sign in to comment.