Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

fix cloud run worker v2 vpc access #267

Merged
merged 2 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion prefect_gcp/workers/cloud_run_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def _remove_vpc_access_if_unset(self):
# if connector is the only key and it's not set, we'll remove it.
# otherwise we'll pass whatever the user has provided.
if len(vpc_access) == 1 and vpc_access.get("connector") is None:
self.job_body["template"]["template"]["vpcAccess"] = None
self.job_body["template"]["template"].pop("vpcAccess")

# noinspection PyMethodParameters
@validator("job_body")
Expand Down
4 changes: 2 additions & 2 deletions tests/test_cloud_run_worker_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ def test_remove_vpc_access_if_unset(self, cloud_run_worker_v2_job_config):
cloud_run_worker_v2_job_config._remove_vpc_access_if_unset()

assert (
cloud_run_worker_v2_job_config.job_body["template"]["template"]["vpcAccess"]
is None
"vpcAccess"
not in cloud_run_worker_v2_job_config.job_body["template"]["template"]
)

def test_vpc_access_left_alone_if_connector_set(
Expand Down
Loading