Bug 668862

Summary: init scripts return wrong error code
Product: [Retired] 389 Reporter: Simo Sorce <ssorce>
Component: Directory ServerAssignee: Nathan Kinder <nkinder>
Status: CLOSED CURRENTRELEASE QA Contact: Viktor Ashirov <vashirov>
Severity: medium Docs Contact:
Priority: high    
Version: 1.2.7CC: amsharma, jgalipea, rmeggins
Target Milestone: ---Flags: ssorce: needinfo+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-07 17:16:47 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 639035, 656390    
Attachments:
Description Flags
Patch nhosoi: review+

Description Simo Sorce 2011-01-11 20:34:49 UTC
If you do not pass an instance name, or you pass a wrong instance name, or there are no instances available the init scripts will warn on stdout but will still return 0 to the shell.
An error number should be returned instead.

Comment 1 Nathan Kinder 2011-02-01 23:02:27 UTC
Created attachment 476498 [details]
Patch

Comment 2 Nathan Kinder 2011-02-01 23:29:33 UTC
Pushed to master.  Thanks to Noriko for her review!

Counting objects: 9, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 1.18 KiB, done.
Total 5 (delta 4), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/ds.git
   b5bee52..5a41728  master -> master

Comment 3 Jenny Galipeau 2011-05-16 17:35:00 UTC
Which init scripts, can you please be more specific and adds steps to reproduce the issue? Thanks

Comment 4 Rich Megginson 2011-05-16 17:43:39 UTC
(In reply to comment #3)
> Which init scripts, can you please be more specific and adds steps to reproduce
> the issue? Thanks

step 1 - after a yum install on a clean system, do
service dirsrv start && echo success
you should not see the echo success
service dirsrv start || echo failed
you should see the echo failed

step 2 - if you have run setup to create a directory server instance /etc/dirsrv/slapd-localhost, then try to run
service dirsrv restart bogus && echo success
it should not do the echo success
if you try to run
service dirsrv restart bogus || echo failed
you should see the echo failed

Comment 5 Amita Sharma 2011-05-24 10:45:06 UTC
Step 1:

[root@amsharma etc]# service dirsrv start && echo success
  *** Error: no dirsrv instances configured
[root@amsharma etc]# service dirsrv start || echo failed
  *** Error: no dirsrv instances configured
failed


Step 2
[root@testvm scripts]# ps -aef | grep slapd
nobody   13191     1  0 13:08 ?        00:00:06 /usr/sbin/ns-slapd -D /etc/dirsrv/slapd-testvm -i /var/run/dirsrv/slapd-testvm.pid -w /var/run/dirsrv/slapd-testvm.startpid
root     14005  3931  0 16:13 pts/1    00:00:00 grep slapd

[root@testvm scripts]# service dirsrv restart bogus && echo success
bogus is an invalid dirsrv instance                        [FAILED]

[root@testvm scripts]# service dirsrv restart bogus || echo failed
bogus is an invalid dirsrv instance                        [FAILED]
failed