Skip to content

Commit

Permalink
Also fetch certs on types.SenderStatusCertInvalid
Browse files Browse the repository at this point in the history
Signed-off-by: eriknordmark <erik@zededa.com>
Signed-off-by: Roman Penyaev <r.peniaev@gmail.com>
  • Loading branch information
eriknordmark authored and rouming committed Feb 9, 2023
1 parent 3f02cbc commit 60ebce8
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/pillar/cmd/zedagent/handleconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ func getLatestConfig(getconfigCtx *getconfigContext, url string,
switch senderStatus {
case types.SenderStatusCertInvalid:
// trigger to acquire new controller certs from cloud
log.Noticef("%s trigger", senderStatus)
log.Noticef("%s trigger", senderStatus.String())
triggerControllerCertEvent(ctx)
fallthrough
case types.SenderStatusUpgrade, types.SenderStatusRefused, types.SenderStatusNotFound:
Expand All @@ -506,7 +506,7 @@ func getLatestConfig(getconfigCtx *getconfigContext, url string,
}
case types.SenderStatusCertMiss:
// trigger to acquire new controller certs from cloud
log.Noticef("%s trigger", senderStatus)
log.Noticef("%s trigger", senderStatus.String())
triggerControllerCertEvent(ctx)
}
if getconfigCtx.ledBlinkCount == types.LedBlinkOnboarded {
Expand Down Expand Up @@ -593,7 +593,7 @@ func getLatestConfig(getconfigCtx *getconfigContext, url string,
switch senderStatus {
case types.SenderStatusCertMiss, types.SenderStatusCertInvalid:
// trigger to acquire new controller certs from cloud
log.Noticef("%s trigger", senderStatus)
log.Noticef("%s trigger", senderStatus.String())
triggerControllerCertEvent(ctx)
}
// Inform ledmanager about problem
Expand Down
36 changes: 36 additions & 0 deletions pkg/pillar/types/global.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,42 @@ const (
SenderStatusDebug // Not a failure
)

// String prints ASCII
func (status SenderResult) String() string {
switch status {
case SenderStatusNone:
return "SenderStatusNone"
case SenderStatusRefused:
return "SenderStatusRefused"
case SenderStatusUpgrade:
return "SenderStatusUpgrade"
case SenderStatusCertInvalid:
return "SenderStatusCertInvalid"
case SenderStatusCertMiss:
return "SenderStatusCertMiss"
case SenderStatusSignVerifyFail:
return "SenderStatusSignVerifyFail"
case SenderStatusAlgoFail:
return "SenderStatusAlgoFail"
case SenderStatusHashSizeError:
return "SenderStatusHashSizeError"
case SenderStatusCertUnknownAuthority:
return "SenderStatusCertUnknownAuthority"
case SenderStatusCertUnknownAuthorityProxy:
return "SenderStatusCertUnknownAuthorityProxy"
case SenderStatusNotFound:
return "SenderStatusNotFound"
case SenderStatusForbidden:
return "SenderStatusForbidden"
case SenderStatusFailed:
return "SenderStatusFailed"
case SenderStatusDebug:
return "SenderStatusDebug"
default:
return fmt.Sprintf("Unknown status %d", status)
}
}

const (
// MinuteInSec is number of seconds in a minute
MinuteInSec = 60
Expand Down

0 comments on commit 60ebce8

Please sign in to comment.