diff --git a/CHANGELOG.md b/CHANGELOG.md index de64bcb..3dfe497 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,19 +3,25 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). -### Known issues in latest version +## Known issues in latest version - `JCDS` mode does not currently work and will cause a recipe to fail if configured. JCDS users should use the `CDP` mode. - Efforts continue to be made to reduce intermittent failures of upload of packages to Jamf Cloud Distribution Points and CDPs, icons or other objects, but they may still occur. We believe this is due to the clustering involved with Jamf Cloud Distribution Points. See (#81), (#119), (#145) etc. Ultimately, we need Jamf to provide proper endpoints for package uploads and managing icons. Please bug your Jamf support and sales consultants as often as possible! - The above efforts to improve package upload reliability may conversely cause problems on setups with multiple DPs of different types. Scenarios involving Cloud plus Local DPs are not yet tested, and there probably needs to be a more intelligent method of treating each DP as a separate package upload process than currently exists. -## [1.0.3] - 2019-10-04 - 1.0.3 +## [1.1.0] - date TBD + +### Added +- Retained compatibility with AutoPkg 1.x (Python 2) while adding compatibility for AutoPkg 2.x (Python 3). + + +## [1.0.3] - 2019-10-04 This is a bugfix release to address Issue #165 - local distribution points failing to upload new packages due to failing to obtain a package ID. The package ID check has been removed from local DPs, but left for cloud DPs. Tested and now working on JCDS and SMB DPs. -## [1.0.2] - 2019-09-25 - 1.0.2 +## [1.0.2] - 2019-09-25 This is the official 1.0.2 release, exactly the same as the former 1.0.2b8. diff --git a/JSSImporter.py b/JSSImporter.py index 59147f6..17776c9 100644 --- a/JSSImporter.py +++ b/JSSImporter.py @@ -16,15 +16,22 @@ # limitations under the License. """See docstring for JSSImporter class.""" +from __future__ import absolute_import +import importlib import os import sys import time from collections import OrderedDict from distutils.version import StrictVersion from zipfile import ZipFile, ZIP_DEFLATED -from xml.etree import ElementTree from xml.sax.saxutils import escape +# ElementTree monkey patch borrowed with love from Matteo Ferla. +# https://blog.matteoferla.com/2019/02/uniprot-xml-and-python-elementtree.html +sys.modules.pop('xml.etree.ElementTree', None) +sys.modules['_elementtree'] = None +ElementTree = importlib.import_module('xml.etree.ElementTree') + sys.path.insert(0, '/Library/Application Support/JSSImporter') import jss @@ -38,8 +45,12 @@ __all__ = ["JSSImporter"] -__version__ = "1.0.3" -REQUIRED_PYTHON_JSS_VERSION = StrictVersion("2.0.1") +__version__ = "1.1.0" +REQUIRED_PYTHON_JSS_VERSION = StrictVersion("2.1.0") + +# Map Python 2 basestring type for Python 3. +if sys.version_info.major == 3: + basestring = str # pylint: disable=too-many-instance-attributes, too-many-public-methods @@ -943,7 +954,7 @@ def find_file_in_search_path(self, path): unique_parent_dirs = OrderedDict() for parent in parent_recipe_dirs: unique_parent_dirs[parent] = parent - search_dirs = ([os.path.dirname(path)] + unique_parent_dirs.keys()) + search_dirs = ([os.path.dirname(path)] + list(unique_parent_dirs)) tested = [] final_path = "" @@ -984,9 +995,9 @@ def replace_text(self, text, replace_dict): # pylint: disable=no-self-use Returns: The text after replacement. """ - for key, value in replace_dict.iteritems(): + for key in replace_dict: # Wrap our keys in % to match template tags. - value = escape(value) + value = escape(replace_dict[key]) text = text.replace("%%%s%%" % key, value) return text diff --git a/pkg/jssimporter/build-info.plist b/pkg/jssimporter/build-info.plist index 448d076..c5bd2de 100644 --- a/pkg/jssimporter/build-info.plist +++ b/pkg/jssimporter/build-info.plist @@ -17,6 +17,6 @@ suppress_bundle_relocation version - 1.0.3 + 1.1.0 diff --git a/version.plist b/version.plist index 767fd59..576f9b4 100644 --- a/version.plist +++ b/version.plist @@ -3,6 +3,6 @@ Version - 1.0.3 + 1.1.0