Bug 1397427

Summary: cdn-sync should log explicit error when missing RPM encountered during a sync
Product: Red Hat Satellite 5 Reporter: Radovan Drazny <rdrazny>
Component: Satellite SynchronizationAssignee: Gennadii Altukhov <galtukho>
Status: CLOSED CURRENTRELEASE QA Contact: Jan Hutař <jhutar>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 580CC: galtukho, jdobes, jhutar, lhellebr, mkorbel, tlestach
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: spacewalk-backend-2.5.3-35-sat Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1403898 (view as bug list) Environment:
Last Closed: 2017-06-21 12:14:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1340444, 1403898    

Description Radovan Drazny 2016-11-22 13:55:53 UTC
Description of problem:
When syncing channel from CDN using the cdn-sync command, there is possibility of missing RPM in the CDN. Cdn-sync should log explicit error in its log in such occasion, and exit with non-zero exit code. Currently it doesn't report any specific error in the log, and exits with 0 (success) exit code.

Version-Release number of selected component (if applicable):
spacewalk-backend-cdn-2.5.3-32

How reproducible:
Issue is present only when there is missing RPM file in the CDN (happens sometimes on the code-stage). As of today, there is missing libkadm5-1.14.1-26.el7-0.i686 in the rhel-x86_64-server-7 channel in the code-stage.

Steps to Reproduce:
1. cdn-sync -c rhel-x86_64-server-7

Actual results:

# cdn-sync -c rhel-x86_64-server-7
08:14:13 ======================================
08:14:13 | Channel: rhel-x86_64-server-7
08:14:13 ======================================
08:14:13 Sync of channel started.
08:14:13 Repo URL: https://cdn.stage.redhat.com/content/dist/rhel/server/7/7Server/x86_64/os
<...>
08:33:20 6307/13875 : libkadm5-1.14.1-26.el7-0.i686
08:33:21 failure: Packages/libkadm5-1.14.1-26.el7.i686.rpm from content_dist_rhel_server_7_7Server_x86_64_os: [Errno 256] No more mirrors to try.
08:33:21 ERROR: failure: Packages/libkadm5-1.14.1-26.el7.i686.rpm from content_dist_rhel_server_7_7Server_x86_64_os: [Errno 256] No more mirrors to try.
08:33:21 Repo URL: https://cdn.stage.redhat.com/content/dist/rhel/server/7/7.1/x86_64/kickstart
08:33:34 Packages in repo:              4371
<...>
08:35:59 Linking packages to channel.
08:36:23 ERROR: Could not find object [<spacewalk.server.importlib.importLib.IncompletePackage instance; attributes={'package_size': None, 'package_arch_id': 104, 'name': 'libkadm5', 'checksum_list': None, 'md5sum': None, 'org_id': None, 'epoch': '0', 'checksums': {'sha1': '553b168dc506d33f684f3a0c36f6054a3fa253b9'}, 'channels': {101: 'rhel-x86_64-server-7'}, 'nevra_id': 8689, 'package_id': None, 'last_modified': None, 'name_id': 3597, 'version': '1.14.1', 'checksum': '553b168dc506d33f684f3a0c36f6054a3fa253b9', 'release': '26.el7', 'checksum_type': 'sha1', 'arch': 'i686', 'evr_id': 5310, 'checksum_id': 773956}] in table rhnPackage
08:36:23 Sync of channel completed in 0:09:53.
08:36:23 Total time: 0:09:53

[root@hp-dl360g6-01 ~]# echo $?
0


[root@hp-dl360g6-01 ~]# tail /var/log/rhn/cdnsync/rhel-x86_64-server-7.log 
2016/11/22 08:35:59 -04:00 4298/4305 : zip-3.0-10.el7.x86_64
2016/11/22 08:35:59 -04:00 4299/4305 : zlib-1.2.7-13.el7.i686
2016/11/22 08:35:59 -04:00 4300/4305 : zlib-1.2.7-13.el7.x86_64
2016/11/22 08:35:59 -04:00 4301/4305 : zlib-devel-1.2.7-13.el7.x86_64
2016/11/22 08:35:59 -04:00 4302/4305 : zlib-devel-1.2.7-13.el7.i686
2016/11/22 08:35:59 -04:00 4303/4305 : zsh-5.0.2-7.el7.x86_64
2016/11/22 08:35:59 -04:00 4304/4305 : zziplib-0.13.62-5.el7.x86_64
2016/11/22 08:35:59 -04:00 4305/4305 : zziplib-0.13.62-5.el7.i686
2016/11/22 08:35:59 -04:00 Linking packages to channel.
2016/11/22 08:36:23 -04:00 Sync of channel completed in 0:09:53.

Expected results:
Cdn-sync should report the error more explicitly (and maybe continue the sync, if possible, not sure about that). Currently there is no indication of error in the log. Exit code should be something different than 0.

Additional info:

Comment 1 Gennadii Altukhov 2016-12-12 11:44:52 UTC
patch is available in upstream. spacewalk.git:
71518d540c4b63500762a6f1bf27aebdb3b8bded

Comment 3 Gennadii Altukhov 2016-12-13 16:23:55 UTC
*** Bug 1403389 has been marked as a duplicate of this bug. ***

Comment 4 Jan Hutař 2016-12-15 09:34:36 UTC
*** Bug 1404927 has been marked as a duplicate of this bug. ***

Comment 5 Jan Hutař 2016-12-15 09:35:38 UTC
Note that in bug 1404927 I have been syncing from CDNProd and resync few hours later fixed the issue.

Comment 6 Jan Dobes 2016-12-20 10:28:45 UTC
*** Bug 1399645 has been marked as a duplicate of this bug. ***