diff --git a/CHANGELOG.md b/CHANGELOG.md index f1b2660..0744bce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,12 @@ All notable changes to this project will be documented in this file. This projec Changes since last release. +## [1.1.2] - 2020-09-02 + +This is a bugfix release which addresses #184, where `STOP_IF_NO_JSS_UPLOAD` was not being handled properly when set to `False`. + +The `Makefile` now uses `/usr/local/autopkg/python` when compiling the `pip` requirements rather than `pip3` to ensure compatibility with the version of python included with AutoPkg. + ## [1.1.1] - 2020-07-01 This is a bugfix release which addresses #176, #182 and #183, improving the language of the output when there is either no `JSS_REPO` set, no `pkg_path`, or `STOP_IF_NO_JSS_UPLOAD` is not set to `False`. I have also removed some verbosity when running in `-v` or zero verbosity mode. Run with at least `-vv` to retain all previous output. There are also a million minor python format changes due to the use of `black` when saving the file. diff --git a/JSSImporter.py b/JSSImporter.py index f0f1ce9..3a38171 100644 --- a/JSSImporter.py +++ b/JSSImporter.py @@ -34,7 +34,7 @@ sys.path.insert(0, "/Library/AutoPkg/JSSImporter") -import jss +import jss # pylint: disable=import-error # Ensure that python-jss dependency is at minimum version try: @@ -42,11 +42,11 @@ except ImportError: PYTHON_JSS_VERSION = "0.0.0" -from autopkglib import Processor, ProcessorError +from autopkglib import Processor, ProcessorError # pylint: disable=import-error __all__ = ["JSSImporter"] -__version__ = "1.1.1" +__version__ = "1.1.2" REQUIRED_PYTHON_JSS_VERSION = StrictVersion("2.1.0") # Map Python 2 basestring type for Python 3. @@ -430,7 +430,7 @@ def handle_category(self, category_type, category_name=None): category = None return category - def handle_package(self): + def handle_package(self, stop_if_no_upload): """Creates or updates, and copies a package object. This will only upload a package if a file with the same name @@ -543,9 +543,8 @@ def handle_package(self): ) self.upload_needed = True - # only update the package object if an uploand ad was carried out - self.stop_if_no_upload = "{}".format(self.env.get("STOP_IF_NO_JSS_UPLOAD")) - if self.stop_if_no_upload != "False" and not self.upload_needed: + # only update the package object if an upload ad was carried out + if stop_if_no_upload != "False" and not self.upload_needed: self.output( "Not overwriting policy as upload requirement is determined as False, " "and STOP_IF_NO_JSS_UPLOAD is not set to False." @@ -1358,10 +1357,14 @@ def main(self): if self.env["pkg_path"]: self.jss.distribution_points.mount() - self.package = self.handle_package() + # define whether we will stop based on the value of STOP_IF_NO_JSS_UPLOAD + self.stop_if_no_upload = "{}".format(self.env.get("STOP_IF_NO_JSS_UPLOAD")) + + # handle package + self.package = self.handle_package(self.stop_if_no_upload) # stop if no package was uploaded and STOP_IF_NO_JSS_UPLOAD is True - if self.stop_if_no_upload and not self.upload_needed: + if self.stop_if_no_upload != "False" and not self.upload_needed: # Done with DPs, unmount them. for dp in self.jss.distribution_points: if not dp.was_mounted: diff --git a/Makefile b/Makefile index e65e2b1..1a47f92 100644 --- a/Makefile +++ b/Makefile @@ -22,13 +22,15 @@ $(PKG_BUILD)/jssimporter-$(PKG_VERSION).pkg: $(objects) "$(PKG_ROOT)/Library/AutoPkg/JSSImporter/boto": @echo "Installing boto into JSSImporter support directory" #pip install --install-option="--prefix=$(PKG_ROOT)/Library/AutoPkg/JSSImporter/boto" --ignore-installed boto - pip3 install --target "$(PKG_ROOT)/Library/AutoPkg/JSSImporter" --ignore-installed boto + #pip3 install --target "$(PKG_ROOT)/Library/AutoPkg/JSSImporter" --ignore-installed boto + /usr/local/autopkg/python -m pip install --target "$(PKG_ROOT)/Library/AutoPkg/JSSImporter" --ignore-installed boto "$(PKG_ROOT)/Library/AutoPkg/JSSImporter/requests": @echo "Installing requests into JSSImporter support directory" #pip install --install-option="--prefix=$(PKG_ROOT)/Library/AutoPkg/JSSImporter/requests" --ignore-installed requests - pip3 install --target "$(PKG_ROOT)/Library/AutoPkg/JSSImporter" --ignore-installed requests + # pip3 install --target "$(PKG_ROOT)/Library/AutoPkg/JSSImporter" --ignore-installed requests + /usr/local/autopkg/python -m pip install --target "$(PKG_ROOT)/Library/AutoPkg/JSSImporter" --ignore-installed requests $(PKG_ROOT)/Library/AutoPkg/autopkglib/JSSImporter.py: diff --git a/pkg/jssimporter/build-info.plist b/pkg/jssimporter/build-info.plist index 607a224..f95a25d 100644 --- a/pkg/jssimporter/build-info.plist +++ b/pkg/jssimporter/build-info.plist @@ -17,6 +17,6 @@ suppress_bundle_relocation version - 1.1.1 + 1.1.2 diff --git a/version.plist b/version.plist index 36443a5..f6ee63e 100644 --- a/version.plist +++ b/version.plist @@ -3,6 +3,6 @@ Version - 1.1.1 + 1.1.2