jssimporter / python-jss

python-jss is deprecated. Please see the wiki for alternatives.
GNU General Public License v3.0
102 stars 41 forks source link

**kwargs computer match search not working #104

Open mat2159279 opened 4 years ago

mat2159279 commented 4 years ago

according to the documentation adding a * to a computer search will preform a match search

"– str: Search for an object by name. Some objects allow ‘match’ searches, using ‘*’ as the wildcard operator."

The computer name that Im searching for is MC305239-LT-42CTS so in my code as a match search Im searching for MC305239 expected url: https://my-jamf-site.jamfcloud.com:8443/JSSResource/computers/match/MC305239

computer = j.Computer('MC305239*')
print(computer)

which returns

Traceback (most recent call last):
  File "python-jss.py", line 12, in <module>
    print(computer)
  File "/Users/mat2159279/.pyenv/versions/3.8.5/lib/python3.8/site-packages/jss/queryset.py", line 104, in __str__
    table = [
  File "/Users/mat2159279/.pyenv/versions/3.8.5/lib/python3.8/site-packages/jss/queryset.py", line 105, in <listcomp>
    fmt.format(data=item._basic_identity, cached=str_cached(item)) for
TypeError: unsupported format string passed to NoneType.__format__

If I remove the MC from the front of the computer name it returns a blank table

Empty QuerySet
---------------------
| id | name| cached |
---------------------
---------------------

At that point I should be pacing another in front of the name expected url: https://my-jamf-site.jamfcloud.com:8443/JSSResource/computers/match/305239 But if I do place another in front I get

Traceback (most recent call last):
  File "python-jss.py", line 12, in <module>
    print(computer)
  File "/Users/mat2159279/.pyenv/versions/3.8.5/lib/python3.8/site-packages/jss/queryset.py", line 104, in __str__
    table = [
  File "/Users/mat2159279/.pyenv/versions/3.8.5/lib/python3.8/site-packages/jss/queryset.py", line 105, in <listcomp>
    fmt.format(data=item._basic_identity, cached=str_cached(item)) for
TypeError: unsupported format string passed to NoneType.__format__

The same as above using the MC in front.

If i purposefully enter in a name that I know will not return a value I also get the blank table.