Bug 735354 - dropdb in deploy script fails on first run
Summary: dropdb in deploy script fails on first run
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Candlepin
Classification: Community
Component: candlepin
Version: 0.5
Hardware: Unspecified
OS: Solaris
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Jesus M. Rodriguez
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-09-02 13:20 UTC by Tom McKay
Modified: 2015-05-14 15:22 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-07-17 13:04:00 UTC
Embargoed:


Attachments (Terms of Use)

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.


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