Bug 1501357 - foreman-rake foreman_tasks fails with NoMethodError: undefined method `state' for nil:NilClass
Summary: foreman-rake foreman_tasks fails with NoMethodError: undefined method `state&...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Tasks Plugin
Version: 6.2.11
Hardware: All
OS: Linux
medium
high
Target Milestone: Unspecified
Assignee: Adam Ruzicka
QA Contact:
URL:
Whiteboard:
: 1656125 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-10-12 12:30 UTC by Jan Jansky
Modified: 2022-03-13 14:29 UTC (History)
7 users (show)

Fixed In Version: dynflow-0.8.32
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-21 16:54:37 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 21423 0 Normal Closed foreman-rake foreman_tasks fails with NoMethodError: undefined method `state' for nil:NilClass 2020-10-15 13:00:39 UTC
Red Hat Knowledge Base (Solution) 3213711 0 None None None 2017-10-12 12:32:09 UTC

Description Jan Jansky 2017-10-12 12:30:51 UTC
Description of problem:
If it exist task in state planning and result error, task export will fail.


Version-Release number of selected component (if applicable):
foreman-debug-1.11.0.83-1.el7sat.noarch

How reproducible:
Do not know how to create task with state planning and result error

Steps to Reproduce:
1. If task with state planning and result error is in database run task-export
2. foreman-rake foreman_tasks:export_tasks task_search=all --trace

Actual results:
foreman-rake foreman_tasks:export_tasks task_search=all --trace
** Invoke foreman_tasks:export_tasks (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute foreman_tasks:export_tasks
Gathering 128 tasks.
1/128
...
123/128
rake aborted!
NoMethodError: undefined method `state' for nil:NilClass
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.7.14.14/lib/foreman_tasks/tasks/export_tasks.rake:165:in `step_css_class'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.6/web/views/plan_step.erb:4:in `block in singleton class'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.6/web/views/plan_step.erb:-5:in `instance_eval'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.6/web/views/plan_step.erb:-5:in `singleton class'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.6/web/views/plan_step.erb:-7:in `__tilt_18397580'
/opt/rh/rh-ror41/root/usr/share/gems/gems/tilt-1.4.1/lib/tilt/template.rb:170:in `call'
/opt/rh/rh-ror41/root/usr/share/gems/gems/tilt-1.4.1/lib/tilt/template.rb:170:in `evaluate'
/opt/rh/rh-ror41/root/usr/share/gems/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.7.14.14/lib/foreman_tasks/tasks/export_tasks.rake:61:in `erb'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.6/web/views/plan_step.erb:12:in `block (2 levels) in singleton class'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.6/web/views/plan_step.erb:11:in `each'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.6/web/views/plan_step.erb:11:in `block in singleton class'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.6/web/views/plan_step.erb:-5:in `instance_eval'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.6/web/views/plan_step.erb:-5:in `singleton class'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.6/web/views/plan_step.erb:-7:in `__tilt_18397580'
/opt/rh/rh-ror41/root/usr/share/gems/gems/tilt-1.4.1/lib/tilt/template.rb:170:in `call'
/opt/rh/rh-ror41/root/usr/share/gems/gems/tilt-1.4.1/lib/tilt/template.rb:170:in `evaluate'
/opt/rh/rh-ror41/root/usr/share/gems/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.7.14.14/lib/foreman_tasks/tasks/export_tasks.rake:61:in `erb'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.6/web/views/show.erb:48:in `block in singleton class'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.6/web/views/show.erb:-5:in `instance_eval'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.6/web/views/show.erb:-5:in `singleton class'
/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-0.8.13.6/web/views/show.erb:-7:in `__tilt_18397580'
/opt/rh/rh-ror41/root/usr/share/gems/gems/tilt-1.4.1/lib/tilt/template.rb:170:in `call'
/opt/rh/rh-ror41/root/usr/share/gems/gems/tilt-1.4.1/lib/tilt/template.rb:170:in `evaluate'
/opt/rh/rh-ror41/root/usr/share/gems/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.7.14.14/lib/foreman_tasks/tasks/export_tasks.rake:61:in `erb'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.7.14.14/lib/foreman_tasks/tasks/export_tasks.rake:46:in `render_task'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.7.14.14/lib/foreman_tasks/tasks/export_tasks.rake:264:in `block (5 levels) in <top (required)>'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.7.14.14/lib/foreman_tasks/tasks/export_tasks.rake:264:in `open'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.7.14.14/lib/foreman_tasks/tasks/export_tasks.rake:264:in `block (4 levels) in <top (required)>'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/relation/delegation.rb:132:in `each'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/relation/delegation.rb:132:in `each_with_index'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/relation/delegation.rb:132:in `public_send'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/relation/delegation.rb:132:in `method_missing'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/relation/delegation.rb:99:in `method_missing'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.7.14.14/lib/foreman_tasks/tasks/export_tasks.rake:263:in `block (3 levels) in <top (required)>'
/opt/rh/rh-ruby22/root/usr/share/ruby/tmpdir.rb:88:in `mktmpdir'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.7.14.14/lib/foreman_tasks/tasks/export_tasks.rake:256:in `block (2 levels) in <top (required)>'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/opt/rh/rh-ruby22/root/usr/share/ruby/monitor.rb:211:in `mon_synchronize'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/opt/rh/rh-ruby22/root/usr/bin/rake:33:in `<main>'
Tasks: TOP => foreman_tasks:export_tasks

Expected results:
foreman-rake foreman_tasks:export_tasks task_search=all --trace
** Invoke foreman_tasks:export_tasks (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute foreman_tasks:export_tasks
Gathering 410 tasks.
1/410
...
410/410
tar cvzf /tmp/task-export-1507806090.tar.gz /tmp/task-export20171012-19818-7kkxfd > /dev/null
tar: Entferne führende „/“ von Elementnamen
Created /tmp/task-export-1507806090.tar.gz

Additional info:
So far task with state planning and result error was created on customer satellite and also on my satellite (on both was removed).

I also wrote KCS for this problem https://access.redhat.com/solutions/3213711

Comment 1 Pavel Moravec 2017-10-12 12:36:36 UTC
(I guess this is not applicable to 6.3 due to the different task export being collected, so raising just 6.2.z flag - this bug prevents gathering task export / foreman-debug what has some impact to Support)

Comment 3 Brad Buckingham 2017-10-13 15:42:45 UTC
Pavel, 

Do you know if this was introduced in 6.2.11? (i.e. regression between Zs)

Comment 4 Pavel Moravec 2017-10-13 17:11:55 UTC
(In reply to Brad Buckingham from comment #3)
> Pavel, 
> 
> Do you know if this was introduced in 6.2.11? (i.e. regression between Zs)

Comparing the same code with foreman-tasks-0.7.14.6, I think this bug has been there since (at least) 6.2.0.

Comment 5 Adam Ruzicka 2017-10-23 10:37:37 UTC
Created redmine issue http://projects.theforeman.org/issues/21423 from this bug

Comment 6 Satellite Program 2017-10-23 12:02:05 UTC
Upstream bug assigned to aruzicka

Comment 7 Satellite Program 2017-10-23 12:02:09 UTC
Upstream bug assigned to aruzicka

Comment 8 Satellite Program 2018-02-21 16:54:37 UTC
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA.
> > 
> > For information on the advisory, and where to find the updated files, follow the link below.
> > 
> > If the solution does not work for you, open a new bug report.
> > 
> > https://access.redhat.com/errata/RHSA-2018:0336

Comment 9 Andrea Perotti 2018-12-05 12:37:29 UTC
*** Bug 1656125 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.