Bug 985772 - spacewalk-repo-sync does not exit appropriately in case of failure.
Summary: spacewalk-repo-sync does not exit appropriately in case of failure.
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Server
Version: 560
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ---
Assignee: Tomáš Kašpárek
QA Contact: Red Hat Satellite QA List
URL:
Whiteboard:
Depends On:
Blocks: 462714
TreeView+ depends on / blocked
 
Reported: 2013-07-18 08:26 UTC by Dimitar Yordanov
Modified: 2015-05-29 20:12 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-05-29 20:12:36 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Dimitar Yordanov 2013-07-18 08:26:11 UTC
Description of problem:
spacewalk-repo-sync does not exit appropriately in case of failure.

There are two main issues: 
   --- the exit code is always 0

        if not options.channel_label:
        systemExit(1, "--channel must be specified")

    sync = reposync.RepoSync(channel_label=options.channel_label,
                      repo_type=options.repo_type,
                      url=options.url,
                      fail=options.fail,
                      quiet=options.quiet,
                      filters=options.filters,
                      no_errata=options.no_errata,
                      sync_kickstart=options.sync_kickstart)
    sync.sync()
    releaseLOCK()
    return 0


  --- YumRepo Last Sync and Last Modified  are Updated. 
    
            except Exception, e:
                self.error_msg("ERROR: %s" % e)
            if plugin is not None:
                plugin.clear_ssl_cache()
        if self.regen:
            taskomatic.add_to_repodata_queue_for_channel_package_subscription(
                [self.channel_label], [], "server.app.yumreposync")
            taskomatic.add_to_erratacache_queue(self.channel_label)
        self.update_date()
        rhnSQL.commit()
    
Version-Release number of selected component (if applicable):
spacewalk-backend-tools-1.9.46-23

How reproducible:
100%

Steps to Reproduce:
1. Create a Custom Software Channel - test_test.
2. Create Repository with fake url.
3. Add the Repository to Channel.
4. Create python script like: 

#!/usr/bin/python
import sys, xmlrpclib, re, getopt
RHN_SERVER='https://test.redhat.com/rpc/api'
RHN_USER='test'
RHN_PASS='test'
client = xmlrpclib.Server(RHN_SERVER, verbose=0)
key = client.auth.login(RHN_USER, RHN_PASS)
client.channel.software.getDetails(key,'test_test')
res=client.channel.software.getDetails(key,'test_test')
print "YumRepo Last Sync %s" % res['yumrepo_last_sync'] 
print "Last Modified %s" % res['last_modified']
5. Execute the script.
4. On CLI execute:
    spacewalk-repo-sync -c test_test
5. Execute the script.

Actual results:

#./test.py
YumRepo Last Sync 20130718T04:04:17
Last Modified 20130718T04:04:17

# spacewalk-repo-sync -c test_test
Repo URL: file:///root/sp-repo-sync-local-config-file/test_repo_11
ERROR: Cannot retrieve repository metadata (repomd.xml) for repository: test_test. Please verify its path and try again
Sync completed.
Total time: 0:00:00

# ./test.py
YumRepo Last Sync 20130718T04:15:05
Last Modified 20130718T04:15:05

YumRepo Last Sync and Last Modified  are Updated. 


Expected results:
 YumRepo Last Sync and Last Modified should not be Updated.

Additional info:

Comment 1 Jan Hutař 2013-08-16 09:39:18 UTC
Not a regression.


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