Skip to content

Commit

Permalink
fixed enclave dump for dead encalves
Browse files Browse the repository at this point in the history
  • Loading branch information
h4ck3rk3y committed Feb 8, 2024
1 parent a250c42 commit 01cb5d1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ jobs:

# Check Dump Contains files
- run: "${KURTOSIS_BINPATH} enclave dump test-enclave test-dump"
- run: "cat test-dump/files/rendered-file"
- run: "ls test-dump/files/rendered-file"

# Module inside an enclave
- run: "${KURTOSIS_BINPATH} enclave ls"
Expand Down
21 changes: 14 additions & 7 deletions cli/cli/commands/enclave/dump/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,22 +85,29 @@ func run(
return stacktrace.Propagate(err, "An error occurred creating Kurtosis Context from local engine")
}

enclaveCtx, err := kurtosisCtx.GetEnclaveContext(ctx, enclaveIdentifier)
if err != nil {
return stacktrace.Propagate(err, "an error occurred while retrieving enclave context for enclave")
}

enclaveUuid := enclaveCtx.GetEnclaveUuid()
enclaveInfo, err := kurtosisCtx.GetEnclave(ctx, enclaveIdentifier)

Check failure on line 88 in cli/cli/commands/enclave/dump/dump.go

View workflow job for this annotation

GitHub Actions / golang-lint

ineffectual assignment to err (ineffassign)

enclaveUuid := enclaveInfo.GetEnclaveUuid()
if enclaveOutputDirpath == defaultEnclaveDumpDir {
enclaveName := enclaveCtx.GetEnclaveName()
enclaveName := enclaveInfo.GetName()
enclaveOutputDirpath = fmt.Sprintf("%s%s%s", enclaveName, enclaveDumpSeparator, enclaveUuid)
}

if err := kurtosisBackend.DumpEnclave(ctx, enclave.EnclaveUUID(enclaveUuid), enclaveOutputDirpath); err != nil {
return stacktrace.Propagate(err, "An error occurred dumping enclave '%v' to '%v'", enclaveIdentifier, enclaveOutputDirpath)
}

if enclaveInfo.ApiContainerStatus != kurtosis_engine_rpc_api_bindings.EnclaveAPIContainerStatus_EnclaveAPIContainerStatus_RUNNING {
logrus.Debugf("Couldn't dump file information as the enclave '%v' is not running", enclaveIdentifier)
logrus.Infof("Dumped enclave '%v' to directory '%v'", enclaveIdentifier, enclaveOutputDirpath)
return nil
}

enclaveCtx, err := kurtosisCtx.GetEnclaveContext(ctx, enclaveIdentifier)
if err != nil {
return stacktrace.Propagate(err, "an error occurred while retrieving enclave context for enclave")
}

filesInEnclave, err := enclaveCtx.GetAllFilesArtifactNamesAndUuids(ctx)
if err != nil {
return stacktrace.Propagate(err, "An error occurred while fetching files artifact in enclave '%v'", enclaveIdentifier)
Expand Down

0 comments on commit 01cb5d1

Please sign in to comment.