diff --git a/orbit/changes/14546-orbit-not-reporting-bitlocker-errors b/orbit/changes/14546-orbit-not-reporting-bitlocker-errors new file mode 100644 index 0000000000..9f045b3abb --- /dev/null +++ b/orbit/changes/14546-orbit-not-reporting-bitlocker-errors @@ -0,0 +1 @@ +* Orbit is now properly reporting Bitlocker encryption errors to Fleet server diff --git a/orbit/pkg/update/notifications.go b/orbit/pkg/update/notifications.go index e07c6648cc..3b524f64c8 100644 --- a/orbit/pkg/update/notifications.go +++ b/orbit/pkg/update/notifications.go @@ -487,9 +487,13 @@ func (w *windowsMDMBitlockerConfigFetcher) attemptBitlockerEncryption(notifs fle // Otherwise, using the real one fn = bitlocker.EncryptVolume } + + // Encryption operation is performed here, err will be captured if any + // Error will be returned if the encryption operation failed after sending it to Fleet Server recoveryKey, err := fn(targetVolume) // Getting Bitlocker encryption operation error message if any + // This is going to be sent to Fleet Server bitlockerError := "" if err != nil { bitlockerError = err.Error() @@ -501,16 +505,18 @@ func (w *windowsMDMBitlockerConfigFetcher) attemptBitlockerEncryption(notifs fle ClientError: bitlockerError, } + errServerUpdate := w.EncryptionResult.SetOrUpdateDiskEncryptionKey(payload) + if errServerUpdate != nil { + log.Error().Err(errServerUpdate).Msg("failed to send encryption result to Fleet Server") + return + } + + // This is the error status of the Bitlocker encryption operation + // it is returned here after sending the result to Fleet Server if err != nil { log.Error().Err(err).Msg("failed to encrypt the volume") return } - err = w.EncryptionResult.SetOrUpdateDiskEncryptionKey(payload) - if err != nil { - log.Error().Err(err).Msg("failed to send encryption result to Fleet Server") - return - } - w.lastEnrollRun = time.Now() }