-
Notifications
You must be signed in to change notification settings - Fork 6
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 docs and wrap pebble.ExecError with custom error #653
base: 2/main
Are you sure you want to change the base?
Conversation
process.wait() | ||
except ops.pebble.ExecError as exc: | ||
logger.exception("Error syncing MAS config with the database.") | ||
raise MASConfigSyncError("Error validating MAS configuration.") from exc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this exception be catched somewhere? Otherwise I think the unit will go into error state (and currently synapse does not go into error state, but into blocked state I think)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My reasoning is that if this command fails then there's something wrong with the postgresql database which should put the charm into an error state as there's usually no specific action for the operator to take
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue with getting into error state is that it is problematic.
For example, as you are not using the latest version of the redis library, if you get into error state and the redis url changes (because for example the redis pod was recreated), the charm will not get notified, and you may not get out of that issue (as has happened in the discourse charm). Updating the redis library will fix that, but other issues may arise, as not being able to upgrade the charm in that state...
process.wait() | ||
except ops.pebble.ExecError as exc: | ||
logger.exception("Error syncing MAS config with the database.") | ||
raise MASConfigSyncError("Error validating MAS configuration.") from exc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the exception description be the same as the logger.exception?
@@ -116,7 +139,7 @@ def register_user( | |||
process = container.exec(command=command, working_dir=MAS_WORKING_DIR) | |||
process.wait_output() | |||
except ops.pebble.ExecError as exc: | |||
logger.error("Error registering new user: %s", exc.stderr) | |||
logger.exception("Error registering new user.") | |||
raise MASRegisterUserFailedError("Error validating MAS configuration.") from exc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here regarding expcetion description and logger.exception
Test coverage for 24e3c7e
Static code analysis report
|
This PR adds missing commits from #620
pebble.ExecError
formas-cli
commandsChecklist
src-docs
urgent
,trivial
,complex
)