installapplications icon indicating copy to clipboard operation
installapplications copied to clipboard

If a user script fails, InstallApplications should stop running

Open erikng opened this issue 5 years ago • 2 comments

if root scripts fail multiple times, the run will stop, however if a user script fails, the run will keep going.

This is could be problematic for environments that need the user section to complete successfully. With https://github.com/macadmins/installapplications/commit/5218c9683c0ec72e784106611a93eafb5b0ed20f I fixed the infinite looping when not exiting 0, but introduced this issue.

This will be a difficult one to solve since the user side runs in a different process and we cannot capture the state of the run itself.

erikng avatar Jul 23 '20 21:07 erikng

I've been pondering this as well in my testing...

Currently, I've been unloading IA's LaunchDaemon from within the user script if it fails. That method is less than ideal and requires some hacking.

An idea (haven't tested this):

  • Perhaps after iaslog('Failed to run user script!') in https://github.com/macadmins/installapplications/commit/5218c9683c0ec72e784106611a93eafb5b0ed20f we could drop another artifact (eg. touch a file)?
  • Then, in the IA main process, when the while os.path.isfile(userscripttouchpath): process breaks, we could check if that artifact is present and stop the run there?

bfreezy avatar Sep 18 '20 18:09 bfreezy

That's a pretty good idea.

erikng avatar Sep 21 '20 20:09 erikng