Bug 1870737 - passwordless sudo command reports error when querying podman/docker containers for OSP16.1
Summary: passwordless sudo command reports error when querying podman/docker container...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: SmartState Analysis
Version: 5.11.7
Hardware: x86_64
OS: Unspecified
unspecified
medium
Target Milestone: GA
: 5.11.8
Assignee: Andrey
QA Contact: Jad Haj Yahya
Red Hat CloudForms Documentation
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-08-20 17:36 UTC by Chris Janiszewski
Modified: 2022-07-09 11:43 UTC (History)
5 users (show)

Fixed In Version: 5.11.8.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-09-30 14:04:01 UTC
Category: ---
Cloudforms Team: CFME Core
Target Upstream Version:
Embargoed:
simaishi: cfme-5.11.z+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2020:4134 0 None None None 2020-09-30 14:04:15 UTC

Description Chris Janiszewski 2020-08-20 17:36:38 UTC
Description of problem:
When running SmartState analysis on overcloud nodes (OSP16.1), cloudforms engine reports an error:

[----] E, [2020-08-20T12:49:24.978216 #2725:2afb9b5a05c0] ERROR -- : /opt/rh/cfme-gemset/bundler/gems/cfme-gems-pending-e280ad44830f/lib/gems/pending/util/MiqSshUtil.rb:155:in `block (3 levels) in exec'
[----] E, [2020-08-20T12:49:32.481373 #2716:2afb9b5a05c0] ERROR -- : [RuntimeError]: MiqSshUtil::exec - Command 'sudo if [ -e /usr/bin/podman ]; then sudo podman ps --format "{{.Names}} {{.Status}}"; fi; if [ -e /usr/bin/docker ]; then docker ps --format "table {{.Names}}\t{{.Status}}" | tail -n +2; fi' failed: bash: -c: line 0: syntax error near unexpected token `then'

This looks like a syntax error. I have tried the command directly on the overcloud nodes and got similar result:
[root@chrisj-osp-test-controller-0 ~]# sudo if [ -e /usr/bin/podman ]; then sudo podman ps --format "{{.Names}} {{.Status}}"; fi; if [ -e /usr/bin/docker ]; then docker ps --format "table {{.Names}}\t{{.Status}}" | tail -n +2; fi
-bash: syntax error near unexpected token `then'


then correct the manual command to look like this to make it work:
[root@chrisj-osp-test-controller-0 ~]# sudo /bin/sh -c 'if [ -e /usr/bin/podman ]; then sudo podman ps --format "{{.Names}} {{.Status}}"; fi'
collectd Up 45 hours ago
nova_api_cron Up 45 hours ago
swift_proxy Up 45 hours ago



Version-Release number of selected component (if applicable):
CF 5.11.7


How reproducible:
Everytime

Steps to Reproduce:
1. Connect OpenStack Infra provider
2. add ssh key
3. run smart state analysis

Actual results:
error

Expected results:
success

Additional info:

Comment 3 Jerry Keselman 2020-08-21 17:46:57 UTC
It looks like this was fixed back in May of 2020.  Investigating which PR/BZ resulted in the fix and will follow up here.

Comment 4 Jerry Keselman 2020-08-21 17:53:02 UTC
Fixed by https://github.com/ManageIQ/manageiq-providers-openstack/pull/596 which was backported to Jansa.  Its not clear this has anything to do with Smartstate, by the way.  Regardless if it is required in Ivanchuk I suggest this be reassigned to the originator.

Comment 6 CFME Bot 2020-09-01 22:11:00 UTC
New commits detected on ManageIQ/manageiq-providers-openstack/ivanchuk:

https://github.com/ManageIQ/manageiq-providers-openstack/commit/0bc37be2067a28ab8602a9effef2c816511696f4
commit 0bc37be2067a28ab8602a9effef2c816511696f4
Author:     Adam Grare <agrare>
AuthorDate: Wed May 27 12:40:01 2020 +0000
Commit:     Satoe Imaishi <simaishi>
CommitDate: Tue Sep  1 22:09:48 2020 +0000

    Merge pull request #596 from andyvesel/fix_bash_condition

    Fix bash condition for services list

    (cherry picked from commit 35eb2ec2fe01955f647d23de407c6dd3d2491bbc)

    https://bugzilla.redhat.com/show_bug.cgi?id=1723864
    https://bugzilla.redhat.com/show_bug.cgi?id=1870737

 app/models/manageiq/providers/openstack/infra_manager/host.rb | 4 +-
 1 file changed, 2 insertions(+), 2 deletions(-)

Comment 7 ikanias 2020-09-16 13:02:52 UTC
Verified on version 5.11.8.

Comment 12 errata-xmlrpc 2020-09-30 14:04:01 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 (Moderate: CloudForms 5.0.8 security, bug fix and enhancement 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/RHSA-2020:4134


Note You need to log in before you can comment on or make changes to this bug.