Bug #30024
closedforeman-maintian service fails with "couldn't find HOME environment -- exp anding `~' (ArgumentError)"
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1679129
Description of problem:
`foreman-maintain service stop` fails with below error message:
~~~~~~~~~~~~~~
/usr/share/gems/gems/foreman_maintain-0.2.11/lib/foreman_maintain/config.rb:18:in `expand_path': couldn't find HOME environment -- exp
anding `~' (ArgumentError)
from /usr/share/gems/gems/foreman_maintain-0.2.11/lib/foreman_maintain/config.rb:18:in `initialize'
from /usr/share/gems/gems/foreman_maintain-0.2.11/lib/foreman_maintain.rb:54:in `new'
from /usr/share/gems/gems/foreman_maintain-0.2.11/lib/foreman_maintain.rb:54:in `setup'
from /usr/share/gems/gems/foreman_maintain-0.2.11/bin/foreman-maintain:12:in `<top (required)>'
from /usr/bin/foreman-maintain:23:in `load'
from /usr/bin/foreman-maintain:23:in `<main>'
~~~~~~~~~~~~~~~~~~~~
Observation:
1. $HOME=/root is set by default in both the Satellite 6.3 and Satellite 6.4.
2. If we manually unset the $HOME in Satellite 6.3, foreman-maintain service still works.
3. If we manually unset the $HOME in Satellite 6.4, foreman-maintain service doesn't work.
Version-Release number of selected component (if applicable):
6.4
How reproducible:
Always, when $HOME is unset in Satellite 6.4
Steps to Reproduce:
1. Open Satellite 6.4 terminal and unset the HOME
2. unset HOME
3. foreman-maintain service stop
4. This will fail
Actual results:
foreman-maintain service should work even if HOME is unset as in Satellite 6.3
Expected results:
Fails with below error:
/usr/share/gems/gems/foreman_maintain-0.2.11/lib/foreman_maintain/config.rb:18:in `expand_path': couldn't find HOME environment -- exp
anding `~' (ArgumentError)
from /usr/share/gems/gems/foreman_maintain-0.2.11/lib/foreman_maintain/config.rb:18:in `initialize'
from /usr/share/gems/gems/foreman_maintain-0.2.11/lib/foreman_maintain.rb:54:in `new'
from /usr/share/gems/gems/foreman_maintain-0.2.11/lib/foreman_maintain.rb:54:in `setup'
from /usr/share/gems/gems/foreman_maintain-0.2.11/bin/foreman-maintain:12:in `<top (required)>'
from /usr/bin/foreman-maintain:23:in `load'
from /usr/bin/foreman-maintain:23:in `<main>'
Additional info:
In order to get an offline and consistent backup of the Satellite, the customer uses the custom script to stop the Satellite services before the backup/snapshot starts.
Updated by Kavita Gaikwad almost 4 years ago
As it is recommended to run foreman-maintain using root user, we can consider /root if $HOME is not set.
Updated by The Foreman Bot almost 4 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman_maintain/pull/357 added
Updated by Kavita Gaikwad almost 4 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset foreman_maintain|d489c32f83946cdf21097c38081e239e84684bc0.
Updated by Amit Upadhye almost 4 years ago
- Fixed in Releases foreman_maintain-0.6.9 added
Updated by Kavita Gaikwad over 3 years ago
- Assignee changed from Anurag Patel to Kavita Gaikwad