Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1985323

Summary: regression: "foreman-maintain service restart" raises exception with external mongo
Product: Red Hat Satellite Reporter: James Jeffers <jjeffers>
Component: Satellite MaintainAssignee: Amit Upadhye <aupadhye>
Status: CLOSED ERRATA QA Contact: Vladimír Sedmík <vsedmik>
Severity: high Docs Contact:
Priority: high    
Version: 6.9.0CC: ahumbe, apatel, aupadhye, dgross, kgaikwad, zhunting
Target Milestone: 6.9.5Keywords: PrioBumpGSS, Regression, Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1979045 Environment:
Last Closed: 2021-08-31 12:03:05 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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