Exemplo n.º 1
0
Arquivo: apps.py Projeto: buxx/PyCrane
 def find_by_host(self, host: Host) -> List[Instance]:
     """
     :param host: host instance filter
     :return: list of instances
     """
     return [Instance.from_dict(data) for data in self._database.search(self._instances.host == host.get_name())]
Exemplo n.º 2
0
Arquivo: apps.py Projeto: buxx/PyCrane
 def find_one_by_name(self, name: str) -> Instance:
     search_results = self._database.search(self._instances.name == name)
     if not search_results:
         raise NotFound('No instance with name "{0}"'.format(name))
     return Instance.from_dict(search_results.pop())
Exemplo n.º 3
0
Arquivo: apps.py Projeto: buxx/PyCrane
 def get_all(self) -> list:
     return [Instance.from_dict(instance_data) for instance_data in self._database.all()]