github.com/Cloud-Foundations/Dominator@v0.3.4/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 statusUnwritable:
    36  		return "unwritable"
    37  	case statusSubNotReady:
    38  		return "sub not ready"
    39  	case statusImageUndefined:
    40  		return "image undefined"
    41  	case statusImageNotReady:
    42  		return "image not ready"
    43  	case statusNotEnoughFreeSpace:
    44  		return "insufficient space"
    45  	case statusLocked:
    46  		return "locked"
    47  	case statusFetching:
    48  		return "fetching"
    49  	case statusFetchDenied:
    50  		return "fetch denied"
    51  	case statusFailedToFetch:
    52  		return "fetch failed"
    53  	case statusPushing:
    54  		return "pushing"
    55  	case statusPushDenied:
    56  		return "push denied"
    57  	case statusFailedToPush:
    58  		return "failed to push"
    59  	case statusFailedToGetObject:
    60  		return "failed to get object"
    61  	case statusComputingUpdate:
    62  		return "computing update"
    63  	case statusSendingUpdate:
    64  		return "sending update"
    65  	case statusMissingComputedFile:
    66  		return "missing computed file"
    67  	case statusUpdatesDisabled:
    68  		return "updates disabled"
    69  	case statusUnsafeUpdate:
    70  		return "unsafe update"
    71  	case statusDisruptionRequested:
    72  		return "disruption requested"
    73  	case statusDisruptionDenied:
    74  		return "disruption denied"
    75  	case statusUpdating:
    76  		return "updating"
    77  	case statusUpdateDenied:
    78  		return "update denied"
    79  	case statusFailedToUpdate:
    80  		return "update failed"
    81  	case statusWaitingForNextFullPoll:
    82  		return "waiting for next full poll"
    83  	case statusSynced:
    84  		return "synced"
    85  	default:
    86  		panic(fmt.Sprintf("unknown status: %d", status))
    87  	}
    88  }
    89  
    90  func (status subStatus) html() string {
    91  	switch status {
    92  	case statusUnsafeUpdate:
    93  		return `<font color="red">` + status.String() + "</font>"
    94  	default:
    95  		return status.String()
    96  	}
    97  }