Bug 735354

Summary: dropdb in deploy script fails on first run
Product: [Community] Candlepin Reporter: Tom McKay <tomckay>
Component: candlepinAssignee: Jesus M. Rodriguez <jesusr>
Status: CLOSED CURRENTRELEASE QA Contact: John Sefler <jsefler>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 0.5CC: jesusr
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Solaris   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-07-17 13:04:00 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Tom McKay 2011-09-02 13:20:16 UTC
The call to 'dropdb' in proxy/buildconf/scripts/deploy fails and exits the script on first run on new machine.

Comment 1 Jesus M. Rodriguez 2011-10-14 14:44:55 UTC
fixed in master by 0da9eac206143aba527469b220b1dbbc8dc2a30d

Comment 2 Jesus M. Rodriguez 2011-10-14 14:45:07 UTC
    do not exit if dropdb fails. There is no real good way to detect if
    dropdb failed because of lack of schema to actual drop, postgresql is
    down or being accessed by another user. So we'll just ignore the
    exit code and rely on createdb to catch the failures.
    If createdb fails because psql is down or being access by another user,
    deploy script will fail.

Comment 3 Jesus M. Rodriguez 2011-10-14 14:49:28 UTC
TEST CASE
-----------
1) deploy candlepin on a fresh machine. You will see that dropdb prints out an error message in the script output, but will NOT stop the script.

alternatively, you can test on an existing deployment of candlepin with these changes:

1) stop tomcat (sudo /sbin/service tomcat6 stop)
2) run dropdb -U candlepin candlepin
   this should print no message indicating success.
3) verify dropdb by running it again:
    dropdb -U candlepin candlepin

   this second run should result in an error message:

   dropdb: database removal failed: ERROR:  database "candlepin" does not exist

4) now you have a CLEAN candlepin db that you can redeploy with:

   buildconf/scripts/deploy 

   this should work as expected resulting in a functional candlepin

5) verify candlepin is up and running with:
   curl -k -u admin:admin https://localhost:8443/candlepin/status

   should get something like this back: 

   {"version":"0.4.19","result":true,"release":"1"}

Comment 4 Bryan Kearney 2012-07-17 13:04:00 UTC
Marking all community bugs modified or beyong as closed.