Skip to content

Commit

Permalink
v1.1.2 - Fix for #184
Browse files Browse the repository at this point in the history
  • Loading branch information
Graham R Pugh committed Sep 2, 2020
1 parent b341356 commit b290728
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 13 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
21 changes: 12 additions & 9 deletions JSSImporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@

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:
from jss import __version__ as PYTHON_JSS_VERSION
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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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."
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
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.1.1</string>
<string>1.1.2</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.1.1</string>
<string>1.1.2</string>
</dict>
</plist>

0 comments on commit b290728

Please sign in to comment.