Skip to content

Commit

Permalink
fix: conditionally include endpoint_urls in deployment dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
Haivilo committed Jan 23, 2025
1 parent 722bdc5 commit 5543268
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/bentoml/_internal/cloud/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,11 +442,10 @@ def is_dev(self) -> bool:
return self._schema.manifest is not None and self._schema.manifest.dev

def to_dict(self) -> dict[str, t.Any]:
return {
result = {
"name": self.name,
"bento": self.get_bento(refetch=False),
"cluster": self.cluster,
"endpoint_urls": self._urls if self._urls else None,
"admin_console": self.admin_console,
"created_at": self.created_at,
"created_by": self.created_by,
Expand All @@ -458,6 +457,13 @@ def to_dict(self) -> dict[str, t.Any]:
"status": self.get_status(refetch=False).to_dict(),
}

# Add "endpoint_urls" only if it's not None
if self._urls:
result["endpoint_urls"] = self._urls

return result


def to_yaml(self):
return yaml.dump(self.to_dict(), sort_keys=False)

Expand Down

0 comments on commit 5543268

Please sign in to comment.