mm2270 / JamfProScripts

A collection of shell scripts created for use in Jamf Pro and elsewhere
MIT License
172 stars 30 forks source link

download_jss_scripts.sh downloads are empty #12

Open smashism opened 6 years ago

smashism commented 6 years ago

Heya, when running the download_jss_scripts.sh script all the files being downloaded are totally empty. I also get this error for each script:

DEBUG: Script name is: Microsoft Lync Uninstall
DEBUG: Script extension is: Microsoft Lync Uninstall
Downloaded script "Microsoft Lync Uninstall.sh"...
-:10: parser error : Opening and ending tag mismatch: br line 8 and p
</p>
    ^
-:11: parser error : Opening and ending tag mismatch: p line 8 and body
</body>
       ^
-:12: parser error : Opening and ending tag mismatch: body line 5 and html
</html>
       ^
-:13: parser error : Premature end of data in tag html line 1

^

Since I get that for each script download attempted it does not seem to be an issue with the scripts themselves since they can't all be completely identical.

mm2270 commented 6 years ago

Hey Emily, thanks for the heads up. Been a while since I worked these scripts against a current Jamf Pro setup. I will take a look at it and see what needs to be updated. Just so I know I'm working against the correct setup, what version of Jamf Pro are you running it against that's throwing those errors?

mm2270 commented 6 years ago

@smashism Ok, never mind. I was able to find the issue. Oddly enough, the problem was mostly from the curl header -H "Accept: application/xml" being after the -u flag for the username/password credentials. I don't know why, but placing it first addressed the main issue. I also cleaned up the script a little. Change on line 156 from using xmllint and passing the results through a bunch of crazy sed commands to get the script contents. It now uses xpath and goes right to script_contents to get just the script by itself. Much cleaner.

The script is now updated with the above changes. Please give it a try and let me know when you have time if it's working for you now.

smashism commented 6 years ago

Worked swimmingly!

Is it possible that similar tweaks might be required by the EA download as well? I have a few EAs that skip some lines on the download/save for some reason, not sure why 🤔

mm2270 commented 6 years ago

Yes, I might need to go look at that script as well as they use similar code to pull down the script content. Glad this one is working now though!

dorminyk commented 3 years ago

I've copied this script from the main page and I'm running into the same issue that the OP ran into... I haven't made any changes to my script...