Could not load models from jamf
Thanks for this script! I'm finally getting around to running it via launchd. The Jamf Pro functionality looks perfect - it sure beats listing the model IDs manually in the script, which was my original plan. 😄
I'm running into a weird error, though - any idea?
I created a new JSS user, and gave them the ability to read Mobile Devices. Here's the command I'm running:
/usr/local/precache/precache.py --cache-server http://my.server.tld:49240 --jamfserver https://my.jss.tld:8443 --jamfuser myusername --jamfpassword mypassword
Here's the bash -x output:
+ /usr/local/precache/precache.py --cache-server http://my.server.tld:49240 --jamfserver https://my.jss.tld:8443 --jamfuser myusername --jamfpassword mypassword
precache version 1.1.2
Caching Server: http://my.server.tld:49240
Processing feeds. This may take a few moments.
Can not load models from jamf: <urlopen error [Errno 8] nodename nor servname provided, or not known>
The JSS URL is reachable from the server that's running this script - I was able to load the URL in Safari with no issues. Any idea what could be wrong?
Thanks!
Mike
What happens If you change line 1012 from "https://{}.jamfcloud.com/JSSResource/mobiledevices".format(args.jamfserver)) to read "https://{}/JSSResource/mobiledevices".format(args.jamfserver)) and remove the https:// from your jamfserverurl this worked for me
Thanks! I'll give this a try tomorrow!
Ah, still the same error:
Can not load models from jamf: <urlopen error [Errno 8] nodename nor servname provided, or not known>
Anything else I can try?
Thanks!
Mike
Hi Mike, this is the command I am using notice the "=" precache.py --jamfserver=jssaddress:8443 --jamfuser=jamfuser --jamfpassword=jamfpassword --debug
Thanks, @macinandy. I made the changes, but they don't seem to have helped - here's the bash -x output. I added some variables, but nothing too fancy.
+ precache=/usr/local/precache/precache.py
+ caching_server_1=http://my.server.tld:49240
+ jamf_server=https://my.jss.tld:8443
+ jamf_user=myusername
+ jamf_password=mypassword
+ /usr/local/precache/precache.py --cache-server http://my.server.tld:49240 --jamfserver=https://my.jss.tld:8443 --jamfuser=myusername --jamfpassword=mypassword
precache version 1.1.2
Caching Server: http://my.server.tld:49240
Processing feeds. This may take a few moments.
Can not load models from jamf: <urlopen error [Errno 8] nodename nor servname provided, or not known>
+ exit 0
I also changed Caching Servers so that's why the ports are different. I also added --debug, but that just added more output to /tmp/precache.log. I don't see any hints that indicate what went wrong.
Also: I know the ReadMe says to put precache.py in /usr/local/bin, but do you think it's okay that I'm using /usr/local/precache instead? That way, I can do a git pull prior to running the script.
Thanks again for the help!
Mike
Hi again, try removing the https from your jamfserver as in
/usr/local/precache/precache.py --cache-server http://my.server.tld:49240 --jamfserver=my.jss.tld:8443 --jamfuser=myusername --jamfpassword=mypassword no it won’t matter where you place precache, it is just cleaner if you put it in /usr/local/bin/
thanks
On 17/05/2017, at 8:49 AM, Mike Solin [email protected] wrote:
Thanks, @macinandy https://github.com/macinandy. I made the changes, but they don't seem to have helped - here's the bash -x output. I added some variables, but nothing too fancy.
- precache=/usr/local/precache/precache.py
- caching_server_1=http://my.server.tld:49240
- jamf_server=https://my.jss.tld:8443
- jamf_user=myusername
- jamf_password=mypassword
- /usr/local/precache/precache.py --cache-server http://my.server.tld:49240 --jamfserver=https://my.jss.tld:8443 --jamfuser=myusername --jamfpassword=mypassword precache version 1.1.2 Caching Server: http://my.server.tld:49240 Processing feeds. This may take a few moments. Can not load models from jamf: <urlopen error [Errno 8] nodename nor servname provided, or not known>
- exit 0 I also changed Caching Servers so that's why the ports are different. I also added --debug, but that just added more output to /tmp/precache.log. I don't see any hints that indicate what went wrong.
Also: I know the ReadMe says to put precache.py in /usr/local/bin, but do you think it's okay that I'm using /usr/local/precache instead? That way, I can do a git pull prior to running the script.
Thanks again for the help!
Mike
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/krypted/precache/issues/15#issuecomment-301911358, or mute the thread https://github.com/notifications/unsubscribe-auth/AD8H_X2abg5R_4OJCe4vStd0RWJgoPDNks5r6gvmgaJpZM4NbZCB.
Oops! I understand now. I had changed it from https:// to http://, not realizing that you meant to remove it entirely.
It's working! Thank you!
Do you think I can return line 1012 in precache.py back to normal?
Mike
Hi @macinandy -
I updated my copy of precache.py, and the script returned these errors:
Traceback (most recent call last):
File "/usr/local/precache/precache.py", line 1044, in <module>
main()
File "/usr/local/precache/precache.py", line 1016, in main
jamf_response = urllib2.urlopen(jamf_request)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 431, in open
response = self._open(req, data)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 449, in _open
'_open', req)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 409, in _call_chain
result = func(*args)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1240, in https_open
context=self._context)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1166, in do_open
h = http_class(host, timeout=req.timeout, **http_conn_args)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1254, in __init__
source_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 751, in __init__
(self.host, self.port) = self._get_hostport(host, port)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 793, in _get_hostport
raise InvalidURL("nonnumeric port: '%s'" % host[i+1:])
httplib.InvalidURL: nonnumeric port: '8443.jamfcloud.com'
I returned line 1012 to the code you mentioned in https://github.com/krypted/precache/issues/15#issuecomment-301626123 and it's processing iOS device models properly again.
Would it be possible to merge this code change to the master branch, or would that break other things?
Thanks!
Mike
@flammable @macinandy check out precache_dev here: https://github.com/carlashley/precache_dev to see if this resolves the issue. Note you will need to have the requests module installed. Definitely read through the README as there are some significant changes between this release, and v2.x.
Either of the below will work (may need to sudo):
pip install requests
easy_install_requests
If you prefer to manage python dependancies by using virtualenv, then use that.
You don't have to put precache.py in /usr/local/bin - it can be put anywhere. I'm lazy with my system config and don't like mucking about with PATH.
EDIT
I should point out that the precache_dev is still under testing, so keep it seperate from your current precache.