feature/tpm: log errors on the initial info fetch (#16574)

This function is behind a sync.Once so we should only see errors at
startup. In particular the error from `open` is useful to diagnose why
TPM might not be accessible.

Updates #15830

Signed-off-by: Andrew Lytvynov <awly@tailscale.com>
This commit is contained in:
Andrew Lytvynov 2025-07-21 10:35:53 -07:00 committed by GitHub
parent 1677fb1905
commit 0d03a3746a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -44,8 +44,10 @@ func init() {
func info() *tailcfg.TPMInfo {
tpm, err := open()
if err != nil {
log.Printf("TPM: error opening: %v", err)
return nil
}
log.Printf("TPM: successfully opened")
defer tpm.Close()
info := new(tailcfg.TPMInfo)
@ -74,10 +76,12 @@ func info() *tailcfg.TPMInfo {
PropertyCount: 1,
}.Execute(tpm)
if err != nil {
log.Printf("TPM: GetCapability %v: %v", cap.prop, err)
continue
}
props, err := resp.CapabilityData.Data.TPMProperties()
if err != nil {
log.Printf("TPM: GetCapability %v: %v", cap.prop, err)
continue
}
if len(props.TPMProperty) == 0 {