Skip to content

Commit

Permalink
DEBUG
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Graber <[email protected]>
  • Loading branch information
stgraber committed Dec 15, 2023
1 parent e656567 commit 04f9fe1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/instance/resource_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
lxd "github.com/lxc/incus/client"
"github.com/lxc/incus/shared/api"
"github.com/lxc/incus/shared/subprocess"
"github.com/lxc/terraform-provider-incus/internal/common"
"github.com/lxc/terraform-provider-incus/internal/errors"
provider_config "github.com/lxc/terraform-provider-incus/internal/provider-config"
Expand Down Expand Up @@ -946,7 +947,12 @@ func startInstance(ctx context.Context, server lxd.InstanceServer, instanceName
}

if err != nil {
return diag.NewErrorDiagnostic(fmt.Sprintf("Failed to start instance %q", instanceName), err.Error())
debug, err := subprocess.RunCommand("sudo", "cat", fmt.Sprintf("/var/log/incus/%s/lxc.log", instanceName))
if err != nil {
return diag.NewErrorDiagnostic("debug", err.Error())
}

return diag.NewErrorDiagnostic(fmt.Sprintf("Failed to start instance %q: %s", instanceName, debug), err.Error())
}

instanceStartedCheck := func() (any, string, error) {
Expand Down

0 comments on commit 04f9fe1

Please sign in to comment.