Skip to content

Commit

Permalink
Merge pull request #174 from homebysix/1.1.0-dev
Browse files Browse the repository at this point in the history
AutoPkg 2.x (Python 3) compatibility adjustments
  • Loading branch information
grahampugh committed Jan 20, 2020
2 parents 54d9643 + e2190f9 commit f481f68
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
12 changes: 9 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
23 changes: 17 additions & 6 deletions JSSImporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 = ""
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pkg/jssimporter/build-info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
<key>suppress_bundle_relocation</key>
<true/>
<key>version</key>
<string>1.0.3</string>
<string>1.1.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion version.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<plist version="1.0">
<dict>
<key>Version</key>
<string>1.0.3</string>
<string>1.1.0</string>
</dict>
</plist>

0 comments on commit f481f68

Please sign in to comment.