Bug 528953 - Schema upgrade needs to properly update rhnKickstartPackage table
Summary: Schema upgrade needs to properly update rhnKickstartPackage table
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Upgrades
Version: 530
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Michael Mráka
QA Contact: Milan Zázrivec
URL:
Whiteboard:
Depends On:
Blocks: sat540-upgrades
TreeView+ depends on / blocked
 
Reported: 2009-10-14 13:54 UTC by Milan Zázrivec
Modified: 2010-10-28 14:56 UTC (History)
3 users (show)

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


Attachments (Terms of Use)

Description Milan Zázrivec 2009-10-14 13:54:54 UTC
Description of problem:
In Satellite 5.3.0 development course, rhnKickstartPackage table received
new column named POSITION, which determines order in which user entered
package names into %packages section for a particular kickstart profile
(this is also the order in which those entries will be presented in the
webui & kickstart file).

In 5.3.0 schema upgrade course, this POSITION column was mistakenyl filled
with zero columns, which effectively caused problems described in
bug #527724.

To fix the problem, schema upgrade for next Satellite release needs to
correctly assign position values to every package in every kickstart
profile (for cases, where this wasn't solved yet).

Version-Release number of selected component (if applicable):
satellite-schema-5.3.0.23-1
spacewalk-schema-0.5.20-23
Satellite 5.3.0

How reproducible:
Deterministic

Steps to Reproduce:
1. Install 5.2.0 or older satellite
2. Create couple of kickstart profiles, several of them need to have multiple
entries in %packages section
3. Upgrade to latest Satellite
  
Actual results:
Whole POSITION column of rhnKickstartPackage table is set to zero, which
causes problems described in bug #527724

Expected results:
POSITION values are numbered correctly.

Additional info:
Following PL/SQL code fixes the problem:

declare
  i number;
begin
  for rec in (
    select kickstart_id kid
    from rhnKickstartPackage
    where position = 0
    group by kickstart_id
    having count(*) > 1
  ) loop
    i := 0;
    for erec in (
      select rhnKickstartPackage.rowid rid
      from rhnKickstartPackage, rhnPackageName
      where rhnKickstartPackage.package_name_id = rhnPackageName.id
        and rhnKickstartPackage.kickstart_id = rec.kid
      order by rhnKickstartPackage.position, rhnPackageName.name 
    ) loop
      update rhnKickstartPackage
      set position = i
      where rhnKickstartPackage.rowid = erec.rid;
      i := i + 1;
    end loop;
  end loop;
end;
/

commit;

Comment 1 Milan Zázrivec 2010-08-26 12:10:58 UTC
Problem fixed by Michael Mraka in spacewalk-schema,
spacewalk.git: 35e5f0f431788d7617dec023aeb19069175e0cf5

Comment 3 Milan Zázrivec 2010-10-07 11:25:02 UTC
Verified with Satellite-5.4.0-RHEL5-re20101001.1 / spacewalk-schema-1.2.21-3

Comment 5 Milan Zázrivec 2010-10-21 14:24:24 UTC
Results you see and are describing are expected.

The procedure you used was correct -- 5.2.0 -> 5.4.0 upgrade. The position
column was added after 5.2.0 , the data in the column was not set
correctly and this bug report was just about that -- fixing the data.

Comment 6 Jan Hutař 2010-10-22 08:54:20 UTC
I have updated Satellite 5.2.0 -> 5.4.0 and KS profiles software section did not kept their ordering:

== Kickstart: jhutar1-Base ==
%packages 

@ Base

== Kickstart: jhutar2-Base-a2ps-zsh ==
%packages 

@ Base
a2ps
zsh

== Kickstart: jhutar3-Base-zsh-a2ps ==
%packages 

@ Base
a2ps
zsh

== Kickstart: jhutar4-Base-acl-aide-MINUSacpid-adaptx == (see comment #4 for original order)
%packages 

-acpid
@ Base
acl
adaptx
aide


And in DB there is:

SQL>  Name                                         Null?    Type
 ----------------------------------------- -------- ----------------------------
 KICKSTART_ID                              NOT NULL NUMBER
 PACKAGE_NAME_ID                           NOT NULL NUMBER
 CREATED                                   NOT NULL DATE
 MODIFIED                                  NOT NULL DATE
 POSITION                                  NOT NULL NUMBER

# echo "SELECT * FROM rhnKickstartPackage WHERE KICKSTART_ID = 4 ORDER BY POSITION;" | sqlplus rhnsat/rhnsat@rhnsat

KICKSTART_ID PACKAGE_NAME_ID CREATED   MODIFIED    POSITION
------------ --------------- --------- --------- ----------
           4            2695 21-OCT-10 22-OCT-10          0
           4            2462 21-OCT-10 22-OCT-10          1
           4             805 21-OCT-10 22-OCT-10          2
           4            1477 21-OCT-10 22-OCT-10          3
           4             263 21-OCT-10 22-OCT-10          4

# echo "SELECT * FROM rhnPackageName WHERE ID = 2695 OR ID = 2462 OR ID = 805 OR ID = 1477 OR ID = 263;" | sqlplus rhnsat/rhnsat@rhnsat
        ID NAME
---------- ----------------------------------------------------------------
      2695 -acpid
      2462 @ Base
       805 acl
      1477 adaptx
       263 aide


Please is this PASS (POSITION column seems sane) or FAIL (sorting was not kept)?

Comment 7 Milan Zázrivec 2010-10-22 11:39:12 UTC
Results in comment #6 mean PASS.

Comment 8 Jan Hutař 2010-10-22 12:17:23 UTC
So according to comment #7 this was re-verified => RELEASE_PENDING

Comment 9 Clifford Perry 2010-10-28 14:51:40 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.