github.com/cloud-foundations/dominator@v0.0.0-20221004181915-6e4fee580046/dom/herd/subStatus.go (about)

     1  package herd
     2  
     3  import (
     4  	"fmt"
     5  )
     6  
     7  func (status subStatus) string() string {
     8  	switch status {
     9  	case statusUnknown:
    10  		return "unknown"
    11  	case statusConnecting:
    12  		return "connecting"
    13  	case statusDNSError:
    14  		return "DNS error"
    15  	case statusConnectionRefused:
    16  		return "connection refused"
    17  	case statusNoRouteToHost:
    18  		return "no route to host"
    19  	case statusConnectTimeout:
    20  		return "connect timeout"
    21  	case statusMissingCertificate:
    22  		return "connect failed: missing certificate"
    23  	case statusBadCertificate:
    24  		return "connect failed: bad certificate"
    25  	case statusFailedToConnect:
    26  		return "connect failed"
    27  	case statusWaitingToPoll:
    28  		return "waiting to poll"
    29  	case statusPolling:
    30  		return "polling"
    31  	case statusPollDenied:
    32  		return "poll denied"
    33  	case statusFailedToPoll:
    34  		return "poll failed"
    35  	case statusSubNotReady:
    36  		return "sub not ready"
    37  	case statusImageUndefined:
    38  		return "image undefined"
    39  	case statusImageNotReady:
    40  		return "image not ready"
    41  	case statusNotEnoughFreeSpace:
    42  		return "insufficient space"
    43  	case statusFetching:
    44  		return "fetching"
    45  	case statusFetchDenied:
    46  		return "fetch denied"
    47  	case statusFailedToFetch:
    48  		return "fetch failed"
    49  	case statusPushing:
    50  		return "pushing"
    51  	case statusPushDenied:
    52  		return "push denied"
    53  	case statusFailedToPush:
    54  		return "failed to push"
    55  	case statusFailedToGetObject:
    56  		return "failed to get object"
    57  	case statusComputingUpdate:
    58  		return "computing update"
    59  	case statusSendingUpdate:
    60  		return "sending update"
    61  	case statusMissingComputedFile:
    62  		return "missing computed file"
    63  	case statusUpdatesDisabled:
    64  		return "updates disabled"
    65  	case statusUnsafeUpdate:
    66  		return "unsafe update"
    67  	case statusUpdating:
    68  		return "updating"
    69  	case statusUpdateDenied:
    70  		return "update denied"
    71  	case statusFailedToUpdate:
    72  		return "update failed"
    73  	case statusWaitingForNextFullPoll:
    74  		return "waiting for next full poll"
    75  	case statusSynced:
    76  		return "synced"
    77  	default:
    78  		panic(fmt.Sprintf("unknown status: %d", status))
    79  	}
    80  }
    81  
    82  func (status subStatus) html() string {
    83  	switch status {
    84  	case statusUnsafeUpdate:
    85  		return `<font color="red">` + status.String() + "</font>"
    86  	default:
    87  		return status.String()
    88  	}
    89  }