Exemplo n.º 1
0
 def get_field(self, name) -> dict:
     field = [x for x in self.fields if x['name'] == name]
     if field:
         try:
             return field[0]
         except (RequiredInitKeyNotFoundError, CMDBError) as e:
             LOGGER.warning(e.message)
             raise FieldInitError(name)
     raise FieldNotFoundError(name, self.name)
Exemplo n.º 2
0
 def get_fields_of_type_with_value(self, input_type: str, _filter: str, value) -> list:
     fields = [x for x in self.fields if x['type'] == input_type and x.get(_filter, None) == value]
     if fields:
         try:
             return fields
         except (RequiredInitKeyNotFoundError, CMDBError) as e:
             raise FieldInitError(value)
     else:
         raise FieldNotFoundError(value, self.get_name())