- jctl: Changed the json output so it's much easier to parse (with something like [jq](https://stedolan.github.io/jq/))
- jctl: Non-json output prints record name first when printing paths
- jctl: Added --print-id (when you need to capture the id of a record to use in another command)
- jctl: Added --debug
- jctl: `-s` now can do `!=~`
- jctl: `-s` `~=` is deprecated, switching it to `=~`
- pre-commit updated to 4.3.0
- GitHub action updated action names
Example of the new features.
Getting the ID of the Zoom patch software title using `jq`:
zoomid=`jctl patchsoftwaretitles -r "Zoom Client for Meetings" -p id -j | jq '.[].id | .[] | tonumber'`
Getting the ID of the Zoom patch software title using --print_id:
zoomid=`jctl patchsoftwaretitles -r "Zoom Client for Meetings" -I`
Using the ID
jctl packages -c "Zoom-5.11.11 (10514).pkg"
jctl patchpolicies -c "Zoom 1" $zoomid "5.11.11 (10514)"
Formatting the json output with `jq`:
jctl computergroups -i 2 -j -l | jq
[
{
"id": "2",
"name": "All Managed Servers",
"is_smart": "true",
"site": {
"id": "-1",
"name": "None"
},
"criteria": {
"size": "2",
"criterion": [
{
"name": "Operating System",
"priority": "0",
"and_or": "and",
"search_type": "like",
"value": "server",
"opening_paren": "false",
"closing_paren": "false"
},
{
"name": "Application Title",
"priority": "1",
"and_or": "or",
"search_type": "is",
"value": "Server.app",
"opening_paren": "false",
"closing_paren": "false"
}
]
},
"computers": {
"size": "0"
}
}
]
Here's what it looks like when you specify paths.
jctl policies -n "Install Zoom" -p package_configuration -p general/name -j | jq
[
{
"package_configuration": {
"packages": {
"size": "2",
"package": [
{
"id": "1",
"name": "Zoom-5.11.11 (10514).pkg",
"action": "Install",
"fut": "false",
"feu": "false"
}
]
}
},
"general/name": "Install Zoom"
}
]
Non-json output shows the record name first (the output is still generated by pprint):
jctl computergroups -i 2 -l
{'All Managed Servers': {'computers': {'size': '0'},
'criteria': {'criterion': [{'and_or': 'and',
'closing_paren': 'false',
'name': 'Operating System',
'opening_paren': 'false',
'priority': '0',
'search_type': 'like',
'value': 'server'},
{'and_or': 'or',
'closing_paren': 'false',
'name': 'Application '
'Title',
'opening_paren': 'false',
'priority': '1',
'search_type': 'is',
'value': 'Server.app'}],
'size': '2'},
'id': '2',
'is_smart': 'true',
'name': 'All Managed Servers',
'site': {'id': '-1', 'name': 'None'}}}
Showing the record name first is very helpful when printing paths:
jctl computergroups -p is_smart
{'All Managed Clients': {'is_smart': 'true'}}
{'All Managed Servers': {'is_smart': 'true'}}
Count: 2
Comparing `=~` with `!=~`:
jctl computergroups -s name=~Cl
All Managed Clients
jctl computergroups -s name!=~Cl
All Managed Servers
Debugging output (yes, this shows the bearer token for my localhost server):
jctl computergroups --debug
2022-10-02 16:55:36,447: DEBUG: __main__ - main(): Warning, debugging output may contain passwords, tokens, or other sensitive information!
2022-10-02 16:55:36,447: DEBUG: __main__ - main(): args: Namespace(record='computergroups', create=None, update=None, delete=False, sub_command=None, id=None, name=None, regex=None, searchpath=None, print_id=False, long=False, path=None, json=False, quiet_as_a_mouse=False, config=None, version=False, use_the_force_luke=False, andele_andele=False, debug=True)
2022-10-02 16:55:36,494: DEBUG: jamf.api.API - _submit_request(): post: http://localhost/api/v1/auth/keep-alive
2022-10-02 16:55:36,759: DEBUG: jamf.api.API - _submit_request(): response.text: {
"token" : "eyJhbGciOiJIUzI1NiJ9.eyJhdXRoZW50aWNhdGVkLWFwcCI6IkdFTkVSSUMiLCJhdXRoZW50aWNhdGlvbi10eXBlIjoiSlNTIiwiZ3JvdXBzIjpbXSwic3ViamVjdC10eXBlIjoiSlNTX1VTRVJfSUQiLCJ0b2tlbi11dWlkIjoiNGE0OGEyNzItZjFiZi00NjkwLWE5YjQtYTU4NjZkNDI2MGJlIiwibGRhcC1zZXJ2ZXItaWQiOi0xLCJzdWIiOiIxIiwiZXhwIjoxNjY0NzUzMTM2fQ.FEOy4rUenvZm3Gc_mrXk3qUnpcFmCtzneKKKs_hW-hk",
"expires" : "2022-10-02T23:25:36.754Z"
}
2022-10-02 16:55:36,832: DEBUG: jamf.api.API - _submit_request(): get: http://localhost/api/v1/jamf-pro-version
2022-10-02 16:55:36,860: DEBUG: jamf.api.API - _submit_request(): response.text: {
"version" : "10.41.0-t1661887915"
}
2022-10-02 16:55:36,861: DEBUG: jamf.api.API - _submit_request(): get: http://localhost/JSSResource/computergroups
2022-10-02 16:55:36,904: DEBUG: jamf.api.API - _submit_request(): response.text: <?xml version="1.0" encoding="UTF-8"?><computer_groups><size>2</size><computer_group><id>1</id><name>All Managed Clients</name><is_smart>true</is_smart></computer_group><computer_group><id>2</id><name>All Managed Servers</name><is_smart>true</is_smart></computer_group></computer_groups>
All Managed Clients
All Managed Servers
Count: 2
2022-10-02 16:55:36,922: DEBUG: jamf.api.API - __del__(): closing session