Bug 575981 - Satellite 5.3: Scheduled tab only shows actions with non-null scheduler (e.g., auto-errata update actions scheduled by taskomatic are missing in the listings)
Summary: Satellite 5.3: Scheduled tab only shows actions with non-null scheduler (e.g....
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Server
Version: 530
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Justin Sherrill
QA Contact: Tomas Lestach
URL:
Whiteboard:
Depends On:
Blocks: sat540-blockers
TreeView+ depends on / blocked
 
Reported: 2010-03-22 21:41 UTC by Xixi
Modified: 2018-10-27 13:58 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-10-28 14:56:20 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Xixi 2010-03-22 21:41:50 UTC
Description of problem:
Auto Apply errata events - pending/completed/failed - which are seen individually under Systems Details -> Events page, are missing from all of the the Schedule tab pages (pending/completed/failed/archived).

For example, in customer's case, the Overview page says "1 - 5 of 74,769 recently scheduled actions displayed" (which are all errata updates automatically scheduled after a satellite-sync). However clicking on "View All Scheduled Actions" link, the schedule/PendingActions.do page returns "No actions pending."
Same for Failed, Completed, and Archived actions

Version-Release number of selected component (if applicable):
Red Hat Network (RHN) Satellite 5.3.0

System architecture(s):
RHEL 5 U3 i386 platform

How reproducible:
Always.

Steps to Reproduce:
1. Have a satellite with at least a few systems subscribed to at least one slightly out-of-date channel.
2. Go to System Details and enable Auto Apply Errata.
3. Run satellite-sync to pull down new errata for the channel.
4. Wait for taskomatic to schedule errata update actions.
5. Check Scheduled tab (under each of the sub pages - pending/completed/failed/archived), compare actions listed to the System Details Events page for the system(s).

Actual results:
Auto errata update scheduled by taskomatic are listed under System Details events section, but not under Scheduled tab.

Expected results:
All actions - permission permitting - should be listed under Scheduled tab for the logged-in user, regardless of scheduler.

Additional info:
Already discussed with Engineering.

Comment 2 Xixi 2010-03-22 21:51:58 UTC
The difference is due to the Schedule tab only looks at actions with a non-null scheduler - the queries completed_action_list, failed_action_list, and archived_action_list all have the condition "WC.id = UAO.scheduler", which means it won't pick up actions with scheduler=NULL such as auto-errata updates scheduled by taskomatic. Not sure about pending_actions_in_set yet but we also need to make sure it includes all actions consistent with the System Details -> pending events page. 

E.g. on internal reproducer,

SQL> select count(*) from rhnUserActionOverview where org_id = 1 and user_id =1 and action_status_id = 3;

 COUNT(*)
----------
      445

SQL> select count(*) from rhnUserActionOverview where org_id = 1 and user_id =1 and action_status_id = 3 and scheduler = 1;

 COUNT(*)
----------
       13

Per confirmation with jsherrill, this is indeed a bug and we should remove the scheduler condition "WC.id = UAO.scheduler", add a check if needed for user permissions, and otherwise make sure Schedule tab shows all actions that should be visible to the logged in user.


Notes/relevant code snippets:

/var/www/html/network/systems/details/history/history.pxt
...
<rhn-listview class="Sniglets::ListView::ActionList" mode="system_events_history">
...

/usr/lib/perl5/vendor_perl/5.8.8/Sniglets/ListView/ActionList.pm
...
 Sniglets::ListView::List->add_mode(-mode => "system_events_history",
                          -datasource => RHN::DataSource::Action->new,
                          -provider => \&system_history_provider);
...

/usr/lib/perl5/vendor_perl/5.8.8/RHN/DataSource/Action.pm
...
sub data_file { 'Action_queries.xml' }
...

/usr/lib/perl5/vendor_perl/5.8.8/RHN/DB/DataSource/xml/Action_queries.xml
...
<mode name="system_events_history">
 <query params="sid">
SELECT EVENT_ID,
      TO_CHAR(CREATED, 'YYYY-MM-DD HH24:MI:SS') CREATED,
      TO_CHAR(PICKED_UP, 'YYYY-MM-DD HH24:MI:SS') PICKED_UP,
      TO_CHAR(COMPLETED, 'YYYY-MM-DD HH24:MI:SS') COMPLETED,
      SUMMARY,
      HISTORY_TYPE,
      HISTORY_TYPE_NAME,
      HISTORY_STATUS
 FROM (SELECT SH.id EVENT_ID,
              SH.summary SUMMARY,
              TO_DATE(NULL) AS created,
              TO_DATE(NULL) AS picked_up,
              SH.created as completed,  -- view this as the "completed" date for sorting reasons
              NULL AS history_status,
              NULL AS history_type,
              NULL AS history_type_name
         FROM rhnServerHistory SH
        WHERE SH.server_id = :sid
        UNION
       SELECT SA.action_id EVENT_ID,
              AType.name || ' scheduled by ' || NVL(U.login, '(none)') AS SUMMARY,
              SA.created,
              SA.pickup_time AS picked_up,
              SA.completion_time AS completed,
              AStat.name AS history_status,
              AType.label AS history_type,
              AType.name AS history_type_name
         FROM rhnActionType AType,
              rhnActionStatus AStat,
              rhnUser U,
              rhnAction A,
              rhnServerAction SA
        WHERE SA.server_id = :sid
          AND SA.action_id = A.id
          AND ATYPE.id = A.action_type
          AND AStat.id = SA.status
          AND U.id(+) = A.scheduler
          AND AStat.id IN (1, 2, 3)
      ) X
ORDER BY COMPLETED DESC, PICKED_UP DESC, CREATED DESC, EVENT_ID DESC
 </query>
</mode>
...

spacewalk-java-0.5.44/code/src/com/redhat/rhn/common/db/datasource/xml/Action_queries.xml 
...
<mode name="pending_actions_in_set"
     class="com.redhat.rhn.frontend.dto.ScheduledAction">
 <query params="user_id, org_id, set_label">
SELECT  DISTINCT UAO.id AS ID,
       UAO.earliest_action AS EARLIEST,
       A.prerequisite AS PREREQUISITE,
       UAO.type_name,
       (DECODE(UAO.action_name, NULL, UAO.type_name, UAO.action_name)) AS ACTION_NAME,
       UAO.scheduler
 FROM  rhnUserActionOverview UAO, rhnAction A, rhnSet ST
WHERE  UAO.org_id = :org_id
  AND  UAO.user_id = :user_id
  AND  UAO.action_status_id IN (0,1)
  AND  UAO.archived = 0
  AND  UAO.id = A.id
  AND  ST.user_id = :user_id
  AND  ST.label = :set_label
  AND  ST.element = A.id
ORDER BY EARLIEST DESC
 </query>
...
<mode name="completed_action_list"
     class="com.redhat.rhn.frontend.dto.ScheduledAction">
 <query params="user_id, org_id">
SELECT  DISTINCT UAO.id AS ID,
       UAO.earliest_action AS EARLIEST,
       UAO.type_name,
       (DECODE(UAO.action_name, NULL, UAO.type_name, UAO.action_name)) AS ACTION_NAME,
       UAO.scheduler,
       WC.login AS SCHEDULER_NAME
 FROM  rhnUserActionOverview UAO, web_contact WC
WHERE  UAO.org_id = :org_id
  AND  UAO.user_id = :user_id
  AND  UAO.action_status_id = 2
  AND  UAO.archived = 0
  AND  WC.id = UAO.scheduler
ORDER BY EARLIEST DESC
 </query>
...
<mode name="failed_action_list"
   class="com.redhat.rhn.frontend.dto.ScheduledAction">
 <query params="user_id, org_id">
SELECT  DISTINCT UAO.id AS ID,
       UAO.earliest_action AS EARLIEST,
       UAO.type_name,
       (DECODE(UAO.action_name, NULL, UAO.type_name, UAO.action_name)) AS ACTION_NAME,
       UAO.scheduler,
       WC.login AS SCHEDULER_NAME
 FROM  rhnUserActionOverview UAO, web_contact WC
WHERE  UAO.org_id = :org_id
  AND  UAO.user_id = :user_id
  AND  UAO.action_status_id  = 3
  AND  UAO.archived = 0
  AND  WC.id = UAO.scheduler
ORDER BY EARLIEST DESC
 </query>
...
<mode name="archived_action_list"
      class="com.redhat.rhn.frontend.dto.ScheduledAction">
  <query params="user_id, org_id">
SELECT  DISTINCT UAO.id AS ID,
        UAO.earliest_action AS EARLIEST,
        UAO.type_name,
        (DECODE(UAO.action_name, NULL, UAO.type_name, UAO.action_name)) AS ACTION_NAME,
        WC.login AS SCHEDULER_NAME
  FROM  rhnUserActionOverview UAO, web_contact WC
 WHERE  UAO.org_id = :org_id
   AND  UAO.user_id = :user_id
   AND  UAO.archived = 1
   AND  WC.id = UAO.scheduler
ORDER BY EARLIEST DESC
  </query>
...

Comment 3 Justin Sherrill 2010-08-04 15:56:58 UTC
Changed the joins to be left joins:

b6108e3c249f2f2031e8c0d2fa6100bcf4767201

Comment 4 Tomas Lestach 2010-10-08 14:34:56 UTC
1. I registered a client to a custom channel and enabled auto errata update for it.
2. I synced a channel update together with an erratum from a dump (errata package was applicable to the client).
3. As soon as the taskomatic ErrataQueue was scheduled, an errata update event appeared in both - system pending events and in schedule pending actions of the whole satellite as requested.

VERIFIED with spacewalk-java-1.2.39-27.el5sat on Satellite-5.4.0-RHEL5-re20101001.1.

Comment 6 Garik Khachikyan 2010-10-25 12:56:20 UTC
# VERIFIED against stage-signed packages/iso: Satellite-5.4.0-RHEL5-re20101025.0

the scenario described in comment#4 is reproduced (btw: on different Org that the default one of admin user is)

Comment 7 Clifford Perry 2010-10-28 14:51:28 UTC
The 5.4.0 RHN Satellite and RHN Proxy release has occurred. This issue has been resolved with this release. 


RHEA-2010:0801 - RHN Satellite Server 5.4.0 Upgrade
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10332

RHEA-2010:0803 - RHN Tools enhancement update
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10333

RHEA-2010:0802 - RHN Proxy Server 5.4.0 bug fix update
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10334

RHEA-2010:0800 - RHN Satellite Server 5.4.0
https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10335

Docs are available:

http://docs.redhat.com/docs/en-US/Red_Hat_Network_Satellite/index.html 

Regards,
Clifford


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