Bug 808516 - generation of yum repo fails if channel_checksum is null
Summary: generation of yum repo fails if channel_checksum is null
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Spacewalk
Classification: Community
Component: API
Version: 1.8
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Stephen Herr
QA Contact: Red Hat Satellite QA List
URL:
Whiteboard:
Depends On: 629878 834371
Blocks: space18
TreeView+ depends on / blocked
 
Reported: 2012-03-30 15:10 UTC by Stephen Herr
Modified: 2012-11-01 16:20 UTC (History)
5 users (show)

Fixed In Version:
Clone Of: 629878
Environment:
Last Closed: 2012-11-01 16:20:33 UTC
Embargoed:


Attachments (Terms of Use)

Description Stephen Herr 2012-03-30 15:10:02 UTC
+++ This bug was initially created as a clone of Bug #629878 +++

Description of problem:
I have dump which comes from bug 563501. This dump can be imported in sat530 and channel repodata was regenerated without any problem.

In sat540 I cannot regenerate repodata for channel in dump due to missing checksum.

Version-Release number of selected component (if applicable):
latest sat540.nightly and SW1.2nightly

How reproducible:
always

Steps to Reproduce:
1. use dump from attachment of this bug, or from bug 563501#c12 -- its the same
2. tar xf dump-bz-563501.tar -C /tmp
3. satellite-sync -m /tmp/dump1 -c test-i386-1  

Actual results:

1. there isn't checksum_type in db:

SQL> select checksum_type_id from rhnChannel where label = 'test-i386-1';

CHECKSUM_TYPE_ID
----------------


Expected results:
there is sha1 checksum for this dump. I can regenerate repodata for this channel.


Additional info:

--- Additional comment from psklenar on 2010-09-03 03:46:38 EDT ---

my script for regenerating all repodata in sat:

[root@tyan-gt24-07 ~]# cat a
#!/usr/bin/python

import sys
sys.path.append('/usr/share/rhn/')

import os
os.umask(0002)

import server.repomd.repository as repository
import server.rhnChannel as rhnChannel

import common.rhnConfig as rhnConfig
import server.rhnSQL as rhnSQL

rhnConfig.initCFG()
rhnSQL.initDB()

channels = rhnChannel.list_channels('%') 

for channel in channels:
    print "Channel: %s" % channel['name']
    repo = repository.get_repository(rhnChannel.channel_info(channel['label']))
    repo.get_repomd_file()  

[root@tyan-gt24-07 ~]# python a
Channel: Name test-i386-1
Traceback (most recent call last):
  File "a", line 23, in <module>
    repo.get_repomd_file()  
  File "/usr/share/rhn/server/repomd/repository.py", line 327, in get_repomd_file
    to_generate.append(self.repository.get_primary_view())
  File "/usr/share/rhn/server/repomd/repository.py", line 149, in get_primary_view
    return self.get_cache_view(self.primary_prefix, view.PrimaryView)
  File "/usr/share/rhn/server/repomd/repository.py", line 136, in get_cache_view
    viewobj = view_class(self.channel, ret)
  File "/usr/share/rhn/server/repomd/repository.py", line 191, in __get_channel
    self._channel = channel_mapper.get_channel(self.channel_id)
  File "/usr/share/rhn/server/repomd/mapper.py", line 114, in get_channel
    channel.label = details[0]
TypeError: 'NoneType' object is unsubscriptable

-----
this script works well in sat530.
workaround for sat540 is: go to webUI, look at channel, and save page with sha1 checksum.

--- Additional comment from sherr on 2012-03-30 09:39:37 EDT ---

This is more an issue with Satellite 5.4 maintaining backward-compatibility at the export/import layer than it is a problem with checksum regeneration.

In Satellite 5.3 (and previous) all channels were checksummed with sha1. We apparently didn't bother including that in the export xml because it was always true. 

In Satellite 5.4 we have multiple options for checksum type, including "None" or null (for channels that will be consumed by clients that do not use yum, for example RHEL 4). In Satellite 5.4 exports we include the checksum type, including explicitly stating that the type is none if that is what is selected for this channel:

<rhn-channel-checksum-type><rhn-null/></rhn-channel-checksum-type>

The problem here is that if the channel-dump does not include a checksum type we assume a default value of null, which breaks compatibility with pre-5.4 versions of Satellite. Channels with no checksum type do not get yum repodata generated for them (yum requires a checksum type).

What we should do instead is assume that if the channel-dump has *no* value for rhn-channel-checksum-type that we are coming from a pre-5.4 Satellite and the checksum type should default to sha1. Only if the channel-dump explicitly says it should be null should we set the value to null.

Comment 1 Stephen Herr 2012-03-30 17:49:44 UTC
Committed to Spacewalk master: 0fb9604f7b7c01113e23718977d8f79afedcc112

Comment 3 Jan Pazdziora (Red Hat) 2012-10-30 19:25:07 UTC
Moving ON_QA. Packages that address this bugzilla should now be available in yum repos at http://yum.spacewalkproject.org/nightly/

Comment 4 Jan Pazdziora (Red Hat) 2012-11-01 16:20:33 UTC
Spacewalk 1.8 has been released: https://fedorahosted.org/spacewalk/wiki/ReleaseNotes18


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