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

Can't access Instance Group from Administration Menu #261

Closed
eniomachado opened this issue Apr 30, 2021 · 13 comments
Closed

Can't access Instance Group from Administration Menu #261

eniomachado opened this issue Apr 30, 2021 · 13 comments

Comments

@eniomachado
Copy link

Hi,
I installed awx-operator on openshift 4.6.13. When I'm trying to access "Instance groups", I'm getting an error in browser:

Something went wrong ...
There was an error loading this content. Please reload the page. Back to Dashboard.
Details >>>
OPTIONS /api/v2/instance_groups/ 500
A server error has occurred.

Checking the log in the "awx" pod, I get the error:

2021-04-30 04:42:58,023 INFO [8da8604176834ab29675faf0f1f4ea61] awx.analytics.performance request: <WSGIRequest: GET '/api/v2/config/'>, response_time: 0.213s
10.131.2.1 - - [30/Apr/2021:04:42:58 +0000] "GET /api/v2/config/ HTTP/1.1" 200 2002 "http://awx.apps.ocp.domain/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "172.20.27.100"
[pid: 20212|app: 0|req: 481/8212] 10.131.2.1 () {64 vars in 2951 bytes} [Fri Apr 30 04:42:57 2021] GET /api/v2/config/ => generated 2002 bytes in 217 msecs (HTTP/1.1 200) 14 headers in 584 bytes (1 switches on core 0)
2021-04-30 04:42:58,088 INFO [6901c7e48f1a4054bf60ae8d0740f9d7] awx.analytics.performance request: <WSGIRequest: GET '/api/v2/instance_groups/?order_by=name&page=1&page_size=20'>, response_time: 0.288s
10.131.2.1 - - [30/Apr/2021:04:42:58 +0000] "GET /api/v2/instance_groups/?order_by=name&page=1&page_size=20 HTTP/1.1" 200 737 "http://awx.apps.ocp.domain/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "172.20.27.100"
[pid: 25187|app: 0|req: 143/8213] 10.131.2.1 () {64 vars in 3037 bytes} [Fri Apr 30 04:42:57 2021] GET /api/v2/instance_groups/?order_by=name&page=1&page_size=20 => generated 737 bytes in 290 msecs (HTTP/1.1 200) 14 headers in 575 bytes (1 switches on core 0)
2021-04-30 04:42:58,322 INFO [3a1669b00856485e9d3f4a1527995ef2] awx.analytics.performance request: <WSGIRequest: GET '/api/v2/me/'>, response_time: 0.455s
[pid: 17827|app: 0|req: 783/8214] 10.131.2.1 () {64 vars in 2942 bytes} [Fri Apr 30 04:42:57 2021] GET /api/v2/me/ => generated 955 bytes in 457 msecs (HTTP/1.1 200) 14 headers in 569 bytes (1 switches on core 0)
10.131.2.1 - - [30/Apr/2021:04:42:58 +0000] "GET /api/v2/me/ HTTP/1.1" 200 955 "http://awx.apps.ocp.domain/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "172.20.27.100"
2021-04-30 04:42:58,368 ERROR [9665f945a9954d26be025d98d85c0ea6] django.request Internal Server Error: /api/v2/instance_groups/
Traceback (most recent call last):
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/lib64/python3.8/contextlib.py", line 75, in inner
return func(*args, **kwds)
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/views/generic/base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/api/generics.py", line 324, in dispatch
return super(APIView, self).dispatch(request, *args, **kwargs)
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/rest_framework/views.py", line 509, in dispatch
response = self.handle_exception(exc)
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/rest_framework/views.py", line 469, in handle_exception
self.raise_uncaught_exception(exc)
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
raise exc
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/rest_framework/views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/rest_framework/views.py", line 520, in options
data = self.metadata_class().determine_metadata(request, self)
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/api/metadata.py", line 245, in determine_metadata
metadata = super(Metadata, self).determine_metadata(request, view)
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/rest_framework/metadata.py", line 68, in determine_metadata
actions = self.determine_actions(request, view)
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/api/metadata.py", line 209, in determine_actions
meta['default'] = AWXReceptorJob().pod_definition
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/main/tasks.py", line 3081, in pod_definition
default_pod_spec = get_default_pod_spec()
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/main/utils/execution_environments.py", line 21, in get_default_pod_spec
"image": get_default_execution_environment().image,
AttributeError: 'NoneType' object has no attribute 'image'
2021-04-30 04:42:58,368 ERROR [9665f945a9954d26be025d98d85c0ea6] django.request Internal Server Error: /api/v2/instance_groups/
Traceback (most recent call last):
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/lib64/python3.8/contextlib.py", line 75, in inner
return func(*args, **kwds)
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/views/generic/base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/api/generics.py", line 324, in dispatch
return super(APIView, self).dispatch(request, *args, **kwargs)
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/rest_framework/views.py", line 509, in dispatch
response = self.handle_exception(exc)
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/rest_framework/views.py", line 469, in handle_exception
self.raise_uncaught_exception(exc)
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
raise exc
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/rest_framework/views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/rest_framework/views.py", line 520, in options
data = self.metadata_class().determine_metadata(request, self)
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/api/metadata.py", line 245, in determine_metadata
metadata = super(Metadata, self).determine_metadata(request, view)
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/rest_framework/metadata.py", line 68, in determine_metadata
actions = self.determine_actions(request, view)
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/api/metadata.py", line 209, in determine_actions
meta['default'] = AWXReceptorJob().pod_definition
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/main/tasks.py", line 3081, in pod_definition
default_pod_spec = get_default_pod_spec()
File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/main/utils/execution_environments.py", line 21, in get_default_pod_spec
"image": get_default_execution_environment().image,
AttributeError: 'NoneType' object has no attribute 'image'
2021-04-30 04:42:58,372 INFO [9665f945a9954d26be025d98d85c0ea6] awx.analytics.performance request: <WSGIRequest: OPTIONS '/api/v2/instance_groups/'>, response_time: 0.568s
[pid: 15951|app: 0|req: 683/8215] 10.131.2.1 () {66 vars in 3017 bytes} [Fri Apr 30 04:42:57 2021] OPTIONS /api/v2/instance_groups/ => generated 41 bytes in 570 msecs (HTTP/1.1 500) 8 headers in 309 bytes (1 switches on core 0)
10.131.2.1 - - [30/Apr/2021:04:42:58 +0000] "OPTIONS /api/v2/instance_groups/ HTTP/1.1" 500 41 "http://awx.apps.ocp.domain/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36" "172.20.27.100"
RESULT 2
OKREADY

image

@supremedacos
Copy link

I am also experiencing this.

@supremedacos
Copy link

supremedacos commented Apr 30, 2021

I think there are 2 bugs here, first one is the code is looking for the config name DEFAULT_EXECUTION_ENVIRONMENT but awx-operator is creating, DEFAULT_EXECUTION_ENVIRONMENTS
https://github.com/ansible/awx/blob/f5c176701b0551e179bb4ef663b57fd3a6ba6f0a/awx/main/utils/execution_environments.py#L7

The 2nd thing is there needs to be better type/error checking when get_default_execution_environment() returns None
https://github.com/ansible/awx/blob/f5c176701b0551e179bb4ef663b57fd3a6ba6f0a/awx/main/utils/execution_environments.py#L21

@supremedacos
Copy link

This is not Ideal but, I got around this by setting the managed_by_tower = 't' directly in the DB

awx=> update main_executionenvironment set managed_by_tower = 't' where id = 1;

@endriu0
Copy link

endriu0 commented May 3, 2021

Had the same issue and found issue here or on awx gh - not sure where now which said that :

tower_create_preload_data: 

needs to be true.

I kept it as false since in the past it would create demo templates but it seems it's no longer doing that.

@eniomachado
Copy link
Author

Thanks @dacosta89 !

@eniomachado
Copy link
Author

@endriu0 where and how can I change to be "true"? Thanks!

@endriu0
Copy link

endriu0 commented May 3, 2021

Hey @eniomachado depends how you installed it but gonna assume you installed operator and then used kubectl on a awx yaml file with no overrides. If so you will need to add to your my-awx.yaml this line under spec and apply again :

tower_create_preload_data: true

And then kubectl apply -f my-awx.yaml

Example of my-awx.yaml file :

---
apiVersion: awx.ansible.com/v1beta1
kind: AWX
metadata:
  name: funhouse
spec:
...
  tower_create_preload_data: true

@endriu0
Copy link

endriu0 commented May 3, 2021

Found the issue : ansible/awx#9851

@eniomachado
Copy link
Author

Hi @endriu0 this solution works for me, thanks for your help.

@dacosta89 have a look, what @endriu0 said about "tower_create_preload_data: true", should be a better fix.

@eniomachado
Copy link
Author

image

@shanemcd
Copy link
Member

shanemcd commented May 3, 2021

Hi all. Let's track this in ansible/awx#9851

@shanemcd shanemcd closed this as completed May 3, 2021
@vivekshete9
Copy link

I am still having this issue in latest awx-operator v2.17.0. And this tower_create_preload_data is no more valid. Is there a workaround?

@vivekshete9
Copy link

I used this flag create_preload_data: true but still no luck
Screenshot 2024-05-30 at 10 32 47 AM

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

5 participants