Bug #34386
closedservice stop tries to execute CheckTftpStorage
Description
Ohai,
on a Satellite 7.0, when PostgreSQL is down (because it was taken down via `systemctl stop postgresql`, e.g.) and one tries to issue `foreman-maintain service stop` you get a "Broken Pipe" error and nothing works.
Version-Release number of selected component (if applicable):
7.0 Snap 7 on EL8 (but shouldn't be EL8 specific, I think)
How reproducible:
100
Steps to Reproduce:
1. systemctl stop postgresql
2. foreman-maintain service stop
- foreman-maintain service stop
Broken pipe - echo $?
1
Expected results:
Services are stopped.
Additional info:
Looking at the log, you see:
D, [2022-01-31 07:18:10-0500 #61305] DEBUG -- : Running command PGPASSWORD='[FILTERED]' psql h localhost -p 5432 -U foreman -d foreman with stdin "SELECT 1 as ping" : output of the command:
D, [2022-01-31 07:18:10-0500 #61305] DEBUG -
psql: error: could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
E, [2022-01-31 07:18:10-0500 #61305] ERROR -- : Please check whether database service is up & running state. (ForemanMaintain::Error::Fail)
/usr/share/gems/gems/foreman_maintain-1.0.1/lib/foreman_maintain/concerns/base_database.rb:203:in `raise_service_error'
/usr/share/gems/gems/foreman_maintain-1.0.1/lib/foreman_maintain/concerns/base_database.rb:51:in `psql'
/usr/share/gems/gems/foreman_maintain-1.0.1/lib/foreman_maintain/concerns/base_database.rb:42:in `query_csv'
/usr/share/gems/gems/foreman_maintain-1.0.1/lib/foreman_maintain/concerns/base_database.rb:38:in `query'
/usr/share/gems/gems/foreman_maintain-1.0.1/definitions/checks/foreman_proxy/check_tftp_storage.rb:46:in `lookup_token_duration'
/usr/share/gems/gems/foreman_maintain-1.0.1/definitions/checks/foreman_proxy/check_tftp_storage.rb:33:in `non_zero_token_duration?'
/usr/share/gems/gems/foreman_maintain-1.0.1/definitions/checks/foreman_proxy/check_tftp_storage.rb:9:in `block (2 levels) in <class:CheckTftpStorage>'
/usr/share/gems/gems/foreman_maintain-1.0.1/lib/foreman_maintain/concerns/metadata.rb:226:in `instance_exec'
/usr/share/gems/gems/foreman_maintain-1.0.1/lib/foreman_maintain/concerns/metadata.rb:226:in `block in evaluate_confines'
/usr/share/gems/gems/foreman_maintain-1.0.1/lib/foreman_maintain/concerns/metadata.rb:225:in `all?'
/usr/share/gems/gems/foreman_maintain-1.0.1/lib/foreman_maintain/concerns/metadata.rb:225:in `evaluate_confines'
/usr/share/gems/gems/foreman_maintain-1.0.1/lib/foreman_maintain/concerns/metadata.rb:200:in `present?'
/usr/share/gems/gems/foreman_maintain-1.0.1/lib/foreman_maintain/detector.rb:53:in `block in find_present_classes'
/usr/share/gems/gems/foreman_maintain-1.0.1/lib/foreman_maintain/detector.rb:52:in `each'
/usr/share/gems/gems/foreman_maintain-1.0.1/lib/foreman_maintain/detector.rb:52:in `reduce'
/usr/share/gems/gems/foreman_maintain-1.0.1/lib/foreman_maintain/detector.rb:52:in `find_present_classes'
/usr/share/gems/gems/foreman_maintain-1.0.1/lib/foreman_maintain/detector.rb:38:in `available_checks'
/usr/share/gems/gems/foreman_maintain-1.0.1/lib/foreman_maintain/concerns/finders.rb:17:in `find_checks'
/usr/share/gems/gems/foreman_maintain-1.0.1/definitions/scenarios/services.rb:36:in `compose'
/usr/share/gems/gems/foreman_maintain-1.0.1/lib/foreman_maintain/scenario.rb:86:in `initialize'
/usr/share/gems/gems/foreman_maintain-1.0.1/lib/foreman_maintain/cli/service_command.rb:24:in `new'
/usr/share/gems/gems/foreman_maintain-1.0.1/lib/foreman_maintain/cli/service_command.rb:24: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-1.0.1/lib/foreman_maintain/cli.rb:46:in `run'
/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:132:in `run'
/usr/share/gems/gems/foreman_maintain-1.0.1/bin/foreman-maintain:15:in `<top (required)>'
/usr/bin/foreman-maintain:23:in `load'
/usr/bin/foreman-maintain:23:in `<main>'
I, [2022-01-31 07:18:10-0500 #61305] INFO -- : foreman-maintain command finished with 1
Updated by The Foreman Bot over 3 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman_maintain/pull/581 added
Updated by Amit Upadhye over 3 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset foreman_maintain|60ad9c9b4b5c385637dd2112bd4b318ab66dd562.