Manager: allow setup to finish without Blender #104306

Manually merged
Sybren A. Stüvel merged 34 commits from abelli/flamenco:issue100195 into main 2024-09-09 11:22:42 +02:00
2 changed files with 8 additions and 6 deletions
Showing only changes of commit 34d91a7797 - Show all commits

View File

@ -265,9 +265,11 @@ func (f *Flamenco) SaveSetupAssistantConfig(e echo.Context) error {
logger = logger.With().Interface("config", setupAssistantCfg).Logger()
if setupAssistantCfg.StorageLocation == "" ||
isConfigIncomplete := setupAssistantCfg.StorageLocation == "" ||
!setupAssistantCfg.BlenderExecutable.IsUsable ||
abelli marked this conversation as resolved Outdated

The work cannot be done, and so this should be logged as an error, not a warning.

I usually log errors as a 'cause' field:

logger.Error().AnErr("cause", err).Msg("setup assistant: configuration is incomplete")

Alternatively, if you want to keep the error message as part of the log message, you could use .Msgf(...) instead:

logger.Error().Msgf("setup assistant: configuration is incomplete, %v", err)

%v is Go's generic "put the thing's value here", and should result in the value of err.Error().

The work cannot be done, and so this should be logged as an error, not a warning. I usually log errors as a 'cause' field: ```go logger.Error().AnErr("cause", err).Msg("setup assistant: configuration is incomplete") ``` Alternatively, if you want to keep the error message as part of the log message, you could use `.Msgf(...)` instead: ```go logger.Error().Msgf("setup assistant: configuration is incomplete, %v", err) ``` `%v` is Go's generic "put the thing's value here", and should result in the value of `err.Error()`.
setupAssistantCfg.BlenderExecutable.Path == "" {
setupAssistantCfg.BlenderExecutable.Path == ""
abelli marked this conversation as resolved Outdated

It's fine to include the actual error message in the response as well, so that the caller knows what's wrong without checking the Manager log.

It's fine to include the actual error message in the response as well, so that the caller knows what's wrong without checking the Manager log.
if isConfigIncomplete && setupAssistantCfg.BlenderExecutable.Source != "default" {
logger.Warn().Msg("setup assistant: configuration is incomplete, unable to accept")
return sendAPIError(e, http.StatusBadRequest, "configuration is incomplete")
}
@ -277,7 +279,7 @@ func (f *Flamenco) SaveSetupAssistantConfig(e echo.Context) error {
var executable string
switch setupAssistantCfg.BlenderExecutable.Source {
case api.BlenderPathSourceFileAssociation:
case api.BlenderPathSourceFileAssociation, api.BlenderPathSourceDefault:
// The Worker will try to use the file association when the command is set
// to the string "blender".
executable = "blender"

View File

@ -355,11 +355,11 @@ export default {
},
blenderFromDefaultSource() {
return {
input: 'blender',
path: 'blender',
input: '',
path: '',
source: 'default',
is_usable: true,
cause: 'blender',
cause: '',
};
},
setupConfirmIsClickable() {