$ autopkg run XeroxPrinterDrivers.munki.recipe -v
Traceback (most recent call last):
File "/usr/local/bin/autopkg", line 1365, in <module>
sys.exit(main(sys.argv))
File "/usr/local/bin/autopkg", line 1359, in main
exit(subcommands[verb]['function'](argv))
File "/usr/local/bin/autopkg", line 1146, in run_recipes
recipe = load_recipe(recipe_path, override_dirs, search_dirs)
File "/usr/local/bin/autopkg", line 269, in load_recipe
recipe = load_recipe(parent_id, [], recipe_dirs)
File "/usr/local/bin/autopkg", line 251, in load_recipe
name, override_dirs + recipe_dirs)
File "/usr/local/bin/autopkg", line 170, in find_recipe_by_identifier
if get_identifer_from_recipe_file(match) == identifier:
File "/usr/local/bin/autopkg", line 154, in get_identifer_from_recipe_file
recipe_plist = read_recipe_plist(filename)
File "/usr/local/bin/autopkg", line 118, in read_recipe_plist
log_err("WARNING: plist error for %s: %s" % (filename, unicode(err)))
File "/usr/local/bin/autopkg", line 54, in log_err
log(msg, error=True)
File "/usr/local/bin/autopkg", line 47, in log
print >> sys.stderr, msg
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 182: ordinal not in range(128)
<?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>Description</key>
<string>Downloads the latest version of the Apple provided Xerox Printer Drivers and imports them into Munki.</string>
<key>Identifier</key>
<string>com.github.n8felton.munki.XeroxPrinterDrivers</string>
<key>Input</key>
<dict>
<key>MUNKI_REPO_SUBDIR</key>
<string>Printers/Drivers</string>
<key>pkginfo</key>
<dict>
<key>catalogs</key>
<array>
<string>testing</string>
</array>
<key>description</key>
<string>Provides the latest Xerox printing and scanning software for OS X.</string>
<key>display_name</key>
<string>Xerox Printer Drivers</string>
<key>name</key>
<string>%NAME%</string>
</dict>
</dict>
<key>MinimumVersion</key>
<string>0.2.0</string>
<key>ParentRecipe</key>
<string>com.github.n8felton.download.XeroxPrinterDrivers</string>
<key>Process</key>
<array>
<dict>
<key>Processor</key>
<string>AppleSupportVersioner</string>
<key>Arguments</key>
<dict>
<key>path_name</key>
<string>%pathname%</string>
</dict>
</dict>
<dict>
<key>Processor</key>
<string>MunkiPkginfoMerger</string>
<key>Arguments</key>
<dict>
<key>additional_pkginfo</key>
<dict>
<key>version</key>
<string>%version%</string>
</dict>
</dict>
</dict>
<dict>
<key>Processor</key>
<string>MunkiImporter</string>
<key>Arguments</key>
<dict>
<key>pkg_path</key>
<string>%pathname%</string>
<key>repo_subdirectory</key>
<string>%MUNKI_REPO_SUBDIR%</string>
</dict>
</dict>
</array>
</dict>
</plist>
<?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>Description</key>
<string>Downloads the latest version of the Apple provided Xerox Printer Drivers.</string>
<key>Identifier</key>
<string>com.github.n8felton.download.XeroxPrinterDrivers</string>
<key>Input</key>
<dict>
<key>NAME</key>
<string>XeroxPrinterDrivers</string>
</dict>
<key>Process</key>
<array>
<dict>
<key>Processor</key>
<string>AppleSupportDownloader</string>
<key>Arguments</key>
<dict>
<key>ARTICLE_NUMBER</key>
<string>912</string>
</dict>
</dict>
<dict>
<key>Processor</key>
<string>URLDownloader</string>
<key>Arguments</key>
<dict>
<key>url</key>
<string>%url%</string>
</dict>
</dict>
<dict>
<key>Processor</key>
<string>EndOfCheckPhase</string>
</dict>
</array>
</dict>
</plist>
#!/usr/env python
# -*- coding: utf-8 -*-
#
# Created by Nathan Felton (n8felton)
import re
from os import path
from autopkglib import Processor, ProcessorError
__all__ = ["AppleSupportVersioner"]
class AppleSupportVersioner(Processor):
description = "Provides version numbers for downloads from \
AppleSupportDownloader"
input_variables = {
"path_name": {
"required": True,
"description": "The full path to the file downloaded."
}
}
output_variables = {
"version": {
"description": "The version of the download based on the filename"
}
}
def main(self):
self.path_name = self.env['path_name']
file = path.basename(self.path_name)
regex = '(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)'
match = re.search(regex, file)
if match:
self.version = match.group(0)
self.output("Version is {version}".format(
version=match.group(0)))
self.env['version'] = self.version
if __name__ == "__main__":
processor = AppleSupportVersioner()
processor.execute_shell()
#!/usr/env python
# -*- coding: utf-8 -*-
#
# Created by Nathan Felton (n8felton)
import urllib2
from autopkglib import Processor, ProcessorError
__all__ = ["AppleSupportDownloader"]
class AppleSupportDownloader(Processor):
description = "Provides links to downloads posted to the Apple support \
knowledgebases."
input_variables = {
"ARTICLE_NUMBER": {
"required": True,
"description": "The KB artical number without the leading 'DL' \
e.g. http://support.apple.com/kb/dl907 \
ARTICLE_NUMBER = 907"
},
"LOCALE": {
"required": False,
"description": "The ISO-639 language code and the \
ISO-3166 country code \
e.g. en_US = English, American \
es_ES = Español, Spain"
}
}
output_variables = {
"url": {
"description": "The full url for the file you want to download."
}
}
def get_url(self, download_url):
request = urllib2.Request(download_url)
response = urllib2.urlopen(request)
return response.geturl()
def main(self):
self.base_url = "http://support.apple.com"
self.article_number = self.env['ARTICLE_NUMBER']
if 'LOCALE' not in self.env:
self.locale = "en_US"
else:
self.locale = self.env['LOCALE']
self.download_url =\
"{base_url}/downloads/DL{article_number}/{locale}/".format(
base_url=self.base_url,
article_number=self.article_number,
locale=self.locale)
self.full_url = self.get_url(self.download_url)
self.env['url'] = self.full_url
if __name__ == "__main__":
processor = AppleSupportDownloader()
processor.execute_shell()