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

Update validators.py #703

Closed
wants to merge 2 commits into from
Closed

Update validators.py #703

wants to merge 2 commits into from

Conversation

adsnjhfyeqw231eas
Copy link

@pypingou pypingou mentioned this pull request Nov 15, 2015
@@ -148,7 +148,7 @@ def validate_build_tags(request):
if not build_rel:
raise KeyError("Couldn't find release from build tags")
except KeyError:
msg = 'Cannot find release associated with build: {}, tags: {}'.format(build, tags)
msg = 'Cannot find any tags associated with that nvr: {}, tags: {}'.format(build, tags)
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice to have the error messages be different. Maybe this could read something like

'nvr for {} is not tagged with any of the following: {}'.format(build, tags)

Copy link
Contributor

Choose a reason for hiding this comment

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

tags in this context are what the build is tagged with, so that message wouldn't be correct.

Also, I'm not sure that nvr is the most user-friendly way to describe a build, even though most people probably know what it means.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fair enough. The same sentiment still remains though. I think having different error messages would be nicer than a single error message for both lines.

Copy link
Author

Choose a reason for hiding this comment

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

different error massages are updated to issue #630

different error massages are updated to issue #630
@ralphbean
Copy link
Contributor

OK. There's really two failure scenarios here.

  • The build is not tagged with any tags.
  • The build is tagged, but not with a tag that can tell us the release.

Seems like we should add a check before the call to build_rel = Release.from_tags(tags, request.db) to handle the first scenario, like:

if not tags:
    # return some error here indicating that the build has *no* tags

and then the error messages that have already been edited here need to be updated to indicate that we have hit the second scenario.

FWIW, I agree with the comment on an earlier commit that we should replace the word 'nvr' in the error messages with 'build'.

@ralphbean
Copy link
Contributor

Also, @TridevGuha, did you run the test suite against this change? I have a feeling that there are test cases that check these error messages (although I'm not sure about that).

@adsnjhfyeqw231eas
Copy link
Author

Nope, I did not run the test suite, need to run the test?

@ralphbean
Copy link
Contributor

Yeah, definitely. They're pretty comprehensive.

@ralphbean
Copy link
Contributor

@TridevGuha any luck running the test suite?

@ralphbean
Copy link
Contributor

OK, I'm going to close this one for now. Feel free to re-open it after we can get some feedback from the test suite.

@ralphbean ralphbean closed this Jan 30, 2016
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.

None yet

4 participants