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

Reduce permissions for pubsub #273

Merged
merged 2 commits into from
Mar 30, 2022

Conversation

noursaidi
Copy link
Collaborator

Remove requirement for project.subscription.list IAM permissions to use validator by using the NOT_FOUND exception. Slightly improve logging (add "no permission" message line)

System.err.println("Subscription not found " + subscriptionName);
throw new RuntimeException(e.toString());
} catch (PermissionDeniedException e) {
System.err.println("Missing permissions to access subscription " + subscriptionName);
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's wrong with the generic messages? I'd like to understand specifically what the difference is since I really try to avoid using the exception mechanism to specifically detail logging (it just ends up being messy in the long run, and I'm not sure it's the "right" place for it). All Exceptions can be of the form (string_message, exception_thrown), which keeps the relevant detail.

Are you trying to make the stack-trace disappear? Or is it really a question of the message delivered?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I wanted to add a user friendly Missing permissions to access subscription message because it's a common error which is buried in the stack trace that people often can't read.

But I think I went about it the wrong way, what I should have done was:
throw new RuntimeException("Missing permissions to access subscription " + subscriptionName, e)
?

Copy link
Collaborator

Choose a reason for hiding this comment

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

So yes, there's two separable things here... 1) the error message, which the fix you indicated will address. and then 2) getting buried in the stack trace. The thing we should do for 2) is to figure out where it's being caught at the top, and introduce a "verbose" mode or something so that it only prints out the stack if verbose is enabled, otherwise it just shows the messages from the call chain. If you want to take a stab at that go for it, otherwise I can put the skeleton in place and then you can tweak the messages themselves...

Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we move traceback output to DEBUG level and then change the log level with an --option?

@noursaidi noursaidi changed the title Reduce permissions for pubsub and improve logging Reduce permissions for pubsub Mar 30, 2022
@noursaidi
Copy link
Collaborator Author

Updated to take out changes to logging - it's now functionally equivalent just without the need for the project.subscription.list permission requirement. Logging changes inc. debug changes to be addressed seperately

@noursaidi noursaidi requested a review from grafnu March 30, 2022 13:23
@noursaidi noursaidi merged commit 29530a7 into faucetsdn:master Mar 30, 2022
@noursaidi noursaidi deleted the validator-iamdebug branch September 20, 2022 13:21
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

3 participants