Skip to content

Releases: jssimporter/python-jss

2.1.1

26 Mar 16:56
Compare
Choose a tag to compare
2.1.1 Pre-release
Pre-release
  • Changed the mount point from /Volumes to /Users/Shared. This is to address failing mount points on macOS Big Sur.

2.1.0

19 Oct 09:41
Compare
Choose a tag to compare

Added

  • Retained compatibility with AutoPkg 1.x (Python 2) while adding compatibility for AutoPkg 2.x (Python 3).
  • Added $ to safe characters in URLs to allow hidden shares (#169).

Changed

Start Choppin' Pre-Release

22 Sep 11:15
Compare
Choose a tag to compare
Pre-release

After the 1.x series, @sheagcraig completely rewrote sections of the python-jss library.
These are his original notes for Start Choppin'

Added

  • CurlAdapter, ResponseAdapter, and RequestsAdapter to wrap curl in
    requests' API. This is primarily to deal with the fact that Apple's shipped
    OpenSSL is extremely out of date (requests uses pyopenssl, which uses the
    out-of-date OpenSSL). Since current recommendations from Jamf are to run the
    Casper server using only TLS1.2, this puts us in a bind. So, by default,
    python-jss will now use curl for networking. Developers seeking the
    advantages of using requests can replace the networking adapter they want to
    use (see jss.jamf_software_server.JSS). note: because i added requests back in, this is less important - mosen.
  • @mosen really stepped up and provided Sphinx documentation! This is a great
    motivator for getting some improved documentation going for this project.
  • JSSObject and all of its subclasses can now be used as a context manager
    (the python with statement). All this does is automatically tries to save
    the object automatically on the way out of the with context.
  • Container.__contains__ magic method, which allows you to do things
    like if some_pkg in some_policy:. Please note, this will find any
    reference to that object contained within. This may not be what you want, for
    example, if a computer is in a group's exclusions list but you want to know
    if it's in the inclusion list. Thankfully, there's a method for that
    (JSSGroupObject.has_member()).
  • JSSObject magic methods for equality and hash. This means you can
    test whether two Computer objects are the same, for example. You can also
    now use the objects as keys in a dictionary, or other mapping.
  • Implemented new endpoints and their corresponding objects:
    AllowedFileExtension, ComputerApplicationUsage, ComputerApplication,
    ComputerHardwareSoftwareReport, ComputerManagement, HealthcareListener,
    HealthcareListerRule, JSONWebTokenConfigurations,
    InfrastructureManager, MobileDeviceHistory, Webhook.
  • Added compression argument to JSS.pickle_all() (defaults to True) to
    compress pickle output. A lot.
  • Tag access through the . operator for JSSObjects. For example, you can
    now do computer.configuration_profiles.size.text to reach all the way down
    the tree to that value.
  • All JSSObjects have a tree() method which will return a nicely indented
    representation of the tag structure of the object. Use it like this: print a_computer_group.tree().
  • Automatic match search detection for object types that support it. Now you
    can do j.Computer("MacBook*") instead of j.Computer("match=MacBook*").
    Match searches will always return a QuerySet.
  • JSS.version() method now returns the server's version (using the jssuser
    endpoint.
  • Made the DistributionPoints collection class iterable, so if you do need to
    operate on individual DPs within, you don't need to fool around with the
    private collection. (See JSSImporter for an example).
  • Added Script.add_script() to handle XML escaping and adding a script
    payload to a Script object.

Changed

  • Moved the suppress_warnings preference out of JSS and into the requests
    adapter. The JSS initialization will accept that keyword argument to ease
    the (sudden) deprecation, but it just won't do anything. Use the
    RequestsAdapter.suppress_warnings() method if you need it.
  • Instantiating a JSS object will now default to using the CurlAdapter for
    networking. Use JSS.mount_networking_adapter() to replace it with the
    RequestsAdapter and gain things like sessions.
  • The requests library is now not a required dependency. You only need it if
    you want to import/use the RequestsAdapter.
  • Through some metaprogramming shenanigans, jss.JSS is now about 500 lines
    shorter, from dynamically creating all of the object search methods. This
    makes maintenance of this code significantly easier.
  • All object search methods accept keyword arguments (instead of a subset
    positional argument). Whether the JSS is considered to work with subsetting
    is recorded as a new attribute on the class (jss.Computer.allowed_kwargs = True for example). This, again, makes it easier to maintain as JAMF adds or
    removes query features. The search methods docstrings all reflect the level
    of (considered) support.
  • JSSObjectList is now called a QuerySet, inspired by Django. The old
    behavior was that the contents were just id/name for each contained object,
    until you used the "retrieve" method. Now all objects contained within are
    full JSSObjects.
  • python-jss was using repr and str too casually. Throughout, class' repr
    has been rewritten to provide a very basic marker of the type, and str has
    been written to provide the pretty-printing of XML functionality that it had
    previously. In practice, this means that in the interpreter, developers will
    have to print x instead of just entering x to see what they have.
    However, it also means that simply doing x gives easier to read information
    for QuerySets of items without dumping their entire contents to screen (e.g.
    j.Computer() results in thousands of lines vomited into your terminal).
  • Renamed some internal classes (JSSContainerObject -> Container,
    JSSGroupObject -> Group)
  • Container and all of its subclasses (most types of data from the JSS) now
    use lazy-loading to defer sending a GET method until you actually need the
    data.
  • All Element objects added to a JSSObject will get converted to the
    PrettyElement type to enable dot access and pretty printing.
  • Renamed all of the request-failure exceptions by dropping the JSS:
    • JSSGetError -> GetError
    • JSSPutError -> PutError
    • JSSPostError -> PostError
    • JSStDeleteError -> DeleteError

Deprecated

  • JSSObjectList has been renamed to QuerySet and now inherits from it. While
    it is unlikely that any client code directly references this class, it is
    worth checking for in your code. It will be remmoved entirely in a future
    release. Please update code to use the QuerySet API and signature.

Removed

  • All references to the jss_migrated preference has been removed. This is no
    longer an issue with current and future JSS versions.
  • Scripts stopped being stored on distribution points with the conclusion
    of version 8, so all distribution point code that did script copying,
    deletion, existence testing, etc, has been removed.
  • JSSObjectList.retrieve() has been removed as it's no longer needed.
  • JSSObjectList.pickle() and from_pickle(). This code is just cruft; it's
    just about the same amount of work to pickle it on your own.
  • JSSObjectFactory was removed as it is no longer needed. Client code should
    use getattr if it needs to dynamically choose which class to use.
  • JSSDeviceObject was removed as it was no longer needed. It only added a
    udid and serial_number method to two subclasses, Computer and
    MobileDevice. You can access these through . notation now:
    computer.general.serial_number.text
  • As a result of . access to subelements, all properties doing the same thing
    have been removed. The vast majority of these were in Policy (e.g.
    a_policy.computers is now accessed through a_policy.scope.computers).
  • Removed a bunch of spurious internal-use-only exceptions and used the builtin
    ones that make more sense.

Fixed

  • Made JSS.user and JSS.password proper properties, that will set the
    attached network adapter appropriately.
  • Unicode and bytes usage throughout has been audited and fixed. For the most
    part, developers can pass either to classes or methods and when they need to
    get converted, python-jss will do the right thing.
  • Removed pretty-printing injection from ElementTree.

1.5.0 Brick House

12 Sep 19:11
Compare
Choose a tag to compare

Added

  • Added optional action argument to Policy.add_package. Now you can specify that you want to "Cache", "Install Cached", or "Install". Uses "Install" by default. (#48)
  • Added CommandFlush object (new endpoint in JSS API).
  • Added LogFlush object (new endpoint in JSS API).
  • Added Patch object.
  • Added VPPAssignment object (untested at this time).
  • Added VPPInvitation object (untested at this time).
  • Added JSSObject.to_string and JSSObject.to_file methods to JSSObject.
  • Added JSSObject.pickle and JSSObject.from_pickle methods.
  • Added JSSObjectList.pickle and JSSObjectList.from_pickle.
  • Added category search to Policy. (#50 Thanks @jlrgraham)
  • Added stub objects. With these new endpoints, the Casper API now allows multiple parameters in a single URL (aside from the subset param). As I have limited development time for this project, these endpoints have stub objects added, but no JSS helper method, testing, or easy import with import jss. The TODO list has an item to add an ability to handle an arbitrary number of keyword arguments to a a GET request to support these new endpoints. Until then, the following objects serve as placeholders:
    • Added ComputerApplication object (untested at this time).
    • Added ComputerApplicationUsage object.
    • Added ComputerHardwareSoftwareReport object (untested at this time).
    • Added ComputerHistory object (untested at this time).

Changed

  • JSSObjectList.retrieve_all now returns a JSSObjectList instead of a list. This is to support being able to pickle/unpickle the contained objects all at once.
  • JSSObject.from_string encodes input to utf-8 now. ElementTree.fromstring doesn't accept unicode, so anything outside of ascii throws an exception. (#44 Thanks @systemheld!)
  • SMB now defaults to port 445 (#51 #53 Thanks @ChrOst)

Fixed

  • Fix file type constants in distribution_point.py to satisfy Requests' requirement for string-type headers (#55 thanks @ftiff!)

1.4.0: The Final Countdown

30 Sep 18:12
Compare
Choose a tag to compare

Added

  • Added retrieve method to JSSListData, making the retrieval of individual JSSObjectList elements more flexible.
  • Added some argument type checking.
  • Added lots of documentation.
  • Re-enabled the ability to create new objects with the JSS convenience methods (e.g. jss.JSS.Computer)
  • Added and improved the verbose output for HTTP requests.
  • Added a repr to JSSListData so you can now better interact with them.
  • Added the suppress_warnings key to the preference domain and JSSPrefs object.
  • Added an interactive configuration procedure to the JSSPrefs class. If you don't already have a plist file, on instantiation it will prompt your for all configuration information.
  • Added a pre_callback and post_callback parameter to DistributionPoints.copy. This allows you to provide some feedback for long copying operations. In the future, if desired, more may be added to long-running methods like JSSObjectList.retrieve_all().
  • Added a LocalRepository repo type for paths either local or already mounted. Required connection args are "mount_point", "share_name", and if migrated, "jss".
  • Added some public methods to JSSObjectFactory if you're into doing some lower-level object searching and creation.

Changed

  • Optimized JSSObjectList.retrieve_all.
  • Reorganized JSSObject.save method. It was very convoluted. Now it reads better, is more error resistant, and should work exactly the same. Specifically, it assumes that if your JSSObject has no ID, then it is a new object (because only the JSS can assign one) and thus needs to PUT. If it does have an ID, then it POSTs it. Potentially this could be an issue where if you retrieved an object, and then wanted to completely replace it with different data, and then tried to save, it would then be missing the ID and would PUT, creating a new object (or fail because of the name conflict); I don't see that as a real issue though.
  • Removed JSSObject.search since it implements a deprecated Element
    method that wasn't being used anywhere.
  • Restored requests method of posting FileUploads. Now uses mimetypes to
    detect file type and uses it in header.
  • JAMF fixed D-008180, where the JSS rejected Packages and policies with
    a category of "No Category Assigned", even though that's what the JSS
    supplied in GET requests. This was fixed in JSS v9.7. Therefore,
    python-jss removed its overriden methods Package.save and
    Policy.save. It's likely this was broader than just Packages and
    Policies, but python-jss hadn't implemented or tested other objects.
  • Internal package structure drastically changed to make modules smaller and more manageable.
  • Improved the formatting of JSSObjectList objects.
  • Replaced the Element.repr method with the indenting pretty-printing one that has been in python-jss for awhile now. This allows all non-assigned results from Element subclass methods to pretty-print the XML.
  • Removed the recently added JSSObject.pretty_find as it's no longer needed.
  • Changed the method for creating "new" JSSObjects. Now, generating a blank XML for JSSObjects uses a class attribute data_keys to generate the structure. It allows for setting default values.
    • Now, the __init__ and _new methods accept any of the data_keys as keyword args to be set during creation.
  • Renamed JSSObject.new to JSSObject._new to discourage client use.

Fixed

  • JSSObject.set_bool improved to not have broken string behavior.

1.3.0: Two Men Enter, One Man Leaves

20 Aug 18:24
Compare
Choose a tag to compare

Added

  • Added the subset feature to object queries that support it. For example Computers allow you to do jss_connection.Computer(None, "basic") for extended list information orjss_connection.Computer("computer-name", "general&purchasing")orjss_connection.Computer("computer-name", ["general", "purchasing"])for subsection retrieval. This should allow you to speed up bigretrieve_all` runs significantly.
  • Added Cloud Distribution Point support. Thanks to @beckf for packet analysis help, and @homebysix for testing. (#22)
  • Added JSSObject.pretty_find. Pretty prints sub-elements of a JSSObject for use in interactive exploration of the JSS.
  • Added option verify to JSSPrefs and the com.github.sheagcraig.python-jss preference domain. If not specified in the preferences, it will assume True.
  • Added property to JSSGroupObject and subclasses for is_smart. Now you can have a regular boolean property and setter for groups.
  • Added method is_member to JSSGroupObject. This allows you to test whether a Computer or MobileDevice object is a member of a group.

Changed

  • New mount technique uses PyObjC rather than subprocess to mount. Thanks to @pudquick for this slick implementation!
    • Solves some Kerberos issues some users were experiencing.
    • For OS X users who are not using the Apple Python, continue to use subprocess to mount.
    • The nobrowse argument to mount is now deprecated, and will do nothing. It will be removed entirely in the future.
    • Verbose prints mount arguments.
  • When viewing object data interactively, the __repr__ now displays simply *data* instead of the full binary data for things like icons and app binaries.

Fixed

  • Encode data arguments to JSS object's get method.
  • Quote data arguments to JSS object's get method, since apparently requests doesn't do this for us.

Removed

  • Removed JSSGroupObject.set_is_smart. (Replaced with @property)

1.2.1: U0001F49A

28 Jul 19:57
Compare
Choose a tag to compare

Fixed

1.2.0: Your Cipher is all Over my Necktie

24 Jul 15:40
Compare
Choose a tag to compare

Changed

  • jss.ComputerGroups that are made with the new method now include the computers subelement. Strangely, even smart groups include a computers tag. If previously populated with computer objects, it will retain them!
  • Removed bundled copy of python requests.
  • Using setuptools setup.py property install_requires to specify dependencies:
    • requests
    • pyasn1
    • ndg-httpsclient
    • Previous two required for cipher change support.
  • Updated documentation to describe this requirement for developer (i.e. anyone who does not use the egg or wheel files to install).
  • JSS.base_url (Get and Set) and JSS._url (Read only) are now proper properties.

Fixed

  • Changes the default cipher list for requests/urllib3 to work with recommended changes in JSS >= v9.73.
  • jss.JSS.ssl_verify is now a computed property and will properly update the requests session if changed after instantiation.
  • casper package's Casper class did not use the requests session on the JSS object passed to it.
  • JSS URL's with a trailing slash will be sanitized to remove that slash upon JSS instantiation or base_url update.

1.1.0: Velvet Nachos

24 Jul 15:40
Compare
Choose a tag to compare

Changed

  • Package.new now sets the boot_volume_required property to true by default.

1.0.2: When Doves Cry

10 Jun 12:57
Compare
Choose a tag to compare

Fixed

  • MobileDeviceGroup now correctly inherits from JSSGroupObject.