yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #92660
[Bug 2028169] [NEW] TypeError: Object of type bytes is not JSON serializable when uploading heat template via GUI with get_file parameter
Public bug reported:
on horizon 22.1.0+
using template:
heat_template_version: 2021-04-16
description: Simple template to deploy a single compute instance
resources:
my_instance:
type: OS::Nova::Server
properties:
key_name: DEPLOYER_key
image: b5a4921a-2f15-4452-bc22-3b13dcf3ae0f
flavor: m1.tiny
user_data: { get_file: https://github.com/ruanyf/simple-bash-scripts/blob/master/scripts/hello-world.sh }
we are getting: error unable to form submit.
and in the logs:
nginx error
2023/07/10 20:18:18 [warn] 1043565#1043565: *6359589 an upstream response is buffered to a temporary file /var/cache/nginx/uwsgi_temp/9/14/0000071149 while reading upstream, client: 10.6.81.9, server: , request: "POST /dashboard/project/stacks/select_template HTTP/1.1", upstream: "uwsgi://unix:///var/lib/horizon/openstack-dashboard-uwsgi.sock:", host: "XXX", referrer: "https://XXX/dashboard/project/stacks/"
2023/07/10 20:18:23 [info] 1043565#1043565: *6359589 client 10.6.81.9 closed keepalive connection (104: Connection reset by peer)
horizon error
{"Description": "Simple template to deploy a single compute instance",
"Parameters": {}, "Environment": {"resource_registry": {"resources":
{}}, "parameters": {}, "parameter_defaults": {}, "event_sinks": []}}
[pid: 1038943|app: 0|req: 51437/411436] 10.6.81.10 () {32 vars in 382 bytes} [Mon Jul 10 19:47:16 2023] GET /dashboard/auth/login/ => generated 9711 bytes in 61 msecs (HTTP/1.0 200) 9 headers in 399 bytes (1 switches on core 13)
ERROR django.request Internal Server Error: /dashboard/project/stacks/select_template
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/usr/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python3.9/site-packages/horizon/decorators.py", line 51, in dec
return view_func(request, *args, **kwargs)
File "/usr/lib/python3.9/site-packages/horizon/decorators.py", line 35, in dec
return view_func(request, *args, **kwargs)
File "/usr/lib/python3.9/site-packages/horizon/decorators.py", line 35, in dec
return view_func(request, *args, **kwargs)
File "/usr/lib/python3.9/site-packages/horizon/decorators.py", line 111, in dec
return view_func(request, *args, **kwargs)
File "/usr/lib/python3.9/site-packages/horizon/decorators.py", line 83, in dec
return view_func(request, *args, **kwargs)
File "/usr/lib/python3.9/site-packages/django/views/generic/base.py", line 70, in view
return self.dispatch(request, *args, **kwargs)
File "/usr/lib/python3.9/site-packages/django/views/generic/base.py", line 98, in dispatch
return handler(request, *args, **kwargs)
File "/usr/lib/python3.9/site-packages/django/views/generic/edit.py", line 142, in post
return self.form_valid(form)
File "/usr/lib/python3.9/site-packages/horizon/forms/views.py", line 191, in form_valid
exceptions.handle(self.request)
File "/usr/lib/python3.9/site-packages/horizon/forms/views.py", line 188, in form_valid
handled = form.handle(self.request, form.cleaned_data)
File "/usr/lib/python3.9/site-packages/heat_dashboard/content/stacks/forms.py", line 274, in handle
return self.next_view.as_view()(request, **kwargs)
File "/usr/lib/python3.9/site-packages/django/views/generic/base.py", line 70, in view
return self.dispatch(request, *args, **kwargs)
File "/usr/lib/python3.9/site-packages/django/views/generic/base.py", line 98, in dispatch
return handler(request, *args, **kwargs)
File "/usr/lib/python3.9/site-packages/django/views/generic/edit.py", line 133, in get
return self.render_to_response(self.get_context_data())
File "/usr/lib/python3.9/site-packages/horizon/forms/views.py", line 144, in get_context_data
context = super().get_context_data(**kwargs)
File "/usr/lib/python3.9/site-packages/horizon/forms/views.py", line 77, in get_context_data
context = super().get_context_data(**kwargs)
File "/usr/lib/python3.9/site-packages/horizon/forms/views.py", line 56, in get_context_data
context = super().get_context_data(**kwargs)
File "/usr/lib/python3.9/site-packages/django/views/generic/edit.py", line 66, in get_context_data
kwargs['form'] = self.get_form()
File "/usr/lib/python3.9/site-packages/horizon/forms/views.py", line 179, in get_form
return form_class(self.request, **self.get_form_kwargs())
File "/usr/lib/python3.9/site-packages/heat_dashboard/content/stacks/views.py", line 185, in get_form_kwargs
kwargs = super(CreateStackView, self).get_form_kwargs()
File "/usr/lib/python3.9/site-packages/django/views/generic/edit.py", line 38, in get_form_kwargs
'initial': self.get_initial(),
File "/usr/lib/python3.9/site-packages/heat_dashboard/content/stacks/views.py", line 181, in get_initial
initial['parameters'] = json.dumps(self.kwargs['parameters'])
File "/usr/lib64/python3.9/json/__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
File "/usr/lib64/python3.9/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib64/python3.9/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/usr/lib64/python3.9/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type bytes is not JSON serializable
[pid: 1038938|app: 0|req: 51430/411437] 10.6.81.9 () {64 vars in 1378 bytes} [Mon Jul 10 19:47:14 2023] POST /dashboard/project/stacks/select_template => generated 768236 bytes in 2470 msecs (HTTP/1.1 500) 6 headers in 182 bytes (4 switches on core 5)
** Affects: horizon
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Dashboard (Horizon).
https://bugs.launchpad.net/bugs/2028169
Title:
TypeError: Object of type bytes is not JSON serializable when
uploading heat template via GUI with get_file parameter
Status in OpenStack Dashboard (Horizon):
New
Bug description:
on horizon 22.1.0+
using template:
heat_template_version: 2021-04-16
description: Simple template to deploy a single compute instance
resources:
my_instance:
type: OS::Nova::Server
properties:
key_name: DEPLOYER_key
image: b5a4921a-2f15-4452-bc22-3b13dcf3ae0f
flavor: m1.tiny
user_data: { get_file: https://github.com/ruanyf/simple-bash-scripts/blob/master/scripts/hello-world.sh }
we are getting: error unable to form submit.
and in the logs:
nginx error
2023/07/10 20:18:18 [warn] 1043565#1043565: *6359589 an upstream response is buffered to a temporary file /var/cache/nginx/uwsgi_temp/9/14/0000071149 while reading upstream, client: 10.6.81.9, server: , request: "POST /dashboard/project/stacks/select_template HTTP/1.1", upstream: "uwsgi://unix:///var/lib/horizon/openstack-dashboard-uwsgi.sock:", host: "XXX", referrer: "https://XXX/dashboard/project/stacks/"
2023/07/10 20:18:23 [info] 1043565#1043565: *6359589 client 10.6.81.9 closed keepalive connection (104: Connection reset by peer)
horizon error
{"Description": "Simple template to deploy a single compute instance",
"Parameters": {}, "Environment": {"resource_registry": {"resources":
{}}, "parameters": {}, "parameter_defaults": {}, "event_sinks": []}}
[pid: 1038943|app: 0|req: 51437/411436] 10.6.81.10 () {32 vars in 382 bytes} [Mon Jul 10 19:47:16 2023] GET /dashboard/auth/login/ => generated 9711 bytes in 61 msecs (HTTP/1.0 200) 9 headers in 399 bytes (1 switches on core 13)
ERROR django.request Internal Server Error: /dashboard/project/stacks/select_template
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/usr/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python3.9/site-packages/horizon/decorators.py", line 51, in dec
return view_func(request, *args, **kwargs)
File "/usr/lib/python3.9/site-packages/horizon/decorators.py", line 35, in dec
return view_func(request, *args, **kwargs)
File "/usr/lib/python3.9/site-packages/horizon/decorators.py", line 35, in dec
return view_func(request, *args, **kwargs)
File "/usr/lib/python3.9/site-packages/horizon/decorators.py", line 111, in dec
return view_func(request, *args, **kwargs)
File "/usr/lib/python3.9/site-packages/horizon/decorators.py", line 83, in dec
return view_func(request, *args, **kwargs)
File "/usr/lib/python3.9/site-packages/django/views/generic/base.py", line 70, in view
return self.dispatch(request, *args, **kwargs)
File "/usr/lib/python3.9/site-packages/django/views/generic/base.py", line 98, in dispatch
return handler(request, *args, **kwargs)
File "/usr/lib/python3.9/site-packages/django/views/generic/edit.py", line 142, in post
return self.form_valid(form)
File "/usr/lib/python3.9/site-packages/horizon/forms/views.py", line 191, in form_valid
exceptions.handle(self.request)
File "/usr/lib/python3.9/site-packages/horizon/forms/views.py", line 188, in form_valid
handled = form.handle(self.request, form.cleaned_data)
File "/usr/lib/python3.9/site-packages/heat_dashboard/content/stacks/forms.py", line 274, in handle
return self.next_view.as_view()(request, **kwargs)
File "/usr/lib/python3.9/site-packages/django/views/generic/base.py", line 70, in view
return self.dispatch(request, *args, **kwargs)
File "/usr/lib/python3.9/site-packages/django/views/generic/base.py", line 98, in dispatch
return handler(request, *args, **kwargs)
File "/usr/lib/python3.9/site-packages/django/views/generic/edit.py", line 133, in get
return self.render_to_response(self.get_context_data())
File "/usr/lib/python3.9/site-packages/horizon/forms/views.py", line 144, in get_context_data
context = super().get_context_data(**kwargs)
File "/usr/lib/python3.9/site-packages/horizon/forms/views.py", line 77, in get_context_data
context = super().get_context_data(**kwargs)
File "/usr/lib/python3.9/site-packages/horizon/forms/views.py", line 56, in get_context_data
context = super().get_context_data(**kwargs)
File "/usr/lib/python3.9/site-packages/django/views/generic/edit.py", line 66, in get_context_data
kwargs['form'] = self.get_form()
File "/usr/lib/python3.9/site-packages/horizon/forms/views.py", line 179, in get_form
return form_class(self.request, **self.get_form_kwargs())
File "/usr/lib/python3.9/site-packages/heat_dashboard/content/stacks/views.py", line 185, in get_form_kwargs
kwargs = super(CreateStackView, self).get_form_kwargs()
File "/usr/lib/python3.9/site-packages/django/views/generic/edit.py", line 38, in get_form_kwargs
'initial': self.get_initial(),
File "/usr/lib/python3.9/site-packages/heat_dashboard/content/stacks/views.py", line 181, in get_initial
initial['parameters'] = json.dumps(self.kwargs['parameters'])
File "/usr/lib64/python3.9/json/__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
File "/usr/lib64/python3.9/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib64/python3.9/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/usr/lib64/python3.9/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type bytes is not JSON serializable
[pid: 1038938|app: 0|req: 51430/411437] 10.6.81.9 () {64 vars in 1378 bytes} [Mon Jul 10 19:47:14 2023] POST /dashboard/project/stacks/select_template => generated 768236 bytes in 2470 msecs (HTTP/1.1 500) 6 headers in 182 bytes (4 switches on core 5)
To manage notifications about this bug go to:
https://bugs.launchpad.net/horizon/+bug/2028169/+subscriptions