Open mhrono opened 1 week ago
After discussing with @brysontyrrell in Slack, I attempted to create a search by dumping the model to XML and using the classic_api_request
method:
jamfClient.classic_api_request(method="POST", resource_path="advancedcomputersearches/id/0", data=notUpdatedSearchData.xml())
Unfortunately, this search was also created with no criteria. Examining the output of notUpdatedSearchData.xml()
seems to point to the issue:
<?xml version="1.0" encoding="UTF-8" ?><advanced_computer_search><name>testxml</name><criteria><None><name>Managed</name><priority>0</priority><and_or>and</and_or><search_type>is</search_type><value>Managed</value><opening_paren>false</opening_paren><closing_paren>false</closing_paren></None><None><name>Operating System Version</name><priority>1</priority><and_or>and</and_or><search_type>less than</search_type><value>15.1</value><opening_paren>false</opening_paren><closing_paren>false</closing_paren></None></criteria><display_fields><display_field><name>JSS Computer ID</name></display_field><display_field><name>Last Check-in</name></display_field><display_field><name>Serial Number</name></display_field><display_field><name>Operating System Version</name></display_field><display_field><name>Username</name></display_field></display_fields></advanced_computer_search>
It looks like each criterion is being surrounded by a <None>
tag.
tl;dr when attempting to create or update an advanced computer search (using the
create_advanced_computer_search
orupdate_advanced_computer_search_by_id
methods, respectively), the operation is completed successfully, except for the search criteria. Name and display fields are set as configured, but any criteria sent are seemingly ignored, and the search is created/updated with no criteria. This effectively places every device into the results for the advanced computer search.Reproduction details below will be for creating a search, but the result is the same when attempting to update an existing search.
Steps to Reproduce
Expected Result
Expected an advanced computer search to be created with the following criteria:
Actual Result
Advanced computer search created with no criteria:
(omitted
computers
from above output)Additional Data
If I retrieve the criteria from an existing advanced computer search (with correct criteria) and feed that directly into the
create
method, I would definitely expect this criteria to be valid and accepted. Even doing this, the new search is created with no criteria:(again omitted
computers
)System Information
macOS 15.1 Python 3.12.1 SDK 0.6a2 Jamf Pro 11.10.2