--
You received this message because you are subscribed to the Google Groups "munki-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to munki-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On 04 Dec 2014, at 17:06, Adam M. Anklewicz <ad...@ANKLEWICZ.COM> wrote:
There are a lot of problems with Managing Printers With Munki page on the wiki and would like to make some major changes, but I’d like to make sure I’m not in the wrong in my opinions on the document.
- Even before the PKG or NOPKG methods should be the data that must be used, a collection of all variables, and how to find out printer options.
--
You received this message because you are subscribed to the Google Groups "munki-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to munki-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I look forward to playing with this as well. Have been struggling with some peculiar anomalies with our printer deployment nopkg scripts taking a long long time to run on 10.10 (they sometimes hang then show wierd errors with lpadmin and cupsenable...)
./print_generator.py --printername="MaintenanceWorkCentre" --driver="Generic_PCL_OSX.ppd" --address="x.x.x.x" --location="Maintenance Office" --displayname="MaintenanceWorkCentre" --desc="Maintenance Multi-Function Printer" --version=0.1
<?xml version="1.0" encoding="UTF-8"?>
<Printer MaintenanceWorkCentre>
UUID urn:uuid:8d333376-db9e-36d3-7df6-32a5944f1ee2
Info DISPLAY_NAME
Location Maintenance Office
MakeModel Generic PCL Laser Printer
DeviceURI lpd://ADDRESS
State Idle
StateTime 1432310434
Type 12356
Accepting Yes
Shared No
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
OpPolicy default
ErrorPolicy abort-job
</Printer>
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict> <key>autoremove</key> <false/> <key>catalogs</key> <array> <string>testing</string> </array> <key>description</key> <string></string> <key>display_name</key> <string>Maintenance WC3325</string> '-D', 'Maintenance WC3325', '-v', 'lpd://10.0.10.92', '-P', '/Library/Printers/PPDs/Contents/Resources/Generic_PCL_OSX.ppd', '-E', '-o', 'printer-is-shared=false', '-o', 'printer-error-policy=abort-job' ]
for option in printerOptions.keys(): cmd.append("-o") cmd.append(str(option) + "=" + str(printerOptions[option]))
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)(lpadminOut, lpadminErr) = proc.communicate()
if lpadminErr: print "Error: %s" % lpadminErr sys.exit(1)print "Results: %s" % lpadminOut sys.exit(0)</string> <key>unattended_install</key> <true/> <key>uninstall_method</key> <string>uninstall_script</string> <key>uninstall_script</key> <string>#!/bin/bash/usr/sbin/lpadmin -x MaintenanceWorkCentre</string> <key>uninstallable</key> <true/> <key>version</key> <string>0.3</string></dict></plist>
* Processing manifest item AddPrinter-MaintenanceWorkCentre for optional install
Looking for detail for: AddPrinter-MaintenanceWorkCentre, version latest...
Considering 1 items with name AddPrinter-MaintenanceWorkCentre from catalog testing
Considering item AddPrinter-MaintenanceWorkCentre, version 0.3 with minimum os version required 10.7.0
Our OS version is 10.10.3
Found AddPrinter-MaintenanceWorkCentre, version 0.3 in catalog testing
Running installcheck_script for AddPrinter-MaintenanceWorkCentre
installcheck_script returned 1
Running installcheck_script for AddPrinter-MaintenanceWorkCentre
installcheck_script returned 1
Adding AddPrinter-MaintenanceWorkCentre to the optional install list
* Processing manifest item AddPrinter-MaintenanceWorkCentre for install
Looking for detail for: AddPrinter-MaintenanceWorkCentre, version latest...
Considering 1 items with name AddPrinter-MaintenanceWorkCentre from catalog testing
Considering item AddPrinter-MaintenanceWorkCentre, version 0.3 with minimum os version required 10.7.0
Our OS version is 10.10.3
Found AddPrinter-MaintenanceWorkCentre, version 0.3 in catalog testing
Running installcheck_script for AddPrinter-MaintenanceWorkCentre
installcheck_script returned 1
AddPrinter-MaintenanceWorkCentre version 0.3 (or newer) is already installed.
Looking for updates for: AddPrinter-MaintenanceWorkCentre
Looking for updates for: AddPrinter-MaintenanceWorkCentre-0.3
Looking for updates for: AddPrinter-MaintenanceWorkCentre--0.3
--
You received this message because you are subscribed to the Google Groups "munki-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to munki-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
May 26 2015 16:02:07 +0200 Installing MUNKI_XEROX_US_V3 (2 of 3)
May 26 2015 16:02:07 +0200 Running postinstall_script for AddPrinter-MUNKI_XEROX_US_V3
May 26 2015 16:02:07 +0200 Traceback (most recent call last):
May 26 2015 16:02:07 +0200 File "/tmp/munki-aQZ7bh/postinstall_script", line 9, in <module>
May 26 2015 16:02:07 +0200 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
May 26 2015 16:02:07 +0200 File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 672, in __init__
May 26 2015 16:02:07 +0200 File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1202, in _execute_child
May 26 2015 16:02:07 +0200 OSError: [Errno 2] No such file or directory
May 26 2015 16:02:07 +0200 ERROR: Running postinstall_script for AddPrinter-MUNKI_XEROX_US_V3 failed.
May 26 2015 16:02:07 +0200 ERROR: ------------------------------------------------------------------------------
May 26 2015 16:02:07 +0200 ERROR: Traceback (most recent call last):
May 26 2015 16:02:07 +0200 ERROR: File "/tmp/munki-aQZ7bh/postinstall_script", line 9, in <module>
May 26 2015 16:02:07 +0200 ERROR: proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
May 26 2015 16:02:07 +0200 ERROR: File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 672, in __init__
May 26 2015 16:02:07 +0200 ERROR: File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1202, in _execute_child
May 26 2015 16:02:07 +0200 ERROR: OSError: [Errno 2] No such file or directory
May 26 2015 16:02:07 +0200 ERROR: ------------------------------------------------------------------------------
May 26 2015 16:02:07 +0200 WARNING: Postinstall script for AddPrinter-MUNKI_XEROX_US_V3 returned 1
May 26 2015 16:02:07 +0200 Installing MUNKI_XEROX_V2 (3 of 3)
May 26 2015 16:02:07 +0200 Running postinstall_script for AddPrinter-MUNKI_XEROX_V2
May 26 2015 16:02:07 +0200 Traceback (most recent call last):
May 26 2015 16:02:07 +0200 File "/tmp/munki-aQZ7bh/postinstall_script", line 9, in <module>
May 26 2015 16:02:07 +0200 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
May 26 2015 16:02:07 +0200 File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 672, in __init__
May 26 2015 16:02:07 +0200 File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1202, in _execute_child
May 26 2015 16:02:07 +0200 OSError: [Errno 2] No such file or directory
May 26 2015 16:02:07 +0200 ERROR: Running postinstall_script for AddPrinter-MUNKI_XEROX_V2 failed.
May 26 2015 16:02:07 +0200 ERROR: ------------------------------------------------------------------------------
May 26 2015 16:02:07 +0200 ERROR: Traceback (most recent call last):
May 26 2015 16:02:07 +0200 ERROR: File "/tmp/munki-aQZ7bh/postinstall_script", line 9, in <module>
May 26 2015 16:02:07 +0200 ERROR: proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
May 26 2015 16:02:07 +0200 ERROR: File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 672, in __init__
May 26 2015 16:02:07 +0200 ERROR: File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1202, in _execute_child
May 26 2015 16:02:07 +0200 ERROR: OSError: [Errno 2] No such file or directory
May 26 2015 16:02:07 +0200 ERROR: ------------------------------------------------------------------------------
May 26 2015 16:02:07 +0200 WARNING: Postinstall script for AddPrinter-MUNKI_XEROX_V2 returned 1
May 26 2015 16:02:07 +0200 ### End managed installer session ###
May 26 2015 16:02:07 +0200 Finishing...
# Install the printer
cmd = [ '/usr/sbin/lpadmin',
'-p', 'MUNKI_CX21',
'-L', '',
'-D', 'MUNKI_CX21',
'-v', 'lpd://172.16.48.5',
'-P', '/Library/Printers/PPDs/Contents/Resources//Library/Printers/PPDs/Contents/Resources/EPSON AL-CX21.gz',
'-E',
'-o', 'printer-is-shared=false',
'-o', 'printer-error-policy=abort-job' ]
'/Library/Printers/PPDs/Contents/Resources//Library/Printers/PPDs/Contents/Resources/EPSON AL-CX21.gz',
--
You received this message because you are subscribed to the Google Groups "munki-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to munki-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
OSError: [Errno 2] No such file or directory
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>autoremove</key>
<false/>
<key>catalogs</key>
<array>
<string>testing</string>
<string>production</string>
</array>
<key>description</key>
<string>RICOH Aficio MP 2500</string>
<key>display_name</key>
<string>KC Printer 3 - Ricoh MP 2500</string>
<key>installcheck_script</key>
<string>#!/usr/bin/python
import subprocess
import sys
import shlex
printerOptions = { "ColorModel":"CMYK", "RPSRGBcorrect":"DetailBright", "RPSBlackOverPrint":"False" }
cmd = ['/usr/bin/lpoptions', '-p', 'KCTYMO1.Printer3.Color', '-l']
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(lpoptLongOut, lpoptErr) = proc.communicate()
# lpoptions -p printername -l will still exit 0 even if printername does not exist
# but it will print to stderr
if lpoptErr:
print lpoptErr
sys.exit(0)
cmd = ['/usr/bin/lpoptions', '-p', 'KCTYMO1.Printer3.Color']
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(lpoptOut, lpoptErr) = proc.communicate()
#Note: lpoptions -p printername will never fail. If KCTYMO1.Printer3.Color does not exist, it
#will still exit 0, but just produce no output.
#Thanks, cups, I was having a good day until now.
for option in lpoptLongOut.splitlines():
for myOption in printerOptions.keys():
optionName = option.split("/", 1)[0]
optionValues = option.split("/",1)[1].split(":")[1].strip().split(" ")
for opt in optionValues:
if "*" in opt:
actualOptionValue = opt.replace('*', '')
break
if optionName == myOption:
if not printerOptions[myOption] == actualOptionValue:
print "Found mismatch: %s is '%s', should be '%s'" % (myOption, printerOptions[myOption], actualOptionValue)
sys.exit(0)
optionDict = dict()
for builtOption in shlex.split(lpoptOut):
optionDict[builtOption.split("=")[0]] = builtOption.split("=")[1]
comparisonDict = { "device-uri":"KCTYMO1.Printer3.Color", "printer-info":"KC Printer 3 - Ricoh C2500", "printer-location":"Kansas City", "printer-make-and-model":"RICOH Aficio MP 2500" }
for keyName in comparisonDict.keys():
if not comparisonDict[keyName] == optionDict[keyName]:
print "Settings mismatch: %s is '%s', should be '%s'" % (keyName, optionDict[keyName], comparisonDict[keyName])
sys.exit(0)
sys.exit(1)</string>
<key>installer_type</key>
<string>nopkg</string>
<key>minimum_os_version</key>
<string>10.7.0</string>
<key>name</key>
<string>AddPrinter_KCTYMO1.Printer3.Color</string>
<key>postinstall_script</key>
<string>#!/usr/bin/python
import subprocess
import sys
# Populate these options if you want to set specific options for the printer. E.g. duplexing installed, etc.
printerOptions = { "ColorModel":"CMYK", "RPSRGBcorrect":"DetailBright", "RPSBlackOverPrint":"False" }
cmd = [ '/usr/sbin/lpadmin', '-x', 'KCTYMO1.Printer3.Color' ]
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(lpadminxOut, lpadminxErr) = proc.communicate()
# Install the printer
cmd = [ '/usr/sbin/lpadmin',
'-p', 'KCTYMO1.Printer3.Color',
'-L', 'Kansas City',
'-D', 'KC Printer 3',
'-v', 'lpd://myprintserver/KCTYMO1.Printer3.Color',
'-P', '/Library/Printers/PPDs/Contents/Resources/RICOH Aficio MP 2500',
'-E',
'-o', 'printer-is-shared=false',
'-o', 'printer-error-policy=abort-job' ]
for option in printerOptions.keys():
cmd.append("-o")
cmd.append(str(option) + "=" + str(printerOptions[option]))
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(lpadminOut, lpadminErr) = proc.communicate()
if lpadminErr:
print "Error: %s" % lpadminErr
sys.exit(1)
print "Results: %s" % lpadminOut
sys.exit(0)</string>
<key>unattended_install</key>
<true/>
<key>uninstall_method</key>
<string>uninstall_script</string>
<key>uninstall_script</key>
<string>#!/bin/bash
/usr/sbin/lpadmin -x KCTYMO1.Printer3.Color</string>
<key>uninstallable</key>
<true/>
<key>version</key>
<string>1.0</string>
</dict>
</plist>
To unsubscribe from this group and stop receiving emails from it, send an email to munki-dev+unsubscribe@googlegroups.com.
There are a lot of problems with Managing Printers With Munki page on the wiki and would like to make some major changes, but I’d like to make sure I’m not in the wrong in my opinions on the document.
- Introduction: Mentioning the downfalls of MCX without mentioning how Munki can relieve this
- PKG vs NOPKG: It seems silly that the nopkg method is second, as it requires no extra software, and honestly seems easier.
- There’s a lot of mentions of I, that should probably change. ("I am using The Luggage to build the packages to install the printers." Should be, “The following method uses The Luggage, however any packager can be used."
- All examples seem to use different printers and different versions. This should be merged to one for example purposes.
- Even before the PKG or NOPKG methods should be the data that must be used, a collection of all variables, and how to find out printer options.
- “There are some pros and cons to this approach, but here’s the method” leaves you hanging, no need to have this and it will be addressed later in the file.
- Replace "As of Munki 0.8.3.1634, there is now a "nopkg" type for package-free installation. This allows us to run scripts directly in Munki without having to create packages to install. We can use this "nopkg" type to run all of our printer installs from Munki pkginfos, which allows for easy editing in the future.” with "Requirements: Munki 0.8.3.1634 or later.”
- Why is there a step 1.5, it should either be 1, 2, 3 or just Step 1, create three necessary scripts. Probably three steps.
- Makes the call "makepkginfo --installcheck_script=installcheck_script.sh --uninstall_script=uninstall_script.sh > printer.pkginfo” and forgets to include postintall_script.sh
- Has the super-vague instruction "Fill in the rest of the important things into the pkginfo”. Later says these are description, display_name, name, and version. If we have before all the possible variables, we can just tell the user to run "/usr/local/munki/makepkginfo —name=NAME —displayname=DISPLAYNAME —description=DESCRIPTION —pkgvers=VERSION -c CATALOG —developer=DEVELOPER —category=CATEGORY --nopkg --installcheck_script=installcheck_script.sh --uninstall_script=uninstall_script.sh --postinstall_script=postinstall_script.sh > NOPKGNAME.pkginfo”
- "Throw your pkginfo into your Munki repo and makecatalogs. Add it to a manifest, and test it out!” should be two steps, “Place in /PATH/TO/munki_repo/pkginfo” then another step of run makecatalogs
Now, I noticed that none of these computers seem to have PPDs for Printers. So when I go to ARD and give it a:lpadmin -p "5B-LJP2015" -v "lpd://5A-LJP2015" -D "5A-LJP2015" -L "5A Classroom" -P "/Library/Printers/PPDs/Contents/Resources/HP LaserJet P2015.gz" -EIt returns an error as the .gz files aren't there.How does one fix this?