v1.4 = Resolved issue caused by large ppd files

+ Large .ppd files caused curl to error with "argument list to long" -- resolved this by reading configuration from stdin instead of as cli arguments
This commit is contained in:
Zack T
2018-03-23 13:43:36 -07:00
parent 3944c4fd8d
commit aba92a20e9

View File

@@ -3,7 +3,7 @@
###################################################################################################
# Script Name: jamf_CreatePrinters.sh
# By: Zack Thompson / Created: 3/1/2018
# Version: 1.3 / Updated: 3/23/2018 / By: ZT
# Version: 1.4 / Updated: 3/23/2018 / By: ZT
#
# Description: The purpose of this script is to assist Site Admins in creating Printers in Jamf without needing to use the Jamf Admin utility.
#
@@ -78,7 +78,8 @@ createPrinter() {
echo " "
# POST changes to the JSS.
curlReturn="$(/usr/bin/curl "${curlAPI[@]}" POST ${apiPrinters}/0 --data "<printer>
curlReturn="$(/usr/bin/curl "${curlAPI[@]}" POST ${apiPrinters}/0 --data @- <<printerConfig
<printer>
<name>$printerName</name>
<category>Printers</category>
<uri>${printerIP}</uri>
@@ -89,7 +90,8 @@ createPrinter() {
<ppd>${printerCUPsName}.ppd</ppd>
<ppd_contents>${printerPPDContents}</ppd_contents>
<ppd_path>/Library/Printers/PPDs/Contents/Resources/${printerCUPsName}.ppd</ppd_path>
</printer>")"
</printer>
printerConfig)"
# Get the Exit Code
exitCode=$?