Bug 985772 - spacewalk-repo-sync does not exit appropriately in case of failure.
spacewalk-repo-sync does not exit appropriately in case of failure.
Status: CLOSED DEFERRED
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Server (Show other bugs)
560
Unspecified Unspecified
low Severity low
: ---
: ---
Assigned To: Tomáš Kašpárek
Red Hat Satellite QA List
:
Depends On:
Blocks: 462714
  Show dependency treegraph
 
Reported: 2013-07-18 04:26 EDT by Dimitar Yordanov
Modified: 2015-05-29 16:12 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-05-29 16:12:36 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Dimitar Yordanov 2013-07-18 04:26:11 EDT
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 05:39:18 EDT
Not a regression.

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