Actions
Bug #15749
closedundefined method [] for nil:NilClass related to activation_key pool association
Description
Various actions that index pools seem to be causing errors at various points such as importing a manifest or removing a consumer. Here is the traceback:
NoMethodError: undefined method `[]' for nil:NilClass Backtrace: /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.2/app/models/katello/glue/candlepin/pool.rb:127:in `block (2 levels) in create_activation_key_associations' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.2/app/models/katello/glue/candlepin/pool.rb:127:in `any?' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.2/app/models/katello/glue/candlepin/pool.rb:127:in `block in create_activation_key_associations' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.2/app/models/katello/glue/candlepin/pool.rb:126:in `collect' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.2/app/models/katello/glue/candlepin/pool.rb:126:in `create_activation_key_associations' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.2/app/models/katello/glue/candlepin/pool.rb:117:in `import_data' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.2/app/lib/actions/katello/host/destroy.rb:48:in `block in finalize' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.2/app/lib/actions/katello/host/destroy.rb:46:in `each' /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.2/app/lib/actions/katello/host/destroy.rb:46:in `finalize' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/action.rb:528:in `block (2 levels) in execute_finalize' /opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.11/lib/dynflow/middleware/stack.rb:26:in `call'
It has been reported in the wild, and seems to indicate that Candlepin is returning data that looks like:
{'pools' => [{}]}
when we're expecting either:
{'pools' => []}
or
{'pools' => [{'pool => {'id' => X}}]}
When requesting the data, we've never been able to capture that output
Actions