Bug 1985323 - regression: "foreman-maintain service restart" raises exception with external mongo
Summary: regression: "foreman-maintain service restart" raises exception with external...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Satellite Maintain
Version: 6.9.0
Hardware: x86_64
OS: Linux
high
high
Target Milestone: 6.9.5
Assignee: Amit Upadhye
QA Contact: Vladimír Sedmík
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-07-23 11:57 UTC by James Jeffers
Modified: 2021-08-31 12:03 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1979045
Environment:
Last Closed: 2021-08-31 12:03:05 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 32319 0 Normal Closed service stop with remote databases fails 2021-07-23 11:57:33 UTC
Red Hat Knowledge Base (Solution) 6164162 0 None None None 2021-07-23 11:57:33 UTC
Red Hat Product Errata RHBA-2021:3385 0 None None None 2021-08-31 12:03:50 UTC

Description James Jeffers 2021-07-23 11:57:19 UTC
+++ This bug was initially created as a clone of Bug #1979045 +++

Description of problem:
rubygem-foreman_maintain-0.7.10-1.el7sat.noarch has a regression compared to 0.7.8-1 version in the use case when DBs are external and one tries to e.g. restart services:

undefined method `enabled?' for RemoteDB(rh-mongodb34-mongod [5]):ForemanMaintain::Utils::Service::RemoteDB

is raised. With backtrace:

/usr/share/gems/gems/foreman_maintain-0.7.10/definitions/features/service.rb:140:in `select!'
/usr/share/gems/gems/foreman_maintain-0.7.10/definitions/features/service.rb:140:in `filter_disabled_services!'
/usr/share/gems/gems/foreman_maintain-0.7.10/definitions/features/service.rb:133:in `filter_services'
/usr/share/gems/gems/foreman_maintain-0.7.10/definitions/features/service.rb:30:in `filtered_services'
/usr/share/gems/gems/foreman_maintain-0.7.10/definitions/procedures/service/base.rb:19:in `run_service_action'
/usr/share/gems/gems/foreman_maintain-0.7.10/definitions/procedures/service/start.rb:11:in `run'
/usr/share/gems/gems/foreman_maintain-0.7.10/lib/foreman_maintain/executable.rb:139:in `__run__'
/usr/share/gems/gems/foreman_maintain-0.7.10/lib/foreman_maintain/runner/execution.rb:83:in `block (2 levels) in run'
/usr/share/gems/gems/foreman_maintain-0.7.10/lib/foreman_maintain/runner/execution.rb:107:in `capture_errors'
/usr/share/gems/gems/foreman_maintain-0.7.10/lib/foreman_maintain/runner/execution.rb:82:in `block in run'
/usr/share/gems/gems/foreman_maintain-0.7.10/lib/foreman_maintain/runner/execution.rb:101:in `with_metadata_calculation'
/usr/share/gems/gems/foreman_maintain-0.7.10/lib/foreman_maintain/runner/execution.rb:81:in `run'
/usr/share/gems/gems/foreman_maintain-0.7.10/lib/foreman_maintain/runner.rb:131:in `run_step'
/usr/share/gems/gems/foreman_maintain-0.7.10/lib/foreman_maintain/runner.rb:120:in `run_steps'
/usr/share/gems/gems/foreman_maintain-0.7.10/lib/foreman_maintain/runner.rb:113:in `execute_scenario_steps'
/usr/share/gems/gems/foreman_maintain-0.7.10/lib/foreman_maintain/runner.rb:58:in `run_scenario'
/usr/share/gems/gems/foreman_maintain-0.7.10/lib/foreman_maintain/upgrade_runner.rb:129:in `block in run_phase'
/usr/share/gems/gems/foreman_maintain-0.7.10/lib/foreman_maintain/upgrade_runner.rb:177:in `with_non_empty_scenario'
/usr/share/gems/gems/foreman_maintain-0.7.10/lib/foreman_maintain/upgrade_runner.rb:124:in `run_phase'
/usr/share/gems/gems/foreman_maintain-0.7.10/lib/foreman_maintain/upgrade_runner.rb:164:in `block in rollback_pre_migrations'
/usr/share/gems/gems/foreman_maintain-0.7.10/lib/foreman_maintain/upgrade_runner.rb:159:in `each'
/usr/share/gems/gems/foreman_maintain-0.7.10/lib/foreman_maintain/upgrade_runner.rb:159:in `rollback_pre_migrations'
/usr/share/gems/gems/foreman_maintain-0.7.10/lib/foreman_maintain/upgrade_runner.rb:90:in `run_rollback'
/usr/share/gems/gems/foreman_maintain-0.7.10/lib/foreman_maintain/upgrade_runner.rb:66:in `block in run'
/usr/share/gems/gems/foreman_maintain-0.7.10/lib/foreman_maintain/upgrade_runner.rb:65:in `each'
/usr/share/gems/gems/foreman_maintain-0.7.10/lib/foreman_maintain/upgrade_runner.rb:65:in `run'
/usr/share/gems/gems/foreman_maintain-0.7.10/lib/foreman_maintain/cli/upgrade_command.rb:96:in `execute'
/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
/usr/share/gems/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute'
/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
/usr/share/gems/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute'
/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
/usr/share/gems/gems/foreman_maintain-0.7.10/lib/foreman_maintain/cli.rb:42:in `run'
/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:132:in `run'
/usr/share/gems/gems/foreman_maintain-0.7.10/bin/foreman-maintain:15:in `<top (required)>'
/bin/satellite-maintain:23:in `load'
/bin/satellite-maintain:23:in `<main>'

This also affects upgrades of Satellite, as such services commands are part of the upgrade call flow.


Version-Release number of selected component (if applicable):
rubygem-foreman_maintain-0.7.10-1.el7sat.noarch


How reproducible:
100%


Steps to Reproduce:
1. Have Sat6.9 (or any older) with foreman-maintain 0.7.10 AND external DBs
2. foreman-maintain service restart


Actual results:
Running Restart Services
================================================================================
Check if command is run as root user:                                 [OK]
--------------------------------------------------------------------------------
Restart applicable services: 

Stopping the following service(s):                                    [FAIL]
undefined method `enabled?' for RemoteDB(rh-mongodb34-mongod [5]):ForemanMaintain::Utils::Service::RemoteDB
--------------------------------------------------------------------------------
Scenario [Restart Services] failed.

The following steps ended up in failing state:

  [service-restart]

Resolve the failed steps and rerun
the command. In case the failures are false positives,
use --whitelist="service-restart"


foreman-maintain log has the backtrace shown above.



Expected results:
Command works well :)



Additional info:
Seen upstream issue https://projects.theforeman.org/issues/32319 for the same, without details.

--- Additional comment from  on 2021-07-08T14:34:24Z 

Reference : https://bugzilla.redhat.com/show_bug.cgi?id=1978764 was also created based upon behavior of 'service status'.

--- Additional comment from  on 2021-07-16T20:02:22Z 

Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/32319 has been resolved.

Comment 2 Vladimír Sedmík 2021-08-23 12:24:48 UTC
Verified on 6.9.5 snap 2 with rubygem-foreman_maintain-0.7.12-1.el7sat.noarch:

stop, start, restart, enable, disable works as expected

[root@satellite ~]# foreman-maintain service restart
Running Restart Services
================================================================================
Check if command is run as root user:                                 [OK]
--------------------------------------------------------------------------------
Restart applicable services: 

Stopping the following service(s):
rh-mongodb34-mongod, postgresql (candlepin), postgresql (foreman), postgresql, qdrouterd, qpidd, rh-redis5-redis, squid, pulp_celerybeat, pulp_resource_manager, pulp_streamer, pulp_workers, smart_proxy_dynflow_core, tomcat, dynflow-sidekiq@orchestrator, foreman, httpd, puppetserver, dynflow-sidekiq@worker, dynflow-sidekiq@worker-hosts-queue, foreman-proxy
\ stopping puppetserver                                                         
Warning: Stopping foreman.service, but it can still be activated by:
  foreman.socket
/ stopping squid                                                                
postgresql (candlepin) is remote and is UP.

postgresql (foreman) is remote and is UP.
\ stopping rh-mongodb34-mongod                                                  
rh-mongodb34-mongod is remote and is UP.
| All services stopped                                                          

Starting the following service(s):
rh-mongodb34-mongod, postgresql (candlepin), postgresql (foreman), postgresql, qdrouterd, qpidd, rh-redis5-redis, squid, pulp_celerybeat, pulp_resource_manager, pulp_streamer, pulp_workers, smart_proxy_dynflow_core, tomcat, dynflow-sidekiq@orchestrator, foreman, httpd, puppetserver, dynflow-sidekiq@worker, dynflow-sidekiq@worker-hosts-queue, foreman-proxy
- starting rh-mongodb34-mongod                                                  
rh-mongodb34-mongod is remote and is UP.
/ starting squid                                                                
postgresql (candlepin) is remote and is UP.

postgresql (foreman) is remote and is UP.
- All services started                                                [OK]      
--------------------------------------------------------------------------------

Comment 5 errata-xmlrpc 2021-08-31 12:03:05 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 (Satellite Maintenance 6.9.5 Async Bug Fix Update), 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/RHBA-2021:3385


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