Bug 852852

Summary: Katello resetdbs does not error if db connections exist.
Product: [Retired] Katello Reporter: Justin Sherrill <jsherril>
Component: InfrastructureAssignee: Justin Sherrill <jsherril>
Status: CLOSED WONTFIX QA Contact: Katello QA List <katello-qa-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 1.0CC: lzap, mmccune
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-11-07 16:11:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Justin Sherrill 2012-08-29 19:08:50 UTC
Description of problem:

When running katello-reset-dbs if any process is using the db, a warning is printed to the screen, but the process continues.  If you are not watching carefully it appears that all is cleared when in fact it wasn't.


 ** Invoke setup (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke check_db_config (first_time)
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute check_db_config
** Invoke clear_search_indices (first_time)
** Execute clear_search_indices
Search Indices cleared.
** Invoke db:migrate:reset (first_time)
** Invoke db:drop (first_time)
** Invoke db:load_config 
** Execute db:drop
Couldn't drop katelloschema : #<ActiveRecord::StatementInvalid: PGError: ERROR:  database "katelloschema" is being accessed by other users
DETAIL:  There are 1 other session(s) using the database.
: DROP DATABASE IF EXISTS "katelloschema">
** Invoke db:create (first_time)
** Invoke db:load_config 
** Execute db:create
katelloschema_test already exists
katelloschema already exists
** Invoke db:migrate (first_time)
** Invoke environment 
** Execute db:migrate
** Invoke db:schema:dump (first_time)
** Invoke environment 
** Execute db:schema:dump
** Execute db:migrate:reset
** Invoke seed_with_logging (first_time)
** Invoke db:seed (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment 
** Execute db:abort_if_pending_migrations
** Execute db:seed
** Execute seed_with_logging
** Execute setup
Database sucessfully recreated in development

Comment 1 Lukas Zapletal 2012-08-30 13:44:52 UTC
FYI this is a devel only script. It's not distributed.

Comment 2 Justin Sherrill 2012-08-30 13:53:55 UTC
True, maybe it'd be a better fit in the katello project bz realm.

Comment 3 Mike McCune 2012-11-07 16:11:11 UTC
we are going to be dropping katello-reset-dbs and using katello-configure --reset-data instead