Bug 758221 - Spacewalk-repo-sync fails with a Traceback.
Summary: Spacewalk-repo-sync fails with a Traceback.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Server
Version: 541
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ---
Assignee: Jan Pazdziora
QA Contact: Red Hat Satellite QA List
URL:
Whiteboard:
Depends On:
Blocks: sat541-triage
TreeView+ depends on / blocked
 
Reported: 2011-11-29 15:06 UTC by Dimitar Yordanov
Modified: 2012-04-10 07:28 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-04-10 07:28:11 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Dimitar Yordanov 2011-11-29 15:06:11 UTC
Description of problem:
Spacewalk-repo-sync   fails with a Traceback.

Version-Release number of selected component (if applicable):
spacewalk-backend-1.2.13-58.el6sat.noarch

How reproducible:
100%

Steps to Reproduce:
1.Create Yum  repository on the machine where Satellite runs.
(The first step should include generating 1300 RPM packages and repodata generation  with "createrepo" tool or check /tests/RHN-Satellite/Other/Sanity/create_yum_repo/)

2. Remove one RPM package from the repository
(rm -f some_pkg.rpm)

3. Create Custom channel on Satellite
(Channels -> Manage Software Channels -> Create new channel )

4. Add Yum Repository to Satellite
( Channels -> Manage Software Channels -> Manage Repositories -> Create New Repositories - Create ${TEST_REPO})

NB: fill "Repository URL" like"
  http://${SATELLITE_HOST}/${REPO_NAME}
  do not use "file://" !!!
 
5. Associate the YUM repository to the Channel.
Channels -> Manage Software Channels -> your_custom_channel -> Repositories -> Select  ${TEST_REPO} -> Press Update Repositories

5. Channels -> Manage Software Channels -> your_custom_channel -> Repositories -> Sync Now.
6. The Sync fails (see attached  /var/log/rhn/rhn_taskomatic_daemon.log)
  
Actual results:
spacewalk-repo-sync tool failes and logs a message in /var/log/rhn/rhn_taskomatic_daemon.log (see bellow) that one package is missing (in this case test-regular-Test_RPM_0-0.1-1.x86_64.rpm)  and generates Traceback related to the package that was synced just before the one that is missing (in this case test-regular-Test_RPM_600-0.1-1.x86_64.rpm)


/var/log/rhn/reposync/${chann_name}_${date}.log

1184/1300 : test-regular-Test_RPM_1079-0.1-1-0.x86_64
1185/1300 : test-regular-Test_RPM_600-0.1-1-0.x86_64
1186/1300 : test-regular-Test_RPM_0-0.1-1-0.x86_64
failure: test-regular-Test_RPM_0-0.1-1.x86_64.rpm from test_channel: [Errno 256] No more mirrors to try.

/var/log/rhn/rhn_taskomatic_daemon.log

INFO   | jvm 1    | 2011/11/29 03:44:05 | 1185/1300 : test-regular-Test_RPM_600-0.1-1-0.x86_64
INFO   | jvm 1    | 2011/11/29 03:44:05 | 1186/1300 : test-regular-Test_RPM_0-0.1-1-0.x86_64
INFO   | jvm 1    | 2011/11/29 03:44:05 | 
INFO   | jvm 1    | 2011/11/29 03:44:05 | 2011-11-29 03:44:05,028 [DefaultQuartzScheduler_Worker-3] ERROR com.redhat.rhn.taskomatic.task.RepoSyncTask - failure: test-regular-Test_RPM_0-0.1-1.x86_64.rpm from test_channel: [Errno 256] No more mirrors to try.
INFO   | jvm 1    | 2011/11/29 03:44:05 | Traceback (most recent call last):
INFO   | jvm 1    | 2011/11/29 03:44:05 |   File "/usr/bin/spacewalk-repo-sync", line 72, in <module>
INFO   | jvm 1    | 2011/11/29 03:44:05 |     sys.exit(abs(main() or 0))
INFO   | jvm 1    | 2011/11/29 03:44:05 |   File "/usr/bin/spacewalk-repo-sync", line 66, in main
INFO   | jvm 1    | 2011/11/29 03:44:05 |     sync.main()
INFO   | jvm 1    | 2011/11/29 03:44:05 |   File "/usr/share/rhn/satellite_tools/reposync.py", line 103, in main
INFO   | jvm 1    | 2011/11/29 03:44:05 |     self.import_packages(plugin, url)
INFO   | jvm 1    | 2011/11/29 03:44:05 |   File "/usr/share/rhn/satellite_tools/reposync.py", line 192, in import_packages
INFO   | jvm 1    | 2011/11/29 03:44:05 |     finally_remove(localpath)
INFO   | jvm 1    | 2011/11/29 03:44:05 |   File "/usr/share/rhn/satellite_tools/reposync.py", line 172, in finally_remove
INFO   | jvm 1    | 2011/11/29 03:44:05 |     os.remove(path)
INFO   | jvm 1    | 2011/11/29 03:44:05 | OSError: [Errno 2] No such file or directory: '/var/cache/rhn/reposync/test_channel/packages/test-regular-Test_RPM_600-0.1-1.x86_64.rpm'
INFO   | jvm 1    | 2011/11/29 03:44:05 | 
INFO   | jvm 1    | 2011/11/29 03:45:00 | 2011-11-29 03:45:00,375 [DefaultQuartzScheduler_Worker-1] INFO  com.redhat.rhn.taskomatic.task.SessionCleanup - session_cleanup: starting delete of stale sessions

Expected results:
spacewalk-repo-sync has the following behavior:
   1. Log a message that one RPM package is missing.
   2. Sync the rest of the RPM packages and claim SUCCESS. 


Additional info:

Comment 1 Jan Pazdziora 2011-11-29 19:06:44 UTC
(In reply to comment #0)
> Expected results:
> spacewalk-repo-sync has the following behavior:
>    1. Log a message that one RPM package is missing.
>    2. Sync the rest of the RPM packages and claim SUCCESS. 

I don't agree with this expected behaviour. If one file is missing unavailable, dependencies might be broken among the rest of the packages. Reporting success would be ill-advised. I agree the we should not traceback, but the spacewlk-repo-sync definitely should not claim success.

Comment 2 Dimitar Yordanov 2011-11-29 19:46:58 UTC
(In reply to comment #1)
> (In reply to comment #0)
> > Expected results:
> > spacewalk-repo-sync has the following behavior:
> >    1. Log a message that one RPM package is missing.
> >    2. Sync the rest of the RPM packages and claim SUCCESS. 
> 
> I don't agree with this expected behaviour. If one file is missing unavailable,
> dependencies might be broken among the rest of the packages. Reporting success
> would be ill-advised. I agree the we should not traceback, but the
> spacewlk-repo-sync definitely should not claim success.

Yes, claim SUCCESS was not very bright idea. 
I would like to suggest  the following behavior:
  1. Sync all available RPM packages.
  2. Log all packages that are missing
  3. Exit code equals to the number of RPM packages that are missing.

Dimi

Comment 3 Jan Pazdziora 2011-12-05 08:55:39 UTC
(In reply to comment #2)
>   3. Exit code equals to the number of RPM packages that are missing.

Can't do. Exit code is eight bits.

Comment 4 Dimitar Yordanov 2011-12-05 11:19:47 UTC
(In reply to comment #3)
> (In reply to comment #2)
> >   3. Exit code equals to the number of RPM packages that are missing.
> 
> Can't do. Exit code is eight bits.

Possible decision is exit code 255 to be returned if 255 or more packages are missing.

Comment 5 Michael Mráka 2012-04-10 07:28:11 UTC
This bug has been fixed as a side effect of bug 769176 which went live as a part of http://rhn.redhat.com/errata/RHBA-2012-0457.html.


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