Bug 1385878 - pre-upgrade check script tells to wait even though there are no active tasks
Summary: pre-upgrade check script tells to wait even though there are no active tasks
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Upgrades
Version: 6.2.2
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: Unspecified
Assignee: Brad Buckingham
QA Contact: Renzo Nuccitelli
URL:
Whiteboard:
Depends On:
Blocks: 1508472
TreeView+ depends on / blocked
 
Reported: 2016-10-17 20:39 UTC by sthirugn@redhat.com
Modified: 2021-08-30 10:43 UTC (History)
9 users (show)

Fixed In Version: rubygem-katello-3.4.5.26
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1508472 (view as bug list)
Environment:
Last Closed: 2018-02-21 16:54:17 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 17048 0 Normal Closed pre-upgrade check script tells to wait even though there are no active tasks 2021-01-28 12:26:11 UTC
Red Hat Knowledge Base (Solution) 2184801 0 None None None 2018-02-16 16:18:29 UTC

Description sthirugn@redhat.com 2016-10-17 20:39:02 UTC
Description of problem:
pre-upgrade check script tells to wait even though there are no active tasks

Version-Release number of selected component (if applicable):
# rpm -qa | grep satellite
satellite-installer-6.2.0.12-1.el7sat.noarch
tfm-rubygem-foreman_theme_satellite-0.1.28-1.el7sat.noarch
satellite-cli-6.2.2-1.1.el7sat.noarch
satellite-6.2.2-1.1.el7sat.noarch


How reproducible:
Always

Steps to Reproduce:
# foreman-rake katello:upgrade_check
This script makes no modifications and can be re-run multiple times for the most up to date results.
Checking upgradeability...

Checking for running tasks...
[PASS] - There are 0 active tasks. 
         Please wait for these to complete or cancel them from the Monitor tab.

Actual results:
See above - "Please wait for these to complete or cancel them from the Monitor tab."

Expected results:
The above line should not be printed. Instead, show something like:

"Please proceed with the upgrade"

Additional info:

Comment 2 Brad Buckingham 2016-10-20 14:35:54 UTC
Created redmine issue http://projects.theforeman.org/issues/17048 from this bug

Comment 3 Brad Buckingham 2016-10-20 14:56:44 UTC
Upstream Katello PR: https://github.com/Katello/katello/pull/6407

Comment 4 Chris Roberts 2017-08-23 16:26:50 UTC
[root@rhel7 ~]# foreman-rake katello:upgrade_check
/opt/theforeman/tfm/root/usr/share/gems/gems/redhat_access-2.0.3/app/services/redhat_access/telemetry/look_ups.rb:171: warning: key :hosts is duplicated and overwritten on line 172
This script makes no modifications and can be re-run multiple times for the most up to date results.
Checking upgradeability...

Checking for running tasks...
[FAIL] - There are 1 active tasks. 
         Please wait for these to complete or cancel them from the Monitor tab.

[root@rhel7 ~]# su - postgres
Last login: Wed Aug 23 16:25:33 UTC 2017 on pts/0
-bash-4.2$ psql foreman
psql (9.2.21)
Type "help" for help.

foreman=# select * from foreman_tasks_tasks where state = 'running';
 id | type | label | started_at | ended_at | state | result | external_id | parent_task_id | start_at | start_before 
----+------+-------+------------+----------+-------+--------+-------------+----------------+----------+--------------
(0 rows)

Failed QA

Comment 5 Brad Buckingham 2017-11-01 11:59:03 UTC
Note: the change introduced by the BZ was only to the text output when the task count was 0.  The above appears to be a different problem where perhaps the count in the DB is 0; however, the app saw something different.

Chris, can you provide details on the packages installed when this was run and any steps performed prior to the pre-upgrade check?

Comment 6 Brad Buckingham 2017-11-01 12:35:17 UTC
On my 6.2 instance (prior to updating the rpms to 6.3), I see the following output:

[root@sat-snap-rhel7 ~]# foreman-rake katello:upgrade_check
This script makes no modifications and can be re-run multiple times for the most up to date results.
Checking upgradeability...

Checking for running tasks...
[FAIL] - There are 2 active tasks. 
         Please wait for these to complete or cancel them from the Monitor tab.

[root@sat-snap-rhel7 ~]# sudo su - postgres
Last login: Wed Oct 18 17:45:34 UTC 2017 on pts/1
-bash-4.2$ psql foreman
psql (9.2.23)
Type "help" for help.

foreman=# select id,label from foreman_tasks_tasks where state = 'running';
                  id                  |                    label                    
--------------------------------------+---------------------------------------------
 293dc338-9f82-45ec-b17a-7284a5d9bb51 | Actions::Candlepin::ListenOnCandlepinEvents
 3390e6b9-0324-4af3-8c05-07d39e73ac58 | Actions::Katello::EventQueue::Monitor
(2 rows)


The upgrade_check rake task is checking for:
  ::ForemanTasks::Task.active.where("label != '#{CP_LISTEN_ACTION}'").count

In the console, it looks like the 2 tasks being returned are:
[root@sat-snap-rhel7 ~]# foreman-rake console
irb(main):003:0> ::ForemanTasks::Task.active.where("label != '#{CP_LISTEN_ACTION}'").select(:label)
=> #<ActiveRecord::Relation [#<ForemanTasks::Task id: nil, label: "Actions::Insights::EmailPoller">, #<ForemanTasks::Task id: nil, label: "Actions::Katello::EventQueue::Monitor">]>

Neither of these are 'filtered' out by the script currently.  Since I executed this on 6.2, updates may be needed to both 6.2.z and 6.3.

Comment 7 Brad Buckingham 2017-11-01 13:10:47 UTC
For release note:

If the katello:upgrade_check returns active tasks, the following tasks may be ignored:

  Actions::Candlepin::ListenOnCandlepinEvents
  Actions::Katello::EventQueue::Monitor
  Actions::Insights::EmailPoller

One way to see if these tasks are included, is to perform the following:
  Log in to the Satellite UI
  go to Monitor -> Tasks
  enter 'state = running or state = scheduled' in the search box
  click on Search

Comment 8 Brad Buckingham 2017-11-01 13:29:18 UTC
Note; based on discussion in irc, foreman-maintain may be the supported way to upgrade from 6.2 to 6.3.  If that is the case, then this bugzilla may no longer be necessary.

Comment 15 Renzo Nuccitelli 2018-01-04 17:23:59 UTC
Worked on Satellite 6.3 snap 30 with deprecation warning:

# foreman-rake katello:upgrade_check
This script makes no modifications and can be re-run multiple times for the most up to date results.
Checking upgradeability...

Checking for running tasks...
[PASS] - There are 0 active tasks. 
         You may proceed with the upgrade.

DEPRECATION WARNING: katello:upgrade_check is being replaced with 'foreman-maintain upgrade check' and will be removed in 6.4

Comment 17 Satellite Program 2018-02-21 16:54:17 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


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