Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Munki Enroll Error #66

Closed
AndersTao opened this issue Jul 8, 2018 · 7 comments
Closed

Munki Enroll Error #66

AndersTao opened this issue Jul 8, 2018 · 7 comments

Comments

@AndersTao
Copy link

Munki enrolment package fails on postinstall

The error is in the postinstall, with a error 500 from the server urllib2.HTTPError: HTTP Error 500: Internal Server Error

Here is the full output

$ sudo ./postinstall.py 
Traceback (most recent call last):
  File "/Users/ladmin/Desktop/postinstall 2.py", line 95, in <module>
    token = enroll()
  File "/Users/ladmin/Desktop/postinstall 2.py", line 37, in enroll
    resp = urllib2.urlopen(req, data=data, context=ctx)
  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 437, in open
    response = meth(req, response)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 550, in http_response
    'http', request, response, code, msg, hdrs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 475, in error
    return self._call_chain(*args)
  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 558, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 500: Internal Server Error

nginx/error.log

2018/07/08 14:22:35 [warn] 1718#1718: *5382 an upstream response is buffered to a temporary file /var/cache/nginx/proxy_temp/4/18/0000000184 while reading upstream, client: 210.XXX.17.XXX, server: zentral.domain.com, request: "POST /munki/enroll/ HTTP/1.1", upstream: "http://127.0.0.1:8000/munki/enroll/", host: "zentral.domain.com"
@np5
Copy link
Member

np5 commented Jul 9, 2018

Could you post here the django logs, please ?

@AndersTao
Copy link
Author

Jul 09 08:40:26 zentral.domain.com gunicorn[1379]: 2018-07-09 06:40:26,871 PID3786 exception ERROR Internal Server Error: /munki/enroll/
Jul 09 08:40:26 zentral.domain.com gunicorn[1379]: Traceback (most recent call last):
Jul 09 08:40:26 zentral.domain.com gunicorn[1379]:   File "/home/zentral/app/venv/lib/python3.5/site-packages/django/core/handlers/exception.py", line 42, in inner
Jul 09 08:40:26 zentral.domain.com gunicorn[1379]:     response = get_response(request)
Jul 09 08:40:26 zentral.domain.com gunicorn[1379]:   File "/home/zentral/app/venv/lib/python3.5/site-packages/django/core/handlers/base.py", line 187, in _get_response
Jul 09 08:40:26 zentral.domain.com gunicorn[1379]:     response = self.process_exception_by_middleware(e, request)
Jul 09 08:40:26 zentral.domain.com gunicorn[1379]:   File "/home/zentral/app/venv/lib/python3.5/site-packages/django/core/handlers/base.py", line 185, in _get_response
Jul 09 08:40:26 zentral.domain.com gunicorn[1379]:     response = wrapped_callback(request, *callback_args, **callback_kwargs)
Jul 09 08:40:26 zentral.domain.com gunicorn[1379]:   File "/usr/lib/python3.5/contextlib.py", line 30, in inner
Jul 09 08:40:26 zentral.domain.com gunicorn[1379]:     return func(*args, **kwds)
Jul 09 08:40:26 zentral.domain.com gunicorn[1379]:   File "/home/zentral/app/venv/lib/python3.5/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
Jul 09 08:40:26 zentral.domain.com gunicorn[1379]:     return view_func(*args, **kwargs)
Jul 09 08:40:26 zentral.domain.com gunicorn[1379]:   File "/home/zentral/app/venv/lib/python3.5/site-packages/django/views/generic/base.py", line 68, in view
Jul 09 08:40:26 zentral.domain.com gunicorn[1379]:     return self.dispatch(request, *args, **kwargs)
Jul 09 08:40:26 zentral.domain.com gunicorn[1379]:   File "/home/zentral/app/venv/lib/python3.5/site-packages/django/views/generic/base.py", line 88, in dispatch
Jul 09 08:40:26 zentral.domain.com gunicorn[1379]:     return handler(request, *args, **kwargs)
Jul 09 08:40:26 zentral.domain.com gunicorn[1379]:   File "/home/zentral/app/releases/2018.07.05-15.56.05-master-3b683f/zentral/contrib/munki/views.py", line 91, in post
Jul 09 08:40:26 zentral.domain.com gunicorn[1379]:     request_json = json.load(request)
Jul 09 08:40:26 zentral.domain.com gunicorn[1379]:   File "/usr/lib/python3.5/json/__init__.py", line 268, in load
Jul 09 08:40:26 zentral.domain.com gunicorn[1379]:     parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
Jul 09 08:40:26 zentral.domain.com gunicorn[1379]:   File "/usr/lib/python3.5/json/__init__.py", line 312, in loads
Jul 09 08:40:26 zentral.domain.com gunicorn[1379]:     s.__class__.__name__))
Jul 09 08:40:26 zentral.domain.com gunicorn[1379]: TypeError: the JSON object must be str, not 'bytes'

@np5
Copy link
Member

np5 commented Jul 9, 2018

Yes, that's what I thought. Same issue as the santa enrollment one. Fixed in a000fb3. We don't get these errors in our environments.

@AndersTao
Copy link
Author

Yep, it is fixet now 👏🏼 Thanks again @np5

@np5
Copy link
Member

np5 commented Jul 9, 2018

I have found the issue. We run python 3.6 on our prod servers and in the docker setup. With python 3.6, you can pass a file opened in binary mode to json.load, not with python 3.5, which is the standard on ubuntu 16.04, used for the Zentral all-in-one images.

@AndersTao
Copy link
Author

AndersTao commented Jul 9, 2018

headmin did mention the use of python3.6 earlier, but I did not follow up after your first fix..
Any requmentet way to upgrade?, without breaking everything :)

@np5
Copy link
Member

np5 commented Jul 9, 2018

python 3.6 is not in the standard ubuntu 16.04 and debian stable distributions. As much as I would love to be able to use only the latest version, this requirement is not really reasonable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants