Resource type handler_update fails to delete the right model version
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 1/5
- Tempo stimato
- Meno di un'ora
- Idoneità per principianti
- 45/100
Direzione di ricerca
Inizia in src/rpdk/core/contract/suite/resource/handler_update.py, in updated_resource, e segui quale modello viene mantenuto durante l'aggiornamento riuscito e infine nella pulizia. Esegui la suite di contract del tipo di risorsa pertinente e conferma che la pulizia utilizzi il modello restituito dall'aggiornamento, incluse le risorse che impongono il version locking ottimistico.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Python
- Stelle
- 336
- Fork
- 173
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di aws-cloudformation/cloudformation-cli
-
docs: `--use-docker` and `--no-docker` options of `cfn submit` are missing from the documentationAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 92/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
aws-cloudformation/cloudformation-cli#1117 · 1 commento · 6 reazioni ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
aws-cloudformation/cloudformation-cli#1115 · 1 commento · 9 reazioni ·
Tutte le issue di aws-cloudformation/cloudformation-cli
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
Netcracker/qubership-ai-packages#266 ·
I maintainer di solito rispondono entro 1 giorno
-
PROCESSED_DATA_FOLDER: strip whitespace and treat empty as unsetForse già presa @TorecLuik l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
NL-BioImaging/BIOMERO.importer#63 ·
I maintainer di solito rispondono entro 1 giorno
-
MLX training-complete chat/merge suggestions omit --backend mlxForse già presa @vaputa l’ha presa oggi. Apertaneeds-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
MakazhanAlpamys/Soup#2913 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
area:security effort:S priority:P3 status:needs-triage type:chore
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
randomparity/kdive#3657 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
aws/mcp-proxy-for-aws#476 ·
I maintainer di solito rispondono entro 1 giorno