Bug 576222 - CobblerSyncTask overwrites rhnKickstartableTree.last_modified values
Summary: CobblerSyncTask overwrites rhnKickstartableTree.last_modified values
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Server
Version: 530
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Justin Sherrill
QA Contact: Michael Mráka
URL:
Whiteboard:
Depends On:
Blocks: sat540-blockers
TreeView+ depends on / blocked
 
Reported: 2010-03-23 15:01 UTC by Milan Zázrivec
Modified: 2010-10-28 14:45 UTC (History)
4 users (show)

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


Attachments (Terms of Use)

Description Milan Zázrivec 2010-03-23 15:01:07 UTC
Description of problem:
rhnKickstartableTree table contains a column last_modified, which gets
populated by satellite-sync with data from hosted or channel dump. These
values play an important role when creating a time constrained
(aka incremental) channel dump: it determines which kickstartable trees
will fall into the specified date range and which won't.

Satellite 5.3.0 schema defines following trigger:
create or replace trigger
rhn_kstree_mod_trig
before insert or update on rhnKickstartableTree
for each row
begin
     if (:new.last_modified = :old.last_modified) or
        (:new.last_modified is null ) then
             :new.last_modified := sysdate;
     end if;

        :new.modified := sysdate;
end rhn_kstree_mod_trig;
/

When CobblerSyncTask is run (by taskomatic), it modifies existing rows
in rhnKickstartableTree table and causes the last_modified values to be
overwritten by sysdate (current date & time).

Version-Release number of selected component (if applicable):
satellite-schema-5.3.0.23-1.el5sat
spacewalk-schema-0.5.20-23.el5sat
spacewalk-java-0.5.44-69.el5sat

How reproducible:
Always

Steps to Reproduce:
1. Install Satellite 5.3.0, synchronize rhel-5 channel from hosted
2. sqlplus `spacewalk-cfg-get default_db`
3. SQL> select label, to_char(last_modified,'YYYY-MM-DD HH24-MI-SS')
        from rhnKickstartableTree;
4. Wait for CobblerSyncTask to wake up (you'll see log entries in
/var/log/cobbler/cobblerd.log like this:
2010-03-22 12:53:01,302 - api - login attempt; user(taskomatic_user)
2010-03-22 12:53:01,495 - api - authenticate; ['taskomatic_user', True]
2010-03-22 12:53:01,497 - api - login succeeded; user(taskomatic_user)
2010-03-22 12:53:01,668 - api - get_distros; user(?)
2010-03-22 12:53:01,971 - api - get_profiles; user(?)
2010-03-22 12:53:01,983 - api - get_systems; user(?)
5. After you see the task has been executed, connect to your database with
sqlplus
6. SQL> select label, to_char(last_modified,'YYYY-MM-DD HH24-MI-SS')
        from rhnKickstartableTree;
  
Actual results:
The last_modified values will get overwritten with sysdate.

Expected results:
last_modified values will be preserved.

Additional info:
The problem described above defeats the fix from
https://bugzilla.redhat.com/show_bug.cgi?id=246480

Comment 1 Justin Sherrill 2010-08-04 18:24:16 UTC
updated trigger to ignore changes to the cobbler_id and cobbler_xen_id columns for last_modified

d4cb96d46b4b97242225eac0daa6992df39c78fa

Comment 2 Michael Mráka 2010-10-12 09:25:45 UTC
Verified.

#  rpm -q satellite-schema spacewalk-schema spacewalk-java
satellite-schema-5.4.0.8-1.el5sat.noarch
spacewalk-schema-1.2.21-4.el5sat.noarch
spacewalk-java-1.2.39-27.el5sat.noarch
# satellite-sync -c rhel-i386-server-5
# sqlplus `spacewalk-cfg-get default_db`
SQL> select label, to_char(last_modified,'YYYY-MM-DD HH24-MI-SS')
        from rhnKickstartableTree;
LABEL                           TO_CHAR(LAST_MODIFI
------------------------------- -------------------
ks-rhel-i386-server-5           2007-03-14 00-00-00
ks-rhel-i386-server-5-u1        2007-11-21 00-00-00
ks-rhel-i386-server-5-u2        2008-06-04 00-00-00
ks-rhel-i386-server-5-u3        2009-01-29 00-00-00
ks-rhel-i386-server-5-u4        2009-09-23 00-00-00
ks-rhel-i386-server-5-u5        2010-05-04 00-00-00

Comment 3 Tomas Lestach 2010-10-26 14:07:05 UTC
Cobbler sync task is scheduled every minute. I see last_modified dates older than 1 day (and taskomatic is running).

STAGE VALIDATED on Satellite-5.4.0-RHEL5-re20101015.0

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