alectrona / git4jamfpro

A tool designed for CI/CD pipelines that uploads the most recently changed scripts and extension attributes in source control to a Jamf Pro server(s).
42 stars 16 forks source link

xml parse errors #6

Closed w0 closed 1 year ago

w0 commented 1 year ago

On some scripts, when making changes or trying to upload new. I get an error similar to this.

-:-1.0: unterminated entity reference & echo "Uninstalling ATP" && /usr/local/McAfee/uninstall ATP

This will cause the modified script to be empty in jamf pro. Here is the full line in question

[[ -f "/usr/local/McAfee/uninstall" ]] && echo "Uninstalling ATP" && /usr/local/McAfee/uninstall ATP

It seems to be unhappy with my usage of &&?

This line in another script tripped it up, with the following error. -:18.34: xmlParseEntityRef: no name /usr/bin/caffeinate -d -i -m -u & caffeinatePID=$!. This failed at script creation.

/usr/bin/caffeinate -d -i -m -u & caffeinatePID=$!
ryangball commented 1 year ago

Hey @w0, try to pull the latest version. What I did in #7 should resolve the issue.

w0 commented 1 year ago

Got a new error this time!

cat: '<?xml version="1.0" encoding="UTF-8"?>'$'\n''<script>'$'\n''  <name>Deployment</name>'$'\n''  <category>Scripts</category>'$'\n''  <info>Installs software before deployment</info>'$'\n''  <notes/>'$'\n''  <priority>After</priority>'$'\n''  <parameters>'$'\n''    <parameter4>Deployment Name</parameter4>'$'\n''  </parameters>'$'\n''  <os_requirements/>'$'\n''</script>': No such file or directory
-:1.1: Document is empty
^
AllPurposeBen commented 1 year ago

Getting the same:

Determining changes between the last two git commits...

cat: '<?xml version="1.0" encoding="UTF-8"?>'$'\n''<script>'$'\n''  <name>FireEye Uninstall</name>'$'\n''  <category>Security</category>'$'\n''  <info>This script will uninstall the FireEye client.</info>'$'\n''  <notes/>'$'\n''  <priority>After</priority>'$'\n''  <parameters/>'$'\n''  <os_requirements/>'$'\n''</script>': No such file or directory
-:1.1: Document is empty

^
Could not determine name of script from the xml record, skipping.

That tracks back to line 87 and I think this issue might be a cat where an echo should be on that line. Fixed it on my local and is working, I'll update my fork and submit a PR for the fix here shortly.

ryangball commented 1 year ago

This should be fixed with #9 and #10.