Skip to content

Commit

Permalink
assume version 1 for older lockfiles without version key (#13399)
Browse files Browse the repository at this point in the history
As reported in Slack, Python lockfiles created in Pants v2.7.x do not have a `version` key in the lockfile metadata. Pants v2.8.x generates lockfiles with the `version` key in the metdata and expects the files to contain that key. It had no fallback for older lockfiles without the `version` key. This broke an upgrade for one user from v2.7.0rc2 to v2.8.0rc0. 

Solution: Pants should just assume version 1 if it does not find the `version` key in lockfile metadata.

[ci skip-rust]
  • Loading branch information
Tom Dyas authored Oct 28, 2021
1 parent 6b1d215 commit 184d51e
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ def from_lockfile(
"be decoded. " + error_suffix
)

concrete_class = _concrete_metadata_classes[metadata["version"]]
version = metadata.get("version", 1)
concrete_class = _concrete_metadata_classes[version]

return concrete_class._from_json_dict(metadata, lockfile_description, error_suffix)

Expand Down

0 comments on commit 184d51e

Please sign in to comment.