From 48f923d41d4f6164bc2613c81b2096319e07eef9 Mon Sep 17 00:00:00 2001 From: Elliot Jordan Date: Sun, 19 Jan 2020 10:04:12 -0800 Subject: [PATCH 1/8] Bump version for development --- CHANGELOG.md | 9 +++++++-- JSSImporter.py | 2 +- pkg/jssimporter/build-info.plist | 2 +- version.plist | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de64bcb..d8dadaa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,12 +10,17 @@ All notable changes to this project will be documented in this file. This projec - 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 + +No changes yet. + + +## [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..33dcb11 100644 --- a/JSSImporter.py +++ b/JSSImporter.py @@ -38,7 +38,7 @@ __all__ = ["JSSImporter"] -__version__ = "1.0.3" +__version__ = "1.1.0" REQUIRED_PYTHON_JSS_VERSION = StrictVersion("2.0.1") 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 From 9d7daee28cfb4a8427d8705cd004cfd98b96aabd Mon Sep 17 00:00:00 2001 From: Elliot Jordan Date: Sun, 19 Jan 2020 10:13:10 -0800 Subject: [PATCH 2/8] Py modernize: adjust imports --- JSSImporter.py | 1 + 1 file changed, 1 insertion(+) diff --git a/JSSImporter.py b/JSSImporter.py index 33dcb11..bc567c7 100644 --- a/JSSImporter.py +++ b/JSSImporter.py @@ -16,6 +16,7 @@ # limitations under the License. """See docstring for JSSImporter class.""" +from __future__ import absolute_import import os import sys import time From aeb7fe337a03644df359c9aac6639199dc763f3c Mon Sep 17 00:00:00 2001 From: Elliot Jordan Date: Sun, 19 Jan 2020 10:20:16 -0800 Subject: [PATCH 3/8] Adjust required version of python-jss to 2.1.0 --- JSSImporter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JSSImporter.py b/JSSImporter.py index bc567c7..79a5b5e 100644 --- a/JSSImporter.py +++ b/JSSImporter.py @@ -40,7 +40,7 @@ __all__ = ["JSSImporter"] __version__ = "1.1.0" -REQUIRED_PYTHON_JSS_VERSION = StrictVersion("2.0.1") +REQUIRED_PYTHON_JSS_VERSION = StrictVersion("2.1.0") # pylint: disable=too-many-instance-attributes, too-many-public-methods From fc6bfbb7edf2104633b43436b243630f81eaff67 Mon Sep 17 00:00:00 2001 From: Elliot Jordan Date: Sun, 19 Jan 2020 10:23:44 -0800 Subject: [PATCH 4/8] Adjust ElementTree import to match python-jss 2.1.0 --- JSSImporter.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/JSSImporter.py b/JSSImporter.py index 79a5b5e..a9e92a8 100644 --- a/JSSImporter.py +++ b/JSSImporter.py @@ -17,15 +17,21 @@ """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 From ec8077d6a73cdab6d645bd8d512a12497232421b Mon Sep 17 00:00:00 2001 From: Elliot Jordan Date: Sun, 19 Jan 2020 10:40:31 -0800 Subject: [PATCH 5/8] Map basestring to str in Python 3 --- JSSImporter.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/JSSImporter.py b/JSSImporter.py index a9e92a8..757d611 100644 --- a/JSSImporter.py +++ b/JSSImporter.py @@ -48,6 +48,10 @@ __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 class JSSImporter(Processor): From 5240ab7383e675416d66952a14a9be868f841089 Mon Sep 17 00:00:00 2001 From: Elliot Jordan Date: Sun, 19 Jan 2020 10:50:39 -0800 Subject: [PATCH 6/8] Avoid dict.iteritems() for Python 3 compatibility --- JSSImporter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/JSSImporter.py b/JSSImporter.py index 757d611..7cdaa13 100644 --- a/JSSImporter.py +++ b/JSSImporter.py @@ -995,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 From 58606669f4210884147b36f4d916a1b89af742a0 Mon Sep 17 00:00:00 2001 From: Elliot Jordan Date: Sun, 19 Jan 2020 11:45:01 -0800 Subject: [PATCH 7/8] Cast parent dirs to list instead of using .keys() --- JSSImporter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JSSImporter.py b/JSSImporter.py index 7cdaa13..17776c9 100644 --- a/JSSImporter.py +++ b/JSSImporter.py @@ -954,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 = "" From e2190f98f9d0d1fa8628c3e211c22dfaec4f192d Mon Sep 17 00:00:00 2001 From: Elliot Jordan Date: Sun, 19 Jan 2020 13:47:04 -0800 Subject: [PATCH 8/8] Update CHANGELOG.md --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8dadaa..3dfe497 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ 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! @@ -12,7 +12,8 @@ All notable changes to this project will be documented in this file. This projec ## [1.1.0] - date TBD -No changes yet. +### Added +- Retained compatibility with AutoPkg 1.x (Python 2) while adding compatibility for AutoPkg 2.x (Python 3). ## [1.0.3] - 2019-10-04