Skip to content

Commit

Permalink
Make handler name match the others
Browse files Browse the repository at this point in the history
  • Loading branch information
ekampf committed May 12, 2024
1 parent 3bd2a41 commit c09bb21
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions app/handlers/handlers_resource_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def get_principal_id(
return principal_id

if ref := access_crd.principal_external_ref:
# Once `twingate_resource_access_changed` ran and we have the principal_id
# Once `twingate_resource_access_change` ran and we have the principal_id
# we dont use it and do not re-query the API
if principal_id_already_fetched := create_status and create_status.get(
"principal_id"
Expand All @@ -45,7 +45,7 @@ def get_principal_id(
def check_status_created(status: dict | None) -> dict | None:
if (
create_status := status
and status.get(twingate_resource_access_changed.__name__, {})
and status.get(twingate_resource_access_change.__name__, {})
) and create_status["success"]:
return create_status

Expand All @@ -54,7 +54,7 @@ def check_status_created(status: dict | None) -> dict | None:

@kopf.on.create("twingateresourceaccess")
@kopf.on.update("twingateresourceaccess", field="spec")
def twingate_resource_access_changed(body, spec, memo, logger, patch, status, **kwargs):
def twingate_resource_access_change(body, spec, memo, logger, patch, status, **kwargs):
logger.info("Got a TwingateResourceAccess create request: %s", spec)
creation_status = check_status_created(status)

Expand Down Expand Up @@ -99,7 +99,7 @@ def twingate_resource_access_changed(body, spec, memo, logger, patch, status, **
idle=60,
)
def twingate_resource_access_sync(body, spec, memo, logger, patch, status, **kwargs):
return twingate_resource_access_changed(
return twingate_resource_access_change(
body, spec, memo, logger, patch, status, **kwargs
)

Expand Down
2 changes: 1 addition & 1 deletion app/handlers/tests/test_handlers_resource_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def test_delete_success(self, resource_factory, mock_api_client):
resource_crd_mock.metadata = K8sMetadata(uid="uid", name="foo", namespace="bar")

status = {
"twingate_resource_access_changed": {
"twingate_resource_access_change": {
"success": True,
"principal_id": resource_access_spec["principalId"],
}
Expand Down
2 changes: 1 addition & 1 deletion tests_integration/test_resource_flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def test_resource_access_flows(

# Create
assert {
"message": "Handler 'twingate_resource_access_changed' succeeded.",
"message": "Handler 'twingate_resource_access_change' succeeded.",
"timestamp": ANY,
"object": {
"apiVersion": "twingate.com/v1beta",
Expand Down

0 comments on commit c09bb21

Please sign in to comment.