(opts *shared.ViewOptions, workerPool workerpools.IWorkerPool)
| 127 | } |
| 128 | |
| 129 | func getWorkerPoolAsBasic(opts *shared.ViewOptions, workerPool workerpools.IWorkerPool) string { |
| 130 | var result strings.Builder |
| 131 | |
| 132 | // Header |
| 133 | result.WriteString(fmt.Sprintf("%s %s\n", output.Bold(workerPool.GetName()), output.Dimf("(%s)", workerPool.GetID()))) |
| 134 | result.WriteString(fmt.Sprintf("Worker Pool Type: %s\n", string(workerPool.GetWorkerPoolType()))) |
| 135 | |
| 136 | if workerPool.GetIsDefault() { |
| 137 | result.WriteString(fmt.Sprintf("Default: %s\n", output.Green("Yes"))) |
| 138 | } |
| 139 | |
| 140 | // Worker statistics |
| 141 | workers, _ := getWorkers(opts, workerPool) |
| 142 | workerStats := calculateWorkerStats(workers) |
| 143 | |
| 144 | result.WriteString(fmt.Sprintf("Total workers: %d\n", workerStats.Total)) |
| 145 | if workerStats.Disabled > 0 { |
| 146 | result.WriteString(fmt.Sprintf("Disabled workers: %s\n", output.Dimf("%d", workerStats.Disabled))) |
| 147 | } |
| 148 | if workerStats.Healthy > 0 { |
| 149 | result.WriteString(fmt.Sprintf("Healthy workers: %s\n", output.Greenf("%d", workerStats.Healthy))) |
| 150 | } |
| 151 | if workerStats.HasWarnings > 0 { |
| 152 | result.WriteString(fmt.Sprintf("Has Warnings workers: %s\n", output.Yellowf("%d", workerStats.HasWarnings))) |
| 153 | } |
| 154 | if workerStats.Unhealthy > 0 { |
| 155 | result.WriteString(fmt.Sprintf("Unhealthy workers: %s\n", output.Redf("%d", workerStats.Unhealthy))) |
| 156 | } |
| 157 | if workerStats.Unavailable > 0 { |
| 158 | result.WriteString(fmt.Sprintf("Unavailable workers: %s\n", output.Redf("%d", workerStats.Unavailable))) |
| 159 | } |
| 160 | |
| 161 | // Worker type breakdown |
| 162 | if workerStats.SSH > 0 { |
| 163 | result.WriteString(fmt.Sprintf("SSH workers: %d\n", workerStats.SSH)) |
| 164 | } |
| 165 | if workerStats.ListeningTentacle > 0 { |
| 166 | result.WriteString(fmt.Sprintf("Listening Tentacle workers: %d\n", workerStats.ListeningTentacle)) |
| 167 | } |
| 168 | if workerStats.PollingTentacle > 0 { |
| 169 | result.WriteString(fmt.Sprintf("Polling Tentacle workers: %d\n", workerStats.PollingTentacle)) |
| 170 | } |
| 171 | |
| 172 | // Web URL |
| 173 | url := util.GenerateWebURL(opts.Host, workerPool.GetSpaceID(), fmt.Sprintf("infrastructure/workerpools/%s", workerPool.GetID())) |
| 174 | result.WriteString(fmt.Sprintf("\nView this worker pool in Octopus Deploy: %s\n", output.Blue(url))) |
| 175 | |
| 176 | return result.String() |
| 177 | } |
| 178 | |
| 179 | func getWorkers(opts *shared.ViewOptions, workerPool workerpools.IWorkerPool) ([]*machines.Worker, error) { |
| 180 | if workerPool.GetWorkerPoolType() == workerpools.WorkerPoolTypeStatic { |
no test coverage detected