Bug 1389547 - Error output when updating tfm-rubygem-fusor_server rpm, if foreman service isn't running
Summary: Error output when updating tfm-rubygem-fusor_server rpm, if foreman service i...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Quickstart Cloud Installer
Classification: Red Hat
Component: fusor-server
Version: 1.1
Hardware: All
OS: All
medium
medium
Target Milestone: ---
: 1.1
Assignee: Jason Montleon
QA Contact: James Olin Oden
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-10-27 20:37 UTC by Tasos Papaioannou
Modified: 2017-02-28 01:40 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-02-28 01:40:35 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2017:0335 0 normal SHIPPED_LIVE Red Hat Quickstart Installer 1.1 2017-02-28 06:36:13 UTC

Description Tasos Papaioannou 2016-10-27 20:37:06 UTC
Description of problem:

If the tfm-rubygem-fusor_server package is updated on the fusor server while Satellite services are stopped, the postinstall rpm script throws some ugly ruby traceback output:

****
# yum update tfm-rubygem-fusor_server-1.1.7-1.el7sat.noarch.rpm
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
Examining tfm-rubygem-fusor_server-1.1.7-1.el7sat.noarch.rpm: tfm-rubygem-fusor_server-1.1.7-1.el7sat.noarch
Marking tfm-rubygem-fusor_server-1.1.7-1.el7sat.noarch.rpm as an update to tfm-rubygem-fusor_server-1.1.5-1.el7sat.noarch
Resolving Dependencies
--> Running transaction check
---> Package tfm-rubygem-fusor_server.noarch 0:1.1.5-1.el7sat will be updated
---> Package tfm-rubygem-fusor_server.noarch 0:1.1.7-1.el7sat will be an update
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================
 Package                              Arch               Version                    Repository                                                   Size
======================================================================================================================================================
Updating:
 tfm-rubygem-fusor_server             noarch             1.1.7-1.el7sat             /tfm-rubygem-fusor_server-1.1.7-1.el7sat.noarch             750 k

Transaction Summary
======================================================================================================================================================
Upgrade  1 Package

Total size: 750 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : tfm-rubygem-fusor_server-1.1.7-1.el7sat.noarch          1/2 
rake aborted!
PG::Error: could not connect to server: No such file or directory
	Is the server running locally and accepting
	connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/connection_adapters/postgresql_adapter.rb:888:in `initialize'
[...]
/opt/rh/rh-ror41/root/usr/share/gems/gems/railties-4.1.5/lib/rails/application.rb:379:in `block in run_tasks_blocks'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
warning: %post(tfm-rubygem-fusor_server-1.1.7-1.el7sat.noarch) scriptlet failed, exit status 1
Non-fatal POSTIN scriptlet failure in rpm package tfm-rubygem-fusor_server-1.1.7-1.el7sat.noarch
  Cleanup    : tfm-rubygem-fusor_server-1.1.5-1.el7sat.noarch          2/2 
  Verifying  : tfm-rubygem-fusor_server-1.1.7-1.el7sat.noarch          1/2 
  Verifying  : tfm-rubygem-fusor_server-1.1.5-1.el7sat.noarch          2/2 

Updated:
  tfm-rubygem-fusor_server.noarch 0:1.1.7-1.el7sat                                                                                                    

Complete!
****

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

tfm-rubygem-fusor_server-1.1.7-1.el7sat.noarch.rpm

How reproducible:

100%

Steps to Reproduce:
1.) Update a fusor server from tfm-rubygem-fusor_server-1.1.5-1.el7sat to tfm-rubygem-fusor_server-1.1.7-1.el7sat.

Actual results:

Error output during yum/rpm update.

Expected results:

No error output.

Additional info:

tfm-rubygem-fusor_server calls foreman-rake db:migrate, regardless of whether the foreman db is running:

# rpm -q --scripts tfm-rubygem-fusor_server
postinstall scriptlet (using /bin/sh):
if [ "$1" = "2" ]; then
 foreman-rake db:migrate
fi

At the very least, it should log the error output to /var/log/foreman/db_migrate.log, like the foreman rpm's script does:

# rpm -q --scripts foreman

postinstall scriptlet (using /bin/sh):
[...]
/sbin/chkconfig --add foreman || :
(/sbin/service foreman status && /sbin/service foreman restart) >/dev/null 2>&1
exit 0

posttrans scriptlet (using /bin/sh):
# We need to run the db:migrate after the install transaction
# always attempt to reencrypt after update in case new fields can be encrypted
/usr/sbin/foreman-rake db:migrate db:encrypt_all >> /var/log/foreman/db_migrate.log 2>&1 || :
/usr/sbin/foreman-rake db:seed >> /var/log/foreman/db_seed.log 2>&1 || :
/usr/sbin/foreman-rake apipie:cache:index >> /var/log/foreman/apipie_cache.log 2>&1 || :
(/sbin/service foreman status && /sbin/service foreman restart) >/dev/null 2>&1
exit 0

Comment 2 Tasos Papaioannou 2016-10-28 12:49:22 UTC
The following Sat6 BZ is also relevant. At some point foreman-rake commands will probably be moved out of rpm %post scripts.

Bug 1383530 - [upgrades] database migration and seed operation in %post section of RPM causes multiple hour yum updates
https://bugzilla.redhat.com/show_bug.cgi?id=1383530

Comment 3 John Matthews 2016-10-31 19:08:30 UTC
Plan is to remove the actual migration from the rpm post, but we want to display a warning message to the user that they should run "fusor-installer --upgrade"

Comment 4 Jason Montleon 2016-12-05 17:51:21 UTC
https://github.com/fusor/fusor/pull/1298

Comment 7 James Olin Oden 2016-12-13 20:40:53 UTC
Verified by inspection of RPM tfm-rubygem-fusor_server in compose:  QCI-1.1-RHEL-7-20161212.t.2

Comment 10 errata-xmlrpc 2017-02-28 01:40:35 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2017:0335


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