Bug 1162160 - when you give incorrect OrgID to spacewalk-export, it happily continues and exits with 0
Summary: when you give incorrect OrgID to spacewalk-export, it happily continues and e...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Other
Version: 570
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ---
Assignee: Grant Gainey
QA Contact: Lukáš Hellebrandt
URL:
Whiteboard:
Depends On:
Blocks: sat570-postga
TreeView+ depends on / blocked
 
Reported: 2014-11-10 12:08 UTC by Jan Hutař
Modified: 2015-04-23 13:20 UTC (History)
5 users (show)

Fixed In Version: spacewalk-utils-2.3.2-15
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-04-23 13:20:07 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:0281 0 normal SHIPPED_LIVE Satellite 5.7 bug fix update 2015-03-03 13:59:01 UTC

Description Jan Hutař 2014-11-10 12:08:57 UTC
Description of problem:
When you give incorrect OrgID to spacewalk-export, it happily continues.


Version-Release number of selected component (if applicable):
spacewalk-utils-2.3.2-8.el6sat.noarch


How reproducible:
always


Steps to Reproduce:
1. # spacewalk-export --org=11111111111111111111111111111


Actual results:
# rpm -qf `type -p spacewalk-export`
spacewalk-utils-2.3.2-8.el6sat.noarch
# spacewalk-export --org=11111111111111111111111111111
INFO: Processing users...
INFO: Processing system-groups...
INFO: Processing config-files...
INFO: Processing repositories...
INFO: Processing channels...
Traceback (most recent call last):
  File "/usr/bin/spacewalk-export-channels", line 299, in <module>
    export_packages(options)
  File "/usr/bin/spacewalk-export-channels", line 97, in export_packages
    for org in orgs:
TypeError: 'NoneType' object is not iterable
INFO: Processing activation-keys...
INFO: Processing kickstart-scripts...
INFO: Processing system-profiles...
INFO: Export-file created at /root/spacewalk-export-dir/spacewalk_export.tar.gz
# echo $?
0


Expected results:
There is a traceback in the output, but that is all.
Tool should fail and exit with non-0 return code.

Comment 1 RHEL Program Management 2014-11-10 12:33:16 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 3 Grant Gainey 2015-01-27 18:50:50 UTC
SW commit 81a2d535c4271ee384875311758a611946ba7048

Comment 5 Grant Gainey 2015-02-06 19:14:20 UTC
Fixed behavior is:

* spacewalk-export-channels now works even if no-orgs-with-id are found
* spacewalk-export now checks for error-returns and logs ERROR when it finds them

Comment 8 Lukáš Hellebrandt 2015-02-11 16:23:42 UTC
Verified with spacewalk-utils-2.3.2-15

1) Export works with a correct org id.
2) After specifying an incorrect org id, the resulting archive is empty and no traceback is shown. Returns 0.
3) Errors are propagated and printed correctly (tested artificially with sys.exit(1) ). Return code is still 0 on failure but that's OK according to devel - the whole tool should only return non-zero on critical errors.

Result of 3):

INFO: Processing users...
INFO: Processing system-groups...
INFO: Processing config-files...
INFO: Processing repositories...
INFO: Processing channels...
ERROR: Error response from /usr/bin/spacewalk-export-channels : [1]
INFO: Processing activation-keys...
INFO: Processing kickstart-scripts...
INFO: Processing system-profiles...
INFO: Export-file created at /root/spacewalk-export-dir/spacewalk_export.tar.gz

echo $?
0

Comment 10 Mathieu Bridon 2015-04-23 13:20:07 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-0281.html


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