Bug 1650078

Summary: foreman-maintain cannot run package actions non interactively when stdin is removed
Product: Red Hat Satellite Reporter: Ales Dujicek <adujicek>
Component: Foreman MaintainAssignee: Anurag Patel <apatel>
Status: CLOSED NOTABUG QA Contact: Nikhil Kathole <nkathole>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.5.0CC: apatel, bkearney, inecas, kgaikwad, mbacovsk, mmccune
Target Milestone: ReleasedKeywords: Regression, Triaged
Target Release: UnusedFlags: bkearney: needinfo? (apatel)
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-03-13 23:27:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Ales Dujicek 2018-11-15 10:11:53 UTC
Description of problem:

it fails to install packages when foreman-maintain does not have stdin
so it cannot be run non-interactively

# yum remove fio -y
# foreman-maintain upgrade check -y --target-version 6.4 < /dev/null
Running preparation steps required to run the next scenarios
================================================================================
Procedures::Packages::Install: 
                                                                      [FAIL]
Failed executing yum -y install fio, exit status 256
--------------------------------------------------------------------------------
Scenario [preparation steps required to run the next scenarios] failed.

The following steps ended up in failing state:

  [packages-install]

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


interesting is, that the yum command is run in the background and in the end fio is installed in the end


/var/log/foreman-maintain/foreman-maintain.log
I, [2018-11-15 11:56:30+0200 #31952]  INFO -- : === Scenario 'preparation steps required to run the next scenarios' started ===
I, [2018-11-15 11:56:30+0200 #31952]  INFO -- : --- Execution step 'Procedures::Packages::Install' [packages-install] started ---
D, [2018-11-15 11:56:30+0200 #31952] DEBUG -- : Running command yum -y install fio with stdin nil
D, [2018-11-15 11:56:30+0200 #31952] DEBUG -- : output of the command:
 
E, [2018-11-15 11:56:30+0200 #31952] ERROR -- : Failed executing yum -y install fio, exit status 256 (ForemanMaintain::Error::ExecutionError)
/usr/share/gems/gems/foreman_maintain-0.2.11/lib/foreman_maintain/utils/command_runner.rb:54:in `execution_error'
/usr/share/gems/gems/foreman_maintain-0.2.11/lib/foreman_maintain/concerns/system_helpers.rb:64:in `execute!'
/usr/share/gems/gems/foreman_maintain-0.2.11/lib/foreman_maintain/concerns/system_helpers.rb:111:in `packages_action'
/usr/share/gems/gems/foreman_maintain-0.2.11/definitions/procedures/packages/install.rb:9:in `run'
/usr/share/gems/gems/foreman_maintain-0.2.11/lib/foreman_maintain/executable.rb:139:in `__run__'
/usr/share/gems/gems/foreman_maintain-0.2.11/lib/foreman_maintain/runner/execution.rb:83:in `block (2 levels) in run'
/usr/share/gems/gems/foreman_maintain-0.2.11/lib/foreman_maintain/runner/execution.rb:107:in `capture_errors'
...
/usr/share/gems/gems/foreman_maintain-0.2.11/bin/foreman-maintain:15:in `<top (required)>'
/usr/bin/foreman-maintain:23:in `load'
/usr/bin/foreman-maintain:23:in `<main>'
I, [2018-11-15 11:56:30+0200 #31952]  INFO -- : --- Execution step 'Procedures::Packages::Install' finished ---
I, [2018-11-15 11:56:30+0200 #31952]  INFO -- : === Scenario 'preparation steps required to run the next scenarios' finished ===
I, [2018-11-15 11:56:30+0200 #31952]  INFO -- : foreman-maintain command finished with 


I saw the same error when running foreman-maintain upgrade run ... when it got to yum -y upgrade command

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