MCPcopy Create free account
hub / github.com/cloudbase/garm / renderResponseMessage

Function renderResponseMessage

cmd/garm-cli/cmd/init.go:230–276  ·  view source on GitHub ↗
(user params.User, controllerInfo *apiClientController.UpdateControllerOK, controllerURLUpdateErr error)

Source from the content-addressed store, hash-verified

228}
229
230func renderResponseMessage(user params.User, controllerInfo *apiClientController.UpdateControllerOK, controllerURLUpdateErr error) {
231 headerMsg := `Congrats! Your controller is now initialized.
232
233Following are the details of the admin user and details about the controller.
234
235Admin user information:
236
237%s
238`
239
240 controllerMsg := `Controller information:
241
242%s
243
244Make sure that the URLs in the table above are reachable by the relevant parties.
245
246The metadata and callback URLs *must* be accessible by the runners that GARM spins up.
247The base webhook and the controller webhook URLs must be accessible by GitHub or GHES.
248`
249
250 controllerErrorMsg := `WARNING: Failed to set the required controller URLs with error: %q
251
252Please run:
253
254 garm-cli controller show
255
256To make sure that the callback, metadata and webhook URLs are set correctly. If not,
257you must set them up by running:
258
259 garm-cli controller update \
260 --metadata-url=<metadata-url> \
261 --callback-url=<callback-url> \
262 --webhook-url=<webhook-url>
263
264See the help message for garm-cli controller update for more information.
265`
266 var ctrlMsg string
267 if controllerURLUpdateErr != nil || controllerInfo == nil {
268 ctrlMsg = fmt.Sprintf(controllerErrorMsg, controllerURLUpdateErr)
269 } else {
270 controllerInfoTable := renderControllerInfoTable(controllerInfo.Payload)
271 ctrlMsg = fmt.Sprintf(controllerMsg, controllerInfoTable)
272 }
273
274 userTable := renderUserTable(user)
275 fmt.Printf("%s\n%s\n", fmt.Sprintf(headerMsg, userTable), ctrlMsg)
276}

Callers 1

init.goFile · 0.85

Calls 2

renderUserTableFunction · 0.85

Tested by

no test coverage detected