Skip to content

Commit

Permalink
Merge branch 'feature/1968-topology-applications' of github.com:keeph…
Browse files Browse the repository at this point in the history
…q/keep into feature/1968-topology-applications
  • Loading branch information
Kiryous committed Sep 26, 2024
2 parents 53bb99b + 4695709 commit 4ada842
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
8 changes: 4 additions & 4 deletions keep/api/models/db/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ class MappingRuleDtoOut(MappRuleDtoBase, extra="ignore"):
class MappingRuleDtoIn(MappRuleDtoBase):
rows: Optional[list[dict]] = None

@validator("type", pre=True, always=True)
def validate_type(cls, _type, values):
if _type == "csv" and not values.get("rows"):
@validator("rows", pre=True, always=True)
def validate_rows(cls, rows, values):
if not rows and values.get("type") == "csv":
raise ValueError("Mapping of type CSV cannot have empty rows")
return _type
return rows
19 changes: 18 additions & 1 deletion keep/providers/zabbix_provider/zabbix_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,26 @@ def __send_request(self, method: str, params: dict = None):

response = requests.post(url, json=data, headers=headers)

response.raise_for_status()
try:
response.raise_for_status()
except requests.HTTPError:
self.logger.exception(
"Error while sending request to Zabbix API",
extra={
"response": response.text,
"tenant_id": self.context_manager.tenant_id,
},
)
raise
response_json = response.json()
if "error" in response_json:
self.logger.error(
"Error while querying zabbix",
extra={
"tenant_id": self.context_manager.tenant_id,
"response_json": response_json,
},
)
raise ProviderMethodException(response_json.get("error", {}).get("data"))
return response_json

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "keep"
version = "0.24.5"
version = "0.25.0"
description = "Alerting. for developers, by developers."
authors = ["Keep Alerting LTD"]
readme = "README.md"
Expand Down

0 comments on commit 4ada842

Please sign in to comment.