Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement "restart" for RemoteDB services #925

Merged
merged 1 commit into from
Sep 4, 2024
Merged

Conversation

evgeni
Copy link
Member

@evgeni evgeni commented Sep 4, 2024

It's not really a restart, as we can't control it, but it checks the DB
and returns the status properly.

Fixes: 7cdffe7

@evgeni
Copy link
Member Author

evgeni commented Sep 4, 2024

before:

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

Restarting the following service(s):
postgresql (candlepin), postgresql (foreman), postgresql (pulpcore)
- restarting postgresql (pulpcore)#<Thread:0x000055b14795a210 /usr/share/gems/gems/foreman_maintain-1.7.1/definitions/features/service.rb:94 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
/usr/share/gems/gems/foreman_maintain-1.7.1/definitions/features/service.rb:94:in `block (2 levels) in fork_threads_for_services': undefined method `restart' for RemoteDB(postgresql:candlepin [10]):ForemanMaintain::Utils::Service::RemoteDB (NoMethodError)
Did you mean?  start
#<Thread:0x000055b147959d88 /usr/share/gems/gems/foreman_maintain-1.7.1/definitions/features/service.rb:94 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
/usr/share/gems/gems/foreman_maintain-1.7.1/definitions/features/service.rb:94:in `block (2 levels) in fork_threads_for_services': undefined method `restart' for RemoteDB(postgresql:foreman [10]):ForemanMaintain::Utils::Service::RemoteDB (NoMethodError)
Did you mean?  start
#<Thread:0x000055b147959928 /usr/share/gems/gems/foreman_maintain-1.7.1/definitions/features/service.rb:94 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
/usr/share/gems/gems/foreman_maintain-1.7.1/definitions/features/service.rb:94:in `block (2 levels) in fork_threads_for_services': undefined method `restart' for RemoteDB(postgresql:pulpcore [10]):ForemanMaintain::Utils::Service::RemoteDB (NoMethodError)
Did you mean?  start
                                    [FAIL]
undefined method `restart' for RemoteDB(postgresql:candlepin [10]):ForemanMaintain::Utils::Service::RemoteDB
Did you mean?  start
--------------------------------------------------------------------------------
Scenario [Restart Services] failed.

The following steps ended up in failing state:

  [service-restart]

Resolve the failed steps and rerun the command.

If the situation persists and, you are unclear what to do next,
contact Red Hat Technical Support.

In case the failures are false positives, use
--whitelist="service-restart"


after

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

Restarting the following service(s):
postgresql (candlepin), postgresql (foreman), postgresql (pulpcore)
\ restarting postgresql (pulpcore)                                              
postgresql (candlepin) is remote and is UP. It can't be restarted

postgresql (foreman) is remote and is UP. It can't be restarted

postgresql (pulpcore) is remote and is UP. It can't be restarted
\ All services restarted                                              [OK]      
--------------------------------------------------------------------------------

@@ -38,6 +38,10 @@ def stop
[0, db_status.last]
end

def restart
db_status("It can't be restarted")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is ambiguous, and I am trying to think through better wording:

  • Must be restarted manually
  • Cannot be restarted by #{tool-name}
  • Remote databases are not managed by #{tool-name}, they must be restarted by you.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe. But it's in line with enable/disable in this file, and @lpramuk pointed out that having some kind of MSG for start/stop would also be cool.

Further improvement?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be more explicit is my ask, how about:

Remote databases are not managed by #{tool-name} and therefore was not restarted.

It's not really a restart, as we can't control it, but it checks the DB
and returns the status properly.

Fixes: 7cdffe7
@evgeni evgeni merged commit e4b1454 into master Sep 4, 2024
8 checks passed
@evgeni evgeni deleted the resrtart-remote branch September 4, 2024 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants