Skip to content
This repository was archived by the owner on Oct 27, 2022. It is now read-only.

Commit 007e3c8

Browse files
guillaumeroseanjannath
authored andcommitted
/api/start will throw an exception if it doesn’t start.
There is no need to parse the status at the end.
1 parent 6680d74 commit 007e3c8

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

CodeReady Containers/DaemonCommander/Handlers.swift

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -184,29 +184,12 @@ func HandleStart() {
184184
let appDelegate = NSApplication.shared.delegate as? AppDelegate
185185
appDelegate?.initializeMenus(status: "Starting")
186186
}
187-
var response: Data
188187
do {
189-
response = try SendCommandToDaemon(HTTPMethod.GET, "/api/start")
190188
displayNotification(title: "Starting Cluster", body: "Starting OpenShift Cluster, this could take a few minutes..")
189+
_ = try SendCommandToDaemon(HTTPMethod.GET, "/api/start")
190+
displayNotification(title: "Successfully started cluster", body: "OpenShift cluster is running")
191191
} catch let error {
192-
DispatchQueue.main.async {
193-
showAlertFailedAndCheckLogs(message: "Failed to start OpenShift cluster", informativeMsg: "\(error)")
194-
let appDelegate = NSApplication.shared.delegate as? AppDelegate
195-
appDelegate?.pollStatus()
196-
}
197-
return
198-
}
199-
do {
200-
let startResult = try JSONDecoder().decode(StartResult.self, from: response)
201-
if startResult.Status == "Running" {
202-
DispatchQueue.main.async {
203-
let appDelegate = NSApplication.shared.delegate as? AppDelegate
204-
appDelegate?.pollStatus()
205-
displayNotification(title: "Successfully started Cluster", body: "OpenShift Cluster is running")
206-
}
207-
}
208-
} catch let jsonErr {
209-
displayNotification(title: "Cannot parse daemon answer", body: jsonErr.localizedDescription)
192+
showAlertFailedAndCheckLogs(message: "Failed to start OpenShift cluster", informativeMsg: "\(error)")
210193
}
211194
}
212195

0 commit comments

Comments
 (0)