Bug #38060
openSlow dialog when import role
Description
The dialog for importing the changed roles is quite slow because on the one side it tries to search all ansible collections incl. the foreman ones (which is already an open ticket), but on the other hand it tries to parse some roles multiple times due to the "Proxy::Ansible::ReadVariablesException".
This exception is thrown if a .yaml file doesn't contain any content. This also affects our custom roles, since we use the default ansible structure to create them. If e.g. a role has no default variables (defaults/main.yaml is empty) there error is also shown. It would be nice to ignore empty files.
An example is
2024-12-03T16:08:18 28237291 [E] <Proxy::Ansible::ReadVariablesException> ERF71-4591 [Proxy::Ansible::ReadVariablesException]: Could not parse YAML file: /usr/share/ansible/collections/ansible_collections/google/cloud/roles/gcsfuse/defaults/main.yml
It takes around 2 minutes till the dialog finally opens.
Updated by Benjamin Oeser 15 days ago
Additional Log:
/usr/share/gems/gems/smart_proxy_ansible-3.5.6/lib/smart_proxy_ansible/variables_extractor.rb:18:in `block in extract_variables'
/usr/share/gems/gems/smart_proxy_ansible-3.5.6/lib/smart_proxy_ansible/variables_extractor.rb:11:in `each'
/usr/share/gems/gems/smart_proxy_ansible-3.5.6/lib/smart_proxy_ansible/variables_extractor.rb:11:in `reduce'
/usr/share/gems/gems/smart_proxy_ansible-3.5.6/lib/smart_proxy_ansible/variables_extractor.rb:11:in `extract_variables'
/usr/share/gems/gems/smart_proxy_ansible-3.5.6/lib/smart_proxy_ansible/api.rb:53:in `block in extract_variables'
/usr/share/gems/gems/smart_proxy_ansible-3.5.6/lib/smart_proxy_ansible/api.rb:50:in `each'
/usr/share/gems/gems/smart_proxy_ansible-3.5.6/lib/smart_proxy_ansible/api.rb:50:in `extract_variables'
/usr/share/gems/gems/smart_proxy_ansible-3.5.6/lib/smart_proxy_ansible/api.rb:16:in `block (2 levels) in <class:Api>'
/usr/share/gems/gems/smart_proxy_ansible-3.5.6/lib/smart_proxy_ansible/api.rb:15:in `each'
/usr/share/gems/gems/smart_proxy_ansible-3.5.6/lib/smart_proxy_ansible/api.rb:15:in `block in <class:Api>'
/usr/share/gems/gems/sinatra-2.2.4/lib/sinatra/base.rb:1697:in `call'
/usr/share/gems/gems/sinatra-2.2.4/lib/sinatra/base.rb:1697:in `block in compile!'
/usr/share/gems/gems/sinatra-2.2.4/lib/sinatra/base.rb:1030:in `block (3 levels) in route!'
/usr/share/gems/gems/sinatra-2.2.4/lib/sinatra/base.rb:1049:in `route_eval'
/usr/share/gems/gems/sinatra-2.2.4/lib/sinatra/base.rb:1030:in `block (2 levels) in route!'
/usr/share/gems/gems/sinatra-2.2.4/lib/sinatra/base.rb:1078:in `block in process_route'
/usr/share/gems/gems/sinatra-2.2.4/lib/sinatra/base.rb:1076:in `catch'
/usr/share/gems/gems/sinatra-2.2.4/lib/sinatra/base.rb:1076:in `process_route'
/usr/share/gems/gems/sinatra-2.2.4/lib/sinatra/base.rb:1028:in `block in route!'
/usr/share/gems/gems/sinatra-2.2.4/lib/sinatra/base.rb:1025:in `each'
/usr/share/gems/gems/sinatra-2.2.4/lib/sinatra/base.rb:1025:in `route!'
/usr/share/gems/gems/sinatra-2.2.4/lib/sinatra/base.rb:1147:in `block in dispatch!'
/usr/share/gems/gems/sinatra-2.2.4/lib/sinatra/base.rb:1119:in `block in invoke'
/usr/share/gems/gems/sinatra-2.2.4/lib/sinatra/base.rb:1119:in `catch'
/usr/share/gems/gems/sinatra-2.2.4/lib/sinatra/base.rb:1119:in `invoke'
/usr/share/gems/gems/sinatra-2.2.4/lib/sinatra/base.rb:1142:in `dispatch!'
/usr/share/gems/gems/sinatra-2.2.4/lib/sinatra/base.rb:956:in `block in call!'
/usr/share/gems/gems/sinatra-2.2.4/lib/sinatra/base.rb:1119:in `block in invoke'
/usr/share/gems/gems/sinatra-2.2.4/lib/sinatra/base.rb:1119:in `catch'
/usr/share/gems/gems/sinatra-2.2.4/lib/sinatra/base.rb:1119:in `invoke'
/usr/share/gems/gems/sinatra-2.2.4/lib/sinatra/base.rb:956:in `call!'
/usr/share/gems/gems/sinatra-2.2.4/lib/sinatra/base.rb:945:in `call'
/usr/share/foreman-proxy/lib/proxy/log.rb:101:in `call'
/usr/share/foreman-proxy/lib/proxy/request_id_middleware.rb:11:in `call'
/usr/share/gems/gems/rack-protection-2.2.4/lib/rack/protection/xss_header.rb:18:in `call'
/usr/share/gems/gems/rack-protection-2.2.4/lib/rack/protection/path_traversal.rb:16:in `call'
/usr/share/gems/gems/rack-protection-2.2.4/lib/rack/protection/json_csrf.rb:26:in `call'
/usr/share/gems/gems/rack-protection-2.2.4/lib/rack/protection/base.rb:50:in `call'
/usr/share/gems/gems/rack-protection-2.2.4/lib/rack/protection/base.rb:50:in `call'
/usr/share/gems/gems/rack-protection-2.2.4/lib/rack/protection/frame_options.rb:31:in `call'
/usr/share/gems/gems/rack-2.2.9/lib/rack/null_logger.rb:11:in `call'
/usr/share/gems/gems/rack-2.2.9/lib/rack/head.rb:12:in `call'
/usr/share/gems/gems/sinatra-2.2.4/lib/sinatra/show_exceptions.rb:22:in `call'
/usr/share/gems/gems/sinatra-2.2.4/lib/sinatra/base.rb:218:in `call'
/usr/share/gems/gems/sinatra-2.2.4/lib/sinatra/base.rb:2004:in `call'
/usr/share/gems/gems/sinatra-2.2.4/lib/sinatra/base.rb:1564:in `block in call'
/usr/share/gems/gems/sinatra-2.2.4/lib/sinatra/base.rb:1780:in `synchronize'
/usr/share/gems/gems/sinatra-2.2.4/lib/sinatra/base.rb:1564:in `call'
/usr/share/gems/gems/rack-2.2.9/lib/rack/urlmap.rb:74:in `block in call'
/usr/share/gems/gems/rack-2.2.9/lib/rack/urlmap.rb:58:in `each'
/usr/share/gems/gems/rack-2.2.9/lib/rack/urlmap.rb:58:in `call'
/usr/share/gems/gems/rack-2.2.9/lib/rack/builder.rb:244:in `call'
/usr/share/gems/gems/rack-2.2.9/lib/rack/handler/webrick.rb:95:in `service'
/usr/share/gems/gems/webrick-1.8.1/lib/webrick/httpserver.rb:140:in `service'
/usr/share/gems/gems/webrick-1.8.1/lib/webrick/httpserver.rb:96:in `run'
/usr/share/gems/gems/webrick-1.8.1/lib/webrick/server.rb:310:in `block in start_thread'
/usr/share/gems/gems/logging-2.4.0/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'