jamf / mut

MIT License
133 stars 10 forks source link

"ALREADY_SCOPED" code when attempting to add to prestage. #56

Closed wantedwriter closed 2 years ago

wantedwriter commented 3 years ago

Running a Jamf Pro 10.26.0 environment, attempting to assign a batch of serial numbers to a prestage enrollment results in "Failed to scope update: 400" with a bunch of "aleady_scoped" codes. Preflight checks out just fine...tried with a fresh local admin user and various .CSV formats (including the provided templates). Also tried creating a brand new prestage and using that ID as well -- we've used this plenty of times in the past so I'm not sure what's going on. Attempting to remove from the existing prestage first results in the same behavior, even though we haven't needed to do that in the past.

Has anyone else encountered issues with this yet? (Removed serial number from description for privacy/security).

2021-01-22 04:03:44 [ERROR ]: Failed scope update. 400. 2021-01-22 04:03:44 [ERROR ]: { "httpStatus" : 400, "errors" : [ { "code" : "ALREADY_SCOPED", "description" : "removed", "id" : "0", "field" : "serialNumbers" }

tranziq commented 3 years ago

I am having the same issue, I am using the option to replace existing prestage and it states ALREADY_SCOPED. which is kind-of the point. I am trying to swap Prestages

2021-04-23 04:00:37 [INFO ]: Token has 546 seconds left to live. Proceeding with current token. 2021-04-23 04:00:37 [INFO ]: Beginning CSV Parse - Scope update. 2021-04-23 04:00:37 [INFO ]: Getting current prestage scope from https://myjamfserver/uapi/v2/computer-prestages/4/scope 2021-04-23 04:00:38 [INFO ]: Successful GET completed. 200. 2021-04-23 04:00:38 [INFO ]: Updating the current prestage scope at https://myjamfserver/uapi/v2/computer-prestages/4/scope 2021-04-23 04:00:40 [ERROR ]: Failed scope update. 400. 2021-04-23 04:00:40 [ERROR ]: { "httpStatus" : 400, "errors" : [ { "code" : "ALREADY_SCOPED", "description" : "D25xxxxxF8J7", "id" : "0", "field" : "serialNumbers"

cosmicshibe commented 3 years ago

Encountering the same issue on Jamf 10.26.1. Doesn't matter if it's removing, adding, or updating, all serial numbers return ALREADY_SCOPED.

2021-06-16 09:32:44 [INFO  ]: Token has 1692 seconds left to live. Proceeding with current token.
2021-06-16 09:32:44 [INFO  ]: Beginning CSV Parse - Scope update.
2021-06-16 09:32:44 [INFO  ]: Getting current prestage scope from https://jamfserver/uapi/v1/mobile-device-prestages/51/scope
2021-06-16 09:32:44 [INFO  ]: Successful GET completed. 200.
2021-06-16 09:32:44 [INFO  ]: Updating the current prestage scope at https://jamfservr/uapi/v1/mobile-device-prestages/51/scope
2021-06-16 09:32:44 [ERROR ]: Failed scope update. 400.
2021-06-16 09:32:44 [ERROR ]: {
  "httpStatus" : 400,
  "errors" : [ {
    "code" : "ALREADY_SCOPED",
    "description" : "DxxxxxxxxxxJ",
    "id" : "0",
    "field" : "serialNumbers"
  }, 

etc for a few hundred more entries.

cjduckk commented 3 years ago

Encountering the same issue when doing "Replace Existing Prestage" for Mobile Devices, JAMF 10.29.1.

2021-07-27 08:23:47 [INFO ]: Token has 694 seconds left to live. Proceeding with current token. 2021-07-27 08:23:47 [INFO ]: Beginning CSV Parse - Scope update. 2021-07-27 08:23:47 [INFO ]: Getting current prestage scope from https://myserver/uapi/v2/mobile-device-prestages/54/scope 2021-07-27 08:23:47 [INFO ]: Successful GET completed. 200. 2021-07-27 08:23:47 [INFO ]: Updating the current prestage scope at https://myserver/uapi/v2/mobile-device-prestages/54/scope 2021-07-27 08:23:47 [ERROR ]: Failed scope update. 400. 2021-07-27 08:23:47 [ERROR ]: { "httpStatus" : 400, "errors" : [ { "code" : "ALREADY_SCOPED", "description" : "DxxxxxxxxxxJ", "id" : "0", "field" : "serialNumbers" }

jfiliceatcsumb commented 3 years ago

Same as above for me. Jamf Pro cloud v.10.30.3. Failed Add to Prestage, Remove from Prestage, and Replace Existing Prestage commands. I have no idea what to try next.

2021-08-06 02:28:08 [INFO  ]: Token has 990 seconds left to live. Proceeding with current token.
2021-08-06 02:28:08 [INFO  ]: Beginning CSV Parse - Scope update.
2021-08-06 02:28:08 [INFO  ]: Getting current prestage scope from https://xx.jamfcloud.com/uapi/v2/computer-prestages/3/scope
2021-08-06 02:28:08 [INFO  ]: Successful GET completed. 200.
2021-08-06 02:28:08 [INFO  ]: Updating the current prestage scope at https://xx.jamfcloud.com/uapi/v2/computer-prestages/3/scope/delete-multiple
2021-08-06 02:28:08 [ERROR ]: Failed scope update. 400.
2021-08-06 02:28:08 [ERROR ]: {
  "httpStatus" : 400,
  "errors" : [ {
    "code" : "ALREADY_SCOPED",
    "description" : "Cxxxxxxxxxxx",
    "id" : "0",
    "field" : "serialNumbers"
  }, {
    "code" : "ALREADY_SCOPED",
    "description" : "Dxxxxxxxxxxx",
    "id" : "0",
    "field" : "serialNumbers"
  }, 
mike-levenick commented 3 years ago

Hi folks. Interesting. Hoping you can help shed a bit more light on this for me. Are these devices already scoped to the prestage? It's listing out specific devices in the error it looks like--anything special about those devices? Are they relatively new devices? Or very old? Any chance this is a DEP sync issue?

How big are the runs you're trying to do? If you remove that one or two device from the list, does the rest of the run go through successfully? or does it find a different device with issues?

jfiliceatcsumb commented 3 years ago

Hmmm... It actually did work when I loaded a subset of 43 items out of the original 249. MUT performed Remove, Replace, and Add commands.

wantedwriter commented 3 years ago

I think this was probably user error. If the devices are already assigned to the prestage it seems it fails. After removing them and running them thru again all appeared to work as expected.

jfiliceatcsumb commented 3 years ago

Yes, the behavior seems consistent with that explanation.

It’s frustrating that the api is so unforgiving. I wish MUT had a way to toggle between uploading device changes all at once versus in series (a la classic MUT). That seems a reasonable fallback option when it’s not clear which device is causing the command failure.

mike-levenick commented 2 years ago

@jfiliceatcsumb @cjduckk @wantedwriter @tranziq @cosmicshibe

I think you'll be excited to know I just released MUT v6, which has this exact feature. Check it out, and let me know how it works! https://github.com/mike-levenick/mut/releases/tag/v6.0.0

You can read more about Classic Mode updates here: https://github.com/mike-levenick/mut#classic-mode-groupprestage-updates

As always with MUT, I strongly recommend trying out a small, test run of just a few devices before doing a massive update to your entire fleet. MUT is a very powerful tool, and while I've done plenty of testing, it is good to be careful, especially with a change as massive as this.

cosmicshibe commented 2 years ago

Hey Mike thanks for the update. Just tested it out on a small group and seems to be working well. Won't have any large deployments for awhile but looking forward to using it.

On Thu, Oct 21, 2021 at 9:59 AM Mike Levenick @.***> wrote:

@jfiliceatcsumb https://github.com/jfiliceatcsumb @cjduckk https://github.com/cjduckk @wantedwriter https://github.com/wantedwriter @tranziq https://github.com/tranziq @cosmicshibe https://github.com/cosmicshibe

I think you'll be excited to know I just released MUT v6, which has this exact feature. Check it out, and let me know how it works! https://github.com/mike-levenick/mut/releases/tag/v6.0.0

You can read more about Classic Mode updates here: https://github.com/mike-levenick/mut#classic-mode-groupprestage-updates

As always with MUT, I strongly recommend trying out a small, test run of just a few devices before doing a massive update to your entire fleet. MUT is a very powerful tool, and while I've done plenty of testing, it is good to be careful, especially with a change as massive as this.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mike-levenick/mut/issues/56#issuecomment-948645880, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGRF2KZAMSJ7IUYB2GDQLTUIAMCXANCNFSM4WPDKKXQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

jfiliceatcsumb commented 2 years ago

Awesome, thank you so much! I can’t wait to try it.

On Thu, Oct 21, 2021 at 6:59 AM Mike Levenick @.***> wrote:

@jfiliceatcsumb https://github.com/jfiliceatcsumb @cjduckk https://github.com/cjduckk @wantedwriter https://github.com/wantedwriter @tranziq https://github.com/tranziq @cosmicshibe https://github.com/cosmicshibe

I think you'll be excited to know I just released MUT v6, which has this exact feature. Check it out, and let me know how it works! https://github.com/mike-levenick/mut/releases/tag/v6.0.0

You can read more about Classic Mode updates here: https://github.com/mike-levenick/mut#classic-mode-groupprestage-updates

As always with MUT, I strongly recommend trying out a small, test run of just a few devices before doing a massive update to your entire fleet. MUT is a very powerful tool, and while I've done plenty of testing, it is good to be careful, especially with a change as massive as this.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mike-levenick/mut/issues/56#issuecomment-948645880, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB2RPK4Y26MKVMQPP4HCWQLUIAMCXANCNFSM4WPDKKXQ .

-- -- Jason Filice @.*** (831) 582-4483 (office) (831) 275-5180 (Google Voice) Technology Support Services in IT IT Services Building https://csumb.edu/directory/buildings/it-services California State University, Monterey Bay csumb.edu/it (831) 582-HELP

tommytaddler commented 1 year ago

Hey Mike,

To clarify, when moving computers from one PreStage, (listed in the csv file) to the PreStage (ID) defined, using the 'Add to Prestage' option is correct? I'm finding the computers require not to be selected for the move to occur, is this expected behaviour? Apologies in advance if I've missed something, we wanting to move a few thousand computers (only selected computers in PreStage) from a broken PreStage to newly created one.

Great tool, have used before on a SCEP project with a few thousand endpoints, thankyou.

R,

J

Screenshot 2023-02-09 at 3 49 02 pm

?