feat(cli): add stable provisioning failure codes for manual and MDM installs

This commit is contained in:
Anthony Wong
2026-08-21 14:52:02 +07:00
committed by Cuong Manh Le
parent 753d245029
commit 1f001a559a
14 changed files with 1988 additions and 107 deletions
+18 -10
View File
@@ -216,22 +216,30 @@ type task struct {
Name string
}
func doTasks(tasks []task) bool {
for _, task := range tasks {
mainLog.Load().Debug().Msgf("Running task %s", task.Name)
if err := task.f(); err != nil {
if task.abortOnError {
mainLog.Load().Error().Msgf("error running task %s: %v", task.Name, err)
return false
// doTasksE runs tasks in order and reports which abortOnError task, if any,
// stopped the run. Use it over doTasks when the failure must be attributed
// to a specific task.
func doTasksE(tasks []task) (failedTaskName string, err error) {
for _, t := range tasks {
mainLog.Load().Debug().Msgf("Running task %s", t.Name)
if taskErr := t.f(); taskErr != nil {
if t.abortOnError {
mainLog.Load().Error().Msgf("error running task %s: %v", t.Name, taskErr)
return t.Name, taskErr
}
// if this is darwin stop command, dont print debug
// since launchctl complains on every start
if runtime.GOOS != "darwin" || task.Name != "Stop" {
mainLog.Load().Debug().Msgf("error running task %s: %v", task.Name, err)
if runtime.GOOS != "darwin" || t.Name != "Stop" {
mainLog.Load().Debug().Msgf("error running task %s: %v", t.Name, taskErr)
}
}
}
return true
return "", nil
}
func doTasks(tasks []task) bool {
_, err := doTasksE(tasks)
return err == nil
}
func checkHasElevatedPrivilege() {