From c9f08231770c9b58f0c1657b6ad9a4f509338ea6 Mon Sep 17 00:00:00 2001 From: Maurice Breit Date: Fri, 24 Jul 2026 14:49:23 +0200 Subject: [PATCH] fix ascAppUpload step --- cmd/ascAppUpload_test.go | 4 ---- pkg/asc/asc.go | 12 +++++++----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/cmd/ascAppUpload_test.go b/cmd/ascAppUpload_test.go index 3360187cdd..faa476fab4 100644 --- a/cmd/ascAppUpload_test.go +++ b/cmd/ascAppUpload_test.go @@ -73,7 +73,6 @@ func TestRunAscAppUpload(t *testing.T) { AppId: 1, AppName: "Sample App", BundleId: "sample.bundle.id", - JamfId: "1", }, createReleaseResponse: asc.CreateReleaseResponse{ Status: "success", @@ -112,7 +111,6 @@ func TestRunAscAppUpload(t *testing.T) { AppId: 1, AppName: "Sample App", BundleId: "sample.bundle.id", - JamfId: "1", }, createReleaseResponse: asc.CreateReleaseResponse{Status: "failure", Message: errorMessage}, } @@ -141,7 +139,6 @@ func TestRunAscAppUpload(t *testing.T) { AppId: 1, AppName: "Sample App", BundleId: "sample.bundle.id", - JamfId: "1", }, createReleaseResponse: asc.CreateReleaseResponse{Status: "success", Data: asc.Release{ReleaseID: 1}}, jamfAppInfoError: errors.New(errorMessage), @@ -169,7 +166,6 @@ func TestRunAscAppUpload(t *testing.T) { AppId: 1, AppName: "Sample App", BundleId: "sample.bundle.id", - JamfId: "1", }, createReleaseResponse: asc.CreateReleaseResponse{Status: "success", Data: asc.Release{ReleaseID: 1}}, jamfAppInfo: asc.JamfAppInformationResponse{ diff --git a/pkg/asc/asc.go b/pkg/asc/asc.go index 4476150bdb..12b2a7b471 100644 --- a/pkg/asc/asc.go +++ b/pkg/asc/asc.go @@ -22,7 +22,6 @@ type App struct { AppId int `json:"app_id"` AppName string `json:"app_name"` BundleId string `json:"bundle_id"` - JamfId string `json:"jamf_id"` } type JamfAppInformationResponse struct { @@ -124,15 +123,18 @@ func sendRequest(sys *SystemInstance, method, url string, body io.Reader, header // GetAppById returns the app addressed by appId from the ASC backend func (sys *SystemInstance) GetAppById(appId string) (App, error) { sys.logger.Debugf("Getting ASC App with ID %v...", appId) - var app App data, err := sendRequest(sys, http.MethodGet, fmt.Sprintf("api/v1/apps/%v", appId), nil, nil) if err != nil { - return app, fmt.Errorf("fetching app %v failed: %w", appId, err) + return App{}, fmt.Errorf("fetching app %v failed: %w", appId, err) } - json.Unmarshal(data, &app) - return app, nil + var apps []App + json.Unmarshal(data, &apps) + if len(apps) == 0 { + return App{}, fmt.Errorf("no app found with id %v", appId) + } + return apps[0], nil } // CreateRelease creates a release in ASC