Casper-API icon indicating copy to clipboard operation
Casper-API copied to clipboard

Stage 2: Getting all JSS policy IDs... -:1: parser error : Document is empty

Open chriszanf opened this issue 6 years ago • 8 comments

Whern running the Create-JSS-Policy-Scope-Report.sh script, I get the following....

./Create-JSS-Policy-Scope-Report.sh
Stage 1: Creating directory structure...

Stage 2: Getting all JSS policy IDs...
-:1: parser error : Document is empty

^
Placing all policy names and IDs into arrays...

Stage 3: Obtaining scope values from all JSS policies...
Done.
Creating initial csv file header...

Stage 4: Scanning all policy scope details and creating report...
warning: failed to load external entity "/Users/xxxx/Library/Application Support/_JSS_REPORT/_POLICY_DATA/.xml"
warning: failed to load external entity "/Users/xxxx/Library/Application Support/_JSS_REPORT/_POLICY_DATA/.xml"
warning: failed to load external entity "/Users/xxxx/Library/Application Support/_JSS_REPORT/_POLICY_DATA/.xml"
warning: failed to load external entity "/Users/xxxx/Library/Application Support/_JSS_REPORT/_POLICY_DATA/.xml"
warning: failed to load external entity "/Users/xxxx/Library/Application Support/_JSS_REPORT/_POLICY_DATA/.xml"

Stage 5: Final cleanup. Removing temp files and making final adjustments to the report...

Run time: 0 seconds...

Report complete. The final file is located in: /Users/xxxx/Library/Application Support/_JSS_REPORT/ and is named "POLICY_REPORT.csv". Opening enclosing directory...

chriszanf avatar Jul 16 '18 14:07 chriszanf

I am having the same issue. Were you able to resolve it?

TexasITAdmin avatar Feb 13 '19 15:02 TexasITAdmin

Never got it resolved. I think it you need a cert to install a machine-wide profile. I gave up and just wait for Jamf to push the config profile. I have a smart collection that checks to make sure a kext profile is installed before trying to install software.

Clarence Helm Sr. IT Support Engineer/Consultant Office of Information Technologies 251 O’Shaughnessy Hall, Notre Dame, IN 46556 574-631-8481

On Wed, Feb 13, 2019 at 10:42 AM TexasITAdmin [email protected] wrote:

I am having the same issue. Were you able to resolve it?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mm2270/Casper-API/issues/5#issuecomment-463248009, or mute the thread https://github.com/notifications/unsubscribe-auth/AGzImVs_ogzZfK-tb4ggwQcssJPARs5Aks5vNDJngaJpZM4VRMO6 .

chelmND avatar Feb 13 '19 15:02 chelmND

I think i found the issue for me. Its silly really. Not sure how it could have worked before because all the curl-ing i've ever done has had to have a GET POST etc... There is no "GET" in the curl urls. Change each curl instance to include a "GET" For example change: curl -H "Accept: text/xml" -sfku "${apiuser}:${apipass}" To: curl -H "Accept: text/xml" -sfku "${apiuser}:${apipass}" GET Followed by the rest of the api url. so one full line would be like: curl -H "Accept: text/xml" -sfku "${apiuser}:${apipass}" GET "${jssurl}/JSSResource/policies/id/${PolicyID}"

The report finished running and generated the expected results. Hopefully just missing the GET is all you need to.

Jason Folsom Network Engineer Plano ISD

TexasITAdmin avatar Feb 13 '19 16:02 TexasITAdmin

If that worked for you I'll maybe submit a change request or whatever it is.... I've never actually found a problem with a script on github and submitted a fix before (or any open source project really).

TexasITAdmin avatar Feb 13 '19 16:02 TexasITAdmin

Hi there. Sorry I haven't addressed some of the issues being reported. For a while there, it was difficult for me to do any more effective testing, as I only had access to an outdated version of Jamf Pro. Now that that's changed, I will work on finding time to circle back and start updating some of these scripts to make sure they work with the current releases.

As to the issue being reported, in older versions of Jamf Pro, the GET wasn't a requirement. If there was nothing specified in the curl command, it would assume it was GET'ting information. It was only needed if you wanted to do a PUT, POST or DELETE. But it's certainly possible that it's needed now. Anyway, it's probably best practice to include the type of request in the curl command, so I should have included that. I'll look at updating the script with those changes and mention the correction you found in the change log. Thanks!

mm2270 avatar Feb 13 '19 16:02 mm2270

Awesome thanks! And thanks for making something Jamf should have made in the first place. The JSS-Package Report is what i came here for. Thanks to the first report I was able to clear out 27 depreciated packages.

TexasITAdmin avatar Feb 13 '19 16:02 TexasITAdmin

Also, i forgot to mention that in addition to adding GET I had to remove the port number from the jss address as well Those two changes: Add GET to curl url remove port # from jss address.

TexasITAdmin avatar Feb 13 '19 16:02 TexasITAdmin

Further testing today and I think its actually just 100% removing the port from our cloud instance url that corrected the issue. GET is not required (but like you said is best practice).

Also, I am modifying the packages report script to bring up the same type of report but for scripts. Not sure if there's any interest is something like that but I know i have 87 scripts and cleaning those up is a bigger pain than the packages.

TexasITAdmin avatar Feb 14 '19 16:02 TexasITAdmin