Bug 1360771 - Dashboard gives undefined method `label' for nil:NilClass
Summary: Dashboard gives undefined method `label' for nil:NilClass
Keywords:
Status: CLOSED DUPLICATE of bug 1361793
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Dashboard
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: Unspecified
Assignee: Justin Sherrill
QA Contact:
URL:
Whiteboard:
: 1364768 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-07-27 12:44 UTC by Sean O'Keeffe
Modified: 2019-12-16 06:12 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-08-16 21:51:27 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Foreman Issue Tracker 13823 Normal Rejected Dashboard gives undefined method `label' for nil:NilClass 2020-05-11 16:28:30 UTC

Description Sean O'Keeffe 2016-07-27 12:44:25 UTC
Description of problem:

After 6.2 upgrade the dashboard no longer loads and errors with "undefined method `label' for nil:NilClass". We think this happens if the user has deleted a bunch of old stopped tasks before. The newer dynflows provide this functionality via a rake task, but we need to handle it if a user has removed them before. 

Version-Release number of selected component (if applicable):
6.2

How reproducible:
not sure

Steps to Reproduce:
1. install 6.1
2. sync something so you create some tasks
3. delete some of the tasks using the console.
4. upgrade to 6.2
5. dashboard wont load

Actual results:
dashboard wont load

Expected results:
dashboard to display correctly

Additional info:

Comment 1 Sean O'Keeffe 2016-07-27 12:46:56 UTC
You can delete a tasks using, maybe replacing the label.

# foreman-rake console  
ForemanTasks::Task.where(:state => :stopped).where(:label => "Actions::Katello::Repository::Sync").destroy_all

Comment 2 Bryan Kearney 2016-07-27 14:17:07 UTC
Upstream bug assigned to jsherril@redhat.com

Comment 6 Paul Seymour 2016-08-07 09:36:45 UTC
OK hitting this myself and raised a dupe BZ#1364768 as my search-foo was not great.

Now how to resolve it ?

Comment 7 Tomer Brisker 2016-08-07 12:53:01 UTC
*** Bug 1364768 has been marked as a duplicate of this bug. ***

Comment 8 Paul Seymour 2016-08-08 06:17:38 UTC
I managed to fix this (or workaround it at least) by applying this:-

https://github.com/Katello/katello/pull/6028

Cleared sessions & katello-service restart

Comment 9 Rudnei Bertol Jr. 2016-08-09 20:49:03 UTC
I've same error, and decided updating file /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.68/app/models/katello/content_view_history.rb

line ~45 

-def humanized_action
-  case self.task.label
-  when "Actions::Katello::ContentViewVersion::Export"
-    _("Exported version")
-  when "Actions::Katello::ContentView::Publish"
-    _("Published new version")
-  when "Actions::Katello::ContentView::Promote"
-    _("Promoted to %{environment}") % { :environment => self.environment.name }
-  when "Actions::Katello::ContentView::Remove"
-    _("Deleted from %{environment}") % { :environment => self.environment.name }
-  end
-end

+def humanized_action
+  case self.task.try(:label)
+  when "Actions::Katello::ContentViewVersion::Export"
+    _("Exported version")
+  when "Actions::Katello::ContentView::Publish"
+    _("Published new version")
+  when "Actions::Katello::ContentView::Promote"
+    _("Promoted to %{environment}") % { :environment => self.environment.try(:name) || _('Unknown') }
+  when "Actions::Katello::ContentView::Remove"
+    _("Deleted from %{environment}") % { :environment => self.environment.try(:name) || _('Unknown')}
+  else
+    _("Unknown Action")
+  end
+end


Clear all tasks in DynFlow, database and pulp.
Restart all services.

Comment 10 Mike McCune 2016-08-16 21:51:27 UTC

*** This bug has been marked as a duplicate of bug 1361793 ***


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