Skip to content

Commit

Permalink
Unify check attempt data type to uint32 already used somewhere
Browse files Browse the repository at this point in the history
A float isn't necessary as in Icinga 2 Checkable#max_check_attempts and
check_attempt are ints. But uint8 isn't enough for e.g. 1 check/s to get
HARD after 5m (300s > 255).
  • Loading branch information
Al2Klimov committed Oct 10, 2023
1 parent 57f4f78 commit f26ecbf
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/icingadb-migrate/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ func convertStateRows(
HardState: row.LastHardState,
PreviousSoftState: row.LastState,
PreviousHardState: previousHardState,
CheckAttempt: uint8(row.CurrentCheckAttempt),
CheckAttempt: uint32(row.CurrentCheckAttempt),
Output: icingadbTypes.String{NullString: row.Output},
LongOutput: icingadbTypes.String{NullString: row.LongOutput},
MaxCheckAttempts: uint32(row.MaxCheckAttempts),
Expand Down
2 changes: 1 addition & 1 deletion pkg/icingadb/v1/checkable.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type Checkable struct {
IconImageAlt string `json:"icon_image_alt"`
IconImageId types.Binary `json:"icon_image_id"`
IsVolatile types.Bool `json:"is_volatile"`
MaxCheckAttempts float64 `json:"max_check_attempts"`
MaxCheckAttempts uint32 `json:"max_check_attempts"`
Notes string `json:"notes"`
NotesUrlId types.Binary `json:"notes_url_id"`
NotificationsEnabled types.Bool `json:"notifications_enabled"`
Expand Down
2 changes: 1 addition & 1 deletion pkg/icingadb/v1/history/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type StateHistory struct {
HardState uint8 `json:"hard_state"`
PreviousSoftState uint8 `json:"previous_soft_state"`
PreviousHardState uint8 `json:"previous_hard_state"`
CheckAttempt uint8 `json:"check_attempt"`
CheckAttempt uint32 `json:"check_attempt"`
Output types.String `json:"output"`
LongOutput types.String `json:"long_output"`
MaxCheckAttempts uint32 `json:"max_check_attempts"`
Expand Down
2 changes: 1 addition & 1 deletion pkg/icingadb/v1/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type State struct {
EnvironmentMeta `json:",inline"`
AcknowledgementCommentId types.Binary `json:"acknowledgement_comment_id"`
LastCommentId types.Binary `json:"last_comment_id"`
CheckAttempt uint8 `json:"check_attempt"`
CheckAttempt uint32 `json:"check_attempt"`
CheckCommandline types.String `json:"check_commandline"`
CheckSource types.String `json:"check_source"`
SchedulingSource types.String `json:"scheduling_source"`
Expand Down

0 comments on commit f26ecbf

Please sign in to comment.