Skip to content

Commit ee778cd

Browse files
Merge pull request #523 from AlexVulaj/resize-control-plane-multi-word-justification
Allow multi-word justifications for resizing control plane service logs
2 parents 8eb6c1e + 058ef81 commit ee778cd

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cmd/cluster/resizecontrolplanenode.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,9 +503,17 @@ func promptGenerateResizeSL(clusterID string, newMachineType string) error {
503503
fmt.Print("Please enter the JIRA ID that corresponds to this resize: ")
504504
_, _ = fmt.Scanln(&jiraID)
505505

506+
// Use a bufio Scanner since the fmt package cannot read in more than one word
506507
var justification string
507508
fmt.Print("Please enter a justification for the resize: ")
508-
_, _ = fmt.Scanln(&justification)
509+
scanner := bufio.NewScanner(os.Stdin)
510+
if scanner.Scan() {
511+
justification = scanner.Text()
512+
} else {
513+
errText := "failed to read justification text, send service log manually"
514+
_, _ = fmt.Fprintf(os.Stderr, errText)
515+
return errors.New(errText)
516+
}
509517

510518
postCmd := servicelog.PostCmdOptions{
511519
Template: "https://raw.githubusercontent.com/openshift/managed-notifications/master/osd/controlplane_resized.json",

0 commit comments

Comments
 (0)