refactor: surface errors when running reports
This commit is contained in:
@@ -18,14 +18,14 @@ type Resource struct {
|
||||
}
|
||||
|
||||
// ReportSingleApp is an internal function that displays the app report for one or more apps
|
||||
func ReportSingleApp(appName, infoFlag string) {
|
||||
func ReportSingleApp(appName, infoFlag string) error {
|
||||
if err := common.VerifyAppName(appName); err != nil {
|
||||
common.LogFail(err.Error())
|
||||
return err
|
||||
}
|
||||
|
||||
resources, err := common.PropertyGetAll("resource", appName)
|
||||
if err != nil {
|
||||
return
|
||||
return err
|
||||
}
|
||||
|
||||
infoFlags := map[string]string{}
|
||||
@@ -36,7 +36,7 @@ func ReportSingleApp(appName, infoFlag string) {
|
||||
|
||||
trimPrefix := true
|
||||
uppercaseFirstCharacter := false
|
||||
common.ReportSingleApp("resource", appName, infoFlag, infoFlags, trimPrefix, uppercaseFirstCharacter)
|
||||
return common.ReportSingleApp("resource", appName, infoFlag, infoFlags, trimPrefix, uppercaseFirstCharacter)
|
||||
}
|
||||
|
||||
// GetResourceValue fetches a single value for a given app/process/request/key combination
|
||||
|
||||
@@ -37,7 +37,7 @@ func main() {
|
||||
err = resource.TriggerPostDelete(appName)
|
||||
case "report":
|
||||
appName := flag.Arg(0)
|
||||
resource.ReportSingleApp(appName, "")
|
||||
err = resource.ReportSingleApp(appName, "")
|
||||
case "resource-get-property":
|
||||
appName := flag.Arg(0)
|
||||
processType := flag.Arg(1)
|
||||
|
||||
@@ -29,7 +29,7 @@ func CommandLimitClear(args []string, processType string) error {
|
||||
}
|
||||
|
||||
// CommandReport displays a resource report for one or more apps
|
||||
func CommandReport(appName string, infoFlag string) {
|
||||
func CommandReport(appName string, infoFlag string) error {
|
||||
if strings.HasPrefix(appName, "--") {
|
||||
infoFlag = appName
|
||||
appName = ""
|
||||
@@ -38,15 +38,17 @@ func CommandReport(appName string, infoFlag string) {
|
||||
if len(appName) == 0 {
|
||||
apps, err := common.DokkuApps()
|
||||
if err != nil {
|
||||
return
|
||||
return err
|
||||
}
|
||||
for _, appName := range apps {
|
||||
ReportSingleApp(appName, infoFlag)
|
||||
if err := ReportSingleApp(appName, infoFlag); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return
|
||||
return nil
|
||||
}
|
||||
|
||||
ReportSingleApp(appName, infoFlag)
|
||||
return ReportSingleApp(appName, infoFlag)
|
||||
}
|
||||
|
||||
// CommandReserve implements resource:reserve
|
||||
|
||||
Reference in New Issue
Block a user