Skip to content

Commit

Permalink
fix(api): yaml breaklines (#2781)
Browse files Browse the repository at this point in the history
  • Loading branch information
shahargl authored Dec 9, 2024
1 parent 81b3447 commit 35fb897
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion keep/api/models/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def manipulate_raw(cls, raw, values):
ordered_raw["steps"] = d.get("steps")
# last, actions
ordered_raw["actions"] = d.get("actions")
return yaml.dump(ordered_raw)
return yaml.dump(ordered_raw, width=99999)


class WorkflowExecutionLogsDTO(BaseModel):
Expand Down
4 changes: 2 additions & 2 deletions keep/api/routes/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ async def update_workflow_by_id(
workflow["name"] = workflow_from_db.name
workflow_from_db.description = workflow.get("description")
workflow_from_db.interval = workflow_interval
workflow_from_db.workflow_raw = yaml.dump(workflow)
workflow_from_db.workflow_raw = yaml.dump(workflow, width=99999)
workflow_from_db.last_updated = datetime.datetime.now()
session.add(workflow_from_db)
session.commit()
Expand Down Expand Up @@ -518,7 +518,7 @@ def get_workflow_by_id(
try:
workflow_yaml = yaml.safe_load(workflow.workflow_raw)
valid_workflow_yaml = {"workflow": workflow_yaml}
final_workflow_raw = yaml.dump(valid_workflow_yaml)
final_workflow_raw = yaml.dump(valid_workflow_yaml, width=99999)
workflow_dto = WorkflowDTO(
id=workflow.id,
name=workflow.name,
Expand Down
6 changes: 3 additions & 3 deletions keep/workflowmanager/workflowstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def create_workflow(self, tenant_id: str, created_by, workflow: dict):
created_by=created_by,
interval=interval,
is_disabled=Parser.parse_disabled(workflow),
workflow_raw=yaml.dump(workflow),
workflow_raw=yaml.dump(workflow, width=99999),
)
self.logger.info(f"Workflow {workflow_id} created successfully")
return workflow
Expand Down Expand Up @@ -102,7 +102,7 @@ def get_raw_workflow(self, tenant_id: str, workflow_id: str) -> str:
raw_workflow = get_raw_workflow(tenant_id, workflow_id)
workflow_yaml = yaml.safe_load(raw_workflow)
valid_workflow_yaml = {"workflow": workflow_yaml}
return yaml.dump(valid_workflow_yaml)
return yaml.dump(valid_workflow_yaml, width=99999)

def get_workflow(self, tenant_id: str, workflow_id: str) -> Workflow:
workflow = get_raw_workflow(tenant_id, workflow_id)
Expand Down Expand Up @@ -317,7 +317,7 @@ def provision_workflows_from_directory(
created_by="system",
interval=workflow_interval,
is_disabled=workflow_disabled,
workflow_raw=yaml.dump(workflow_yaml),
workflow_raw=yaml.dump(workflow_yaml, width=99999),
provisioned=True,
provisioned_file=workflow_path,
)
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.31.2"
version = "0.31.3"
description = "Alerting. for developers, by developers."
authors = ["Keep Alerting LTD"]
packages = [{include = "keep"}]
Expand Down

0 comments on commit 35fb897

Please sign in to comment.