Resource type handler_update fails to delete the right model version
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 1/5
- Thời gian dự kiến
- Dưới một giờ
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
Bắt đầu tại src/rpdk/core/contract/suite/resource/handler_update.py, ở updated_resource, và theo dõi model nào được giữ lại trong suốt quá trình cập nhật thành công và cuối cùng là quá trình cleanup. Chạy resource type contract suite liên quan và xác nhận rằng cleanup sử dụng model do thao tác cập nhật trả về, bao gồm cả các resource áp dụng optimistic version locking.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
The updated_resource in handler_update resource type test suite is wrongly deleting the created model in its finally section instead of the potentially updated model.
My resource type is maintaining a Version field on the server with optimistic locking to avoid accidental overwrite of the resource. Upon a successful update, the version is auto-incremented and the new version is returned to the client. The client specifies the version in the If-Match header of the HTTP request, and the server allows the mutation only if the version stored is the same.
In the following function:
def updated_resource(resource_client):
create_request = input_model = resource_client.generate_create_example()
model = {}
try:
_status, response, _error = resource_client.call_and_assert(
Action.CREATE, OperationStatus.SUCCESS, create_request
)
created_model = model = response["resourceModel"]
test_input_equals_output(resource_client, input_model, created_model)
update_request = resource_client.generate_update_example(created_model)
_status, response, _error = resource_client.call_and_assert(
Action.UPDATE, OperationStatus.SUCCESS, update_request, created_model
)
updated_model = response["resourceModel"]
test_input_equals_output(resource_client, update_request, updated_model)
# flake8: noqa: B950
# pylint: disable=C0301
yield create_request, created_model, update_request, updated_model, update_request
finally:
resource_client.call_and_assert(Action.DELETE, OperationStatus.SUCCESS, model)
The following call to update:
_status, response, _error = resource_client.call_and_assert(
Action.UPDATE, OperationStatus.SUCCESS, update_request, created_model
)
updated_model = response["resourceModel"]
increments the resource version but the delete is made on the original model, which in my case, has the previous version, and thus fails:
finally:
resource_client.call_and_assert(Action.DELETE, OperationStatus.SUCCESS, model)
A potential fix, is to update the model upon successful update:
_status, response, _error = resource_client.call_and_assert(
Action.UPDATE, OperationStatus.SUCCESS, update_request, created_model
)
model = updated_model = response["resourceModel"]
When trying to delete the resource in the finally section now, the right model is provided
- Ngôn ngữ chính
- Python
- Star
- 336
- Fork
- 173
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của aws-cloudformation/cloudformation-cli
-
docs: `--use-docker` and `--no-docker` options of `cfn submit` are missing from the documentationĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 92/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
aws-cloudformation/cloudformation-cli#1117 · 1 bình luận · 6 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
aws-cloudformation/cloudformation-cli#1115 · 1 bình luận · 9 reaction ·
Tất cả issue của aws-cloudformation/cloudformation-cli
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
Netcracker/qubership-ai-packages#266 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
PROCESSED_DATA_FOLDER: strip whitespace and treat empty as unsetCó thể đã có người làm @TorecLuik đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
NL-BioImaging/BIOMERO.importer#63 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
MLX training-complete chat/merge suggestions omit --backend mlxCó thể đã có người làm @vaputa đã nhận hôm nay. Đang mởneeds-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
MakazhanAlpamys/Soup#2913 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:security effort:S priority:P3 status:needs-triage type:chore
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
randomparity/kdive#3657 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
aws/mcp-proxy-for-aws#476 ·
Maintainer thường phản hồi trong vòng 1 ngày