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

do not operate on empty or ambiguous device and release UUIDs #371

Merged
merged 2 commits into from
Oct 15, 2024

Conversation

otaviojacobi
Copy link
Contributor

Change-type: patch

@otaviojacobi otaviojacobi force-pushed the avoid-deletion-with-incomplete-ids branch 3 times, most recently from 3130e48 to a000a36 Compare October 14, 2024 19:28
@flowzone-app flowzone-app bot enabled auto-merge October 14, 2024 20:15
@otaviojacobi otaviojacobi force-pushed the avoid-deletion-with-incomplete-ids branch 3 times, most recently from 856b331 to e82b65e Compare October 15, 2024 12:46
@otaviojacobi otaviojacobi requested a review from thgreasi October 15, 2024 13:36
balena/models/device.py Outdated Show resolved Hide resolved
balena/models/device.py Outdated Show resolved Hide resolved
@thgreasi
Copy link
Member

thgreasi commented Oct 15, 2024

release.get should probably also throw if you pass an empty string.
We could then on the next major bump that to 5 chars min, since that's the smallest possible semver.

@thgreasi
Copy link
Member

Oh and device.get could similarly fail w/ an InvalidParameter error when providing an empty string

@otaviojacobi otaviojacobi force-pushed the avoid-deletion-with-incomplete-ids branch 2 times, most recently from df16da5 to c8df914 Compare October 15, 2024 15:08
@otaviojacobi otaviojacobi force-pushed the avoid-deletion-with-incomplete-ids branch from c8df914 to 0766753 Compare October 15, 2024 15:20
@otaviojacobi otaviojacobi requested a review from thgreasi October 15, 2024 15:33
@otaviojacobi otaviojacobi changed the title Blocks deleting devices using partial uuids do not operate on empty or ambiguous device and release UUIDs Oct 15, 2024
@@ -57,6 +57,9 @@ def get(
if commit_or_id_or_raw_version is None:
raise exceptions.ReleaseNotFound(commit_or_id_or_raw_version)

if commit_or_id_or_raw_version == '':
raise exceptions.InvalidParameter("UUID can not be empty", None)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
raise exceptions.InvalidParameter("UUID can not be empty", None)
raise exceptions.InvalidParameter("commit_or_id_or_raw_version can not be empty", None)

@thgreasi thgreasi marked this pull request as draft October 15, 2024 17:03
auto-merge was automatically disabled October 15, 2024 17:03

Pull request was converted to draft

Copy link
Member

@thgreasi thgreasi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Converted to draft so that you have the chance to fix the invalid parameter error and not get blocked by my pending review

@otaviojacobi otaviojacobi force-pushed the avoid-deletion-with-incomplete-ids branch from 0766753 to 6d5d043 Compare October 15, 2024 17:03
@otaviojacobi otaviojacobi marked this pull request as ready for review October 15, 2024 17:07
@otaviojacobi otaviojacobi merged commit 46cb77a into master Oct 15, 2024
53 checks passed
@otaviojacobi otaviojacobi deleted the avoid-deletion-with-incomplete-ids branch October 15, 2024 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants