Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions crossplane/function/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ def get_condition(resource: structpb.Struct, typ: str) -> Condition:
"""
unknown = Condition(typ=typ, status="Unknown")

if "status" not in resource:
if not resource or "status" not in resource:
return unknown

if "conditions" not in resource["status"]:
if not resource["status"] or "conditions" not in resource["status"]:
return unknown

for c in resource["status"]["conditions"]:
Expand Down Expand Up @@ -149,9 +149,9 @@ class Credentials:
def get_credentials(req: structpb.Struct, name: str) -> Credentials:
"""Get the supplied credentials."""
empty = Credentials(type="data", data={})
if "credentials" not in req:
if not req or "credentials" not in req:
return empty
if name not in req["credentials"]:
if not req["credentials"] or name not in req["credentials"]:
return empty
return Credentials(
type=req["credentials"][name]["type"],
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ classifiers = [
dependencies = [
"grpcio==1.*",
"grpcio-reflection==1.*",
"protobuf==5.27.2",
"protobuf==5.28.1",
"pydantic==2.*",
"structlog==24.*",
]
Expand Down