Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch case where state from older version could be unexpected #396

Merged
merged 1 commit into from
Apr 9, 2021
Merged

Catch case where state from older version could be unexpected #396

merged 1 commit into from
Apr 9, 2021

Conversation

bengesoff
Copy link
Contributor

A change in v0.28.1 moved to use cloned_version much more heavily. This
made a few assumptions that during import/create, the cloned_version
would be set, and that therefore in a usual Read, this would already be
taken care of. However this missed a situation where the user has an
existing state file from v0.28.0 or earlier and upgrades to v0.28.1. In
this situation, neither the Create nor the Import logic would be
triggered and the cloned_version would have evaded attention. This then
causes problems in the Update function where we assume cloned_version is
correct and use it to clone a new version to make changes. In particular
this commit addresses the case where cloned_version is 0, which leads to
an error message when calling CloneVersion:

Error: missing required field 'ServiceVersion'

To get around this, we look for the case where cloned_version is 0 in
the Read function and use the same logic as Import in that case too.

A change in v0.28.1 moved to use cloned_version much more heavily. This
made a few assumptions that during import/create, the cloned_version
would be set, and that therefore in a usual Read, this would already be
taken care of. However this missed a situation where the user has an
existing state file from v0.28.0 or earlier and upgrades to v0.28.1. In
this situation, neither the Create nor the Import logic would be
triggered and the cloned_version would have evaded attention. This then
causes problems in the Update function where we assume cloned_version is
correct and use it to clone a new version to make changes. In particular
this commit addresses the case where cloned_version is 0, which leads to
an error message when calling CloneVersion:

Error: missing required field 'ServiceVersion'

To get around this, we look for the case where cloned_version is 0 in
the Read function and use the same logic as Import in that case too.
@Integralist Integralist added the bug label Apr 9, 2021
@Integralist Integralist merged commit a893204 into fastly:master Apr 9, 2021
@bengesoff bengesoff deleted the cloned_version-zero-fix branch April 16, 2021 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants