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

feat: add property for issue tracker status #684

Merged
merged 2 commits into from
Mar 18, 2022

Conversation

mfocko
Copy link
Member

@mfocko mfocko commented Mar 10, 2022

Add property to GitProject class that denotes whether issue tracker is
enabled on the specific project or not.

Signed-off-by: Matej Focko [email protected]

TODO:

  • finish it off with the exception for disabled issue tracker

Fixes #664

RELEASE NOTES BEGIN
We have added a new property to git projects has_issues that indicates whether project has enabled issues or not. Following up on the property, create_issue now raises IssueTrackerDisabled when the project doesn't have issues enabled.
RELEASE NOTES END

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

@mfocko mfocko requested a review from lachmanfrantisek March 10, 2022 15:31
Copy link
Member

@lachmanfrantisek lachmanfrantisek left a comment

Choose a reason for hiding this comment

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

Thanks! It's a really old one..;)

Add property to GitProject class that denotes whether issue tracker is
enabled on the specific project or not.

Fixes packit#664

Signed-off-by: Matej Focko <[email protected]>
@mfocko
Copy link
Member Author

mfocko commented Mar 18, 2022

@lachmanfrantisek Should I inspect the thrown exception or rather check .has_issues?

Positive for .has_issues is that I can do it right away at the start and be sure the issue is thrown for legitimate reasons and not guessed (e.g. 403 on GitLab).
Positive for thrown exception is that it doesn't create one more request to the API endpoint (to get the project settings).

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

@softwarefactory-project-zuul
Copy link
Contributor

Build failed.

Copy link
Member

@TomasTomecek TomasTomecek left a comment

Choose a reason for hiding this comment

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

neat

(I'm in favour of doing an extra request)

alternatively, in case of an issue, we could try checking in the exc handler - not sure if that's better

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

@mfocko mfocko added mergeit When set, zuul wil gate and merge the PR. has-release-notes labels Mar 18, 2022
@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded (gate pipeline).

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit d04a107 into packit:main Mar 18, 2022
@lachmanfrantisek
Copy link
Member

@lachmanfrantisek Should I inspect the thrown exception or rather check .has_issues?

Positive for .has_issues is that I can do it right away at the start and be sure the issue is thrown for legitimate reasons and not guessed (e.g. 403 on GitLab). Positive for thrown exception is that it doesn't create one more request to the API endpoint (to get the project settings).

Do you mean here in the create_issue method or when using this elsewhere? But for both cases, I'm probably for the explicit checking of .has_issues. The code looks more readable to me (can be read as a sentence If has issues do something else do something different.)

@mfocko mfocko deleted the has-issue branch April 25, 2022 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mergeit When set, zuul wil gate and merge the PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add property and raise specific exception when issues are disabled
3 participants