Bug 822672

Summary: Test case failure: katello-reset-dbs, re-configure SAM
Product: [Retired] Subscription Asset Manager Reporter: Eric Sammons <esammons>
Component: katello-configureAssignee: Jordan OMara <jomara>
Status: CLOSED CURRENTRELEASE QA Contact: Tazim Kolhar <tkolhar>
Severity: medium Docs Contact:
Priority: high    
Version: 1.3CC: athomas, bkearney, cpelland, cwelton, lzap, tkolhar, tomckay
Target Milestone: rcKeywords: Triaged
Target Release: 1.X   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-06-07 17:28:03 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:
Bug Depends On:    
Bug Blocks: 833466    

Description Eric Sammons 2012-05-17 18:19:51 UTC
https://tcms.engineering.redhat.com/case/147894/?from_plan=5985

Version-Release number of selected component (if applicable):
2012-05-16.2

katello-common-0.3.1-1.el6_2.noarch
katello-cli-common-0.3.2-3.el6_2.noarch
katello-candlepin-cert-key-pair-1.0-1.noarch
thumbslug-0.0.24-1.el6_2.noarch
katello-glue-candlepin-0.3.1-1.el6_2.noarch
katello-cli-headpin-0.2.0-1.el6_2.noarch
katello-certs-tools-1.1.5-1.el6_2.noarch
katello-configure-0.3.3-2.el6_2.noarch
katello-headpin-0.2.6-4.el6_2.noarch
candlepin-0.6.2-1.el6_2.noarch
candlepin-tomcat6-0.6.2-1.el6_2.noarch
katello-selinux-0.2.4-1.el6_2.noarch
katello-headpin-all-0.2.6-4.el6_2.noarch


Steps to Reproduce: 
  * Install RHEL 6.2+ Base system
  * Configure SAM content channels.


 1. yum install -y katello-headpin-all 
 2. katello-configure --deployment=katello
 3. /usr/share/katello/scripts/katello-reset-dbs
 4. katello-configure --deployment=sam



Actual results: 
# /usr/share/katello/script/katello-reset-dbs 
Defaulting to [production] environment


***********************************************************
THIS SCRIPT WILL ERASE KATELLO / CANDLEPIN / PULP DATABASES
***********************************************************


All data from all systems will be erased completely!


This script only works with PostgreSQL database.


It is strongly recommended to back up databases:
 # pg_dump -c candlepin > candlepin_db.sql
 # pg_dump -c katello > katello_db.sql


Are you sure you want reset your [production] environment? (yes/no)? yes
Erasing all data...
Stopping Katello instance
Stopping server on 0.0.0.0:5000 ... 
Sending QUIT signal to process 4506 ... 
Stopping server on 0.0.0.0:5001 ... 
Sending QUIT signal to process 4510 ... 
Stopping server on 0.0.0.0:5002 ... 
Sending QUIT signal to process 4514 ... 
Stopping Katello jobs instance
Stopping katello-jobs: 
Stopping Candlepin instance
Stopping tomcat6:                                          [  OK  ]
Initializing Candlepin database
** Skipping configuration file setup
Cerficiates already exist, skipping...
Waiting for tomcat to restart...
Candlepin has been configured.
Starting Candlepin instance
Stopping tomcat6:                                          [  OK  ]
Starting tomcat6:                                          [  OK  ]
Initializing Katello database
** Invoke setup (first_time)
** 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
** Invoke db:create (first_time)
** Invoke db:load_config 
** Execute db:create
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
...
asks: TOP => setup => db:migrate:reset => db:migrate
Starting Katello instance
Starting katello: Starting server on 0.0.0.0:5000 ... 
Starting server on 0.0.0.0:5001 ... 
Starting server on 0.0.0.0:5002 ... 
                                                           [  OK  ]
Starting Katello jobs instance
Starting katello-jobs:                                     [  OK  ]
DONE. CHECK ALL THE MESSAGES ABOVE!
[root@pinky ~]# headpin -u admin -p admin product list --org ACME_Corporation
Invalid credentials or unable to authenticate
[root@pinky ~]#

Logging in at the web ui fails as well.
Expected results:
After step 2 there should errors that indicate the install was not quiet
successful.

After step 4, the sam deployment should be configured and working.

Comment 1 Lukas Zapletal 2012-05-18 12:20:58 UTC
BTW theres a "-f" force flag, no need of "yes" then:

/usr/share/katello/script/katello-reset-dbs -f

Comment 2 Lukas Zapletal 2012-05-21 11:42:04 UTC
Unable to reproduce with Katello, this is Headpin only issue.

Eric can you extend your scenario to:

1. yum install -y katello-headpin-all 
2. katello-configure --deployment=katello
***: headpin ping
3. /usr/share/katello/scripts/katello-reset-dbs
***: headpin ping
4. katello-configure --deployment=sam
***: headpin ping

Because Headping testing repo installation is currently failing, I dont see from the output it was running the first time. Also, attach katello-debug output, if possible.

Current installation issue is: https://bugzilla.redhat.com/show_bug.cgi?id=823493

Comment 3 Eric Sammons 2012-05-22 20:39:23 UTC
Unfortunately with a yum install -y katello-headpin-all I can not run katello-configure --deployment=katello; I have tested and this fails as expected as there is no way for SAM to support a katello deployment.

Comment 4 Tom McKay 2012-05-29 15:09:06 UTC
Moving to 1.2 since katello-reset-dbs is a non-user command and while it needs to be fixed, it should not be necessary in a customer install.

Comment 5 Eric Sammons 2012-05-29 16:04:45 UTC
Captured the output from a recent test; looks like a issue in the user.rb.

[snip]
==  AddUserToTaskStatus: migrating ============================================
rake aborted!
An error has occurred, this and all later migrations canceled:

uninitialized constant Glue::Pulp
/usr/share/katello/app/models/user.rb:19
/usr/share/katello/db/migrate/20111208225553_add_user_to_task_status.rb:3:in `up_without_benchmarks'
[/snip]

Comment 8 Tazim Kolhar 2012-06-05 10:31:32 UTC
VERIFIED with the build:
[root@dhcp201-113 ~]# rpm -qa | grep katello
katello-headpin-all-0.2.12-2.el6_2.noarch
katello-certs-tools-1.1.5-1.el6_2.noarch
katello-common-0.3.2-1.el6_2.noarch
katello-cli-common-0.3.5-2.el6_2.noarch
katello-configure-0.3.7-1.el6_2.noarch
katello-candlepin-cert-key-pair-1.0-1.noarch
katello-glue-candlepin-0.3.2-1.el6_2.noarch
katello-cli-headpin-0.2.2-1.el6_2.noarch
katello-selinux-0.2.4-1.el6_2.noarch
katello-headpin-0.2.12-2.el6_2.noarch


Steps to reproduce :
yum install -y katello-headpin-all

[root@dhcp201-113 ~]# katello-configure --deployment=katello
You have attempted to set up katello with katello-headpin installed.
Please consult the documentation or use a valid --deployment flag.

[root@dhcp201-113 ~]# /usr/share/katello/scripts/katello-reset-dbs
-bash: /usr/share/katello/scripts/katello-reset-dbs: No such file or directory


[root@dhcp201-113 ~]# katello-configure --deployment=sam
Starting Katello configuration
The top-level log file is [/var/log/katello/katello-configure-20120605-155638/main.log]
Creating Katello database user
############################################################ ... OK
Creating Katello database
############################################################ ... OK
Creating Candlepin database user
############################################################ ... OK
Candlepin setup
############################################################ ... OK
Populating Katello database schema
############################################################ ... OK
Initializing Katello data
############################################################ ... OK


[root@dhcp201-113 ~]# headpin -u admin -p admin org list
--------------------------------------------------------------------------------
                              Organization List

 Id   Name               Description                    
--------------------------------------------------------------------------------
 1    ACME_Corporation   ACME_Corporation Organization  


sam deployment configured and is working