Bug 749355 - katello-configure returns 0 even when it fails
Summary: katello-configure returns 0 even when it fails
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Infrastructure
Version: 6.0.1
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: Jan Pazdziora
QA Contact: Katello QA List
URL:
Whiteboard:
Depends On:
Blocks: katello-blockers
TreeView+ depends on / blocked
 
Reported: 2011-10-26 19:30 UTC by Jeff Weiss
Modified: 2019-09-26 13:22 UTC (History)
3 users (show)

Fixed In Version: katello-configure-0.1.9-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-08-22 18:03:06 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Jeff Weiss 2011-10-26 19:30:01 UTC
Description of problem:

[root@katello-ci-rhel6 ~]# katello-configure 
Starting Katello configuration
The top-level log file is [/var/log/katello/katello-configure-20111026-152342/main.log]
Populating Katello database schema

  Failed, please check [/var/log/katello/katello-configure/db_seed.log]
[root@katello-ci-rhel6 ~]# echo $?
0



Version-Release number of selected component (if applicable):
katello-0.1.96-1.git.46.fc9bd29.el6.x86_64

How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Clifford Perry 2011-10-26 19:35:58 UTC
Jan are we able to add some sort of exit code here? 

This code snippet?
                                elsif line =~ /err:/
                                        t.kill
                                        puts "\n  Failed, please check [#{processing_logfile}]"
                                        processing_logfile = nil
                                end

Also maybe within? 

rescue => e
        $stderr.puts 'Error: ' + e.message
end



Cliff

Comment 2 Jan Pazdziora 2011-10-26 19:51:34 UTC
(In reply to comment #1)
> Jan are we able to add some sort of exit code here? 

Well, we can, except: the fact that one target fails in puppet does not necessarily mean that the whole process would be aborted -- other things could get configured after the first failure.

Do you prefer us to exit with nonzero whenever we see an error, even if it was followed by successes?

Comment 3 Jeff Weiss 2011-10-27 12:50:29 UTC
How about returning the result of the last target?

Comment 5 Clifford Perry 2011-10-27 13:43:57 UTC
(In reply to comment #2)
> (In reply to comment #1)
> > Jan are we able to add some sort of exit code here? 
> 
> Well, we can, except: the fact that one target fails in puppet does not
> necessarily mean that the whole process would be aborted -- other things could
> get configured after the first failure.
> 
> Do you prefer us to exit with nonzero whenever we see an error, even if it was
> followed by successes?

I think that we should *assume* any err from puppet being logged during a fresh installation will result in some portion of the installation not being completed and thus resulting in some portion of Katello not functioning correctly. 

I would rather get bug reports knowing *when* we hit err states during installation to help make the puppet stuff as robust as we can. 

So, yes. I feel that we should provide a non-zero exit code if err was detected, even if the rest can/did run OK after it. 

Cliff

Comment 6 Clifford Perry 2011-10-27 13:44:56 UTC
(In reply to comment #3)
> How about returning the result of the last target?

Sadly - I do not fully grok that statement - maybe define (with an example) what you mean by 'target'. 

Unless you feel my proposal in comment #5 is OK.

Cliff

Comment 7 Jeff Weiss 2011-10-27 15:21:57 UTC
Cliff, see comment #2.

I mean, whatever puppet did last, if it failed, return nonzero error code.

Comment 8 Jan Pazdziora 2011-11-02 14:51:03 UTC
Patch posted to katello-devel:

https://www.redhat.com/archives/katello-devel/2011-November/msg00022.html

With the patch, katello-configure will exit with nonzero status if error was seen during puppet execution (note, not just the last step in puppet).

Comment 9 Jan Pazdziora 2011-11-02 20:40:38 UTC
Patch was applied to Katello master, 0e82a872d08a95a1659a6e8d11319f5f72352939.

Comment 10 Mike McCune 2011-11-15 22:19:47 UTC
DOCS:

Errors look like this:

# katello-configure 
Starting Katello configuration
The top-level log file is [/var/log/katello/katello-configure-20111115-170733/main.log]
err: /Stage[main]/Postgres::Service/Service[postgresql]/ensure: change from stopped to running failed: Could not start Service[postgresql]: Execution of '/sbin/service postgresql start' returned 1:  at /usr/share/katello/install/puppet/modules/postgres/manifests/service.pp:6

There are different error conditions that can also show up like follows:

  Failed, please check [#{processing_logfile}] 

where the [] is replaced with the name of the log containing the step that errored.

Comment 11 Jeff Weiss 2011-11-16 13:30:43 UTC
Now returns nonzero on failures (in this case, service katello-jobs failed to start)
Verified, katello-0.1.104-1.git.57.dab58b8.el6.x86_64

Comment 14 Mike McCune 2013-08-16 18:24:23 UTC
getting rid of 6.0.0 version since that doesn't exist


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