Sanitize command output in ohai-solo system info

Bug #1294851 reported by BK Box on 2014-03-19
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
satori
Medium
BK Box

Bug Description

Paramiko has issues with parsing stdout of a command on some fedora based distros when there is something printed to the screen and an interactive session. This causes an issue with ohai-solo and parsing the returned JSON document since the beginning of the output is not JSON.

For example, when the .bashrc file contains something like the following:

    echo "G'day!"

the output of ohai-solo returned from Paramiko would be:

    G'day!
    { "system_info": "some_json" }

The call `json.loads()` against that string will raise an exception.

Expected behavior:

Find the valid JSON in the string (if any), pull it out, and try to parse that.

Fix proposed to branch: master
Review: https://review.openstack.org/81626

Changed in satori:
status: New → In Progress

Reviewed: https://review.openstack.org/81626
Committed: https://git.openstack.org/cgit/stackforge/satori/commit/?id=0258742b74ff68cffc6394fe9cab812ad71a8d14
Submitter: Jenkins
Branch: master

commit 0258742b74ff68cffc6394fe9cab812ad71a8d14
Author: BK Box <email address hidden>
Date: Wed Mar 19 15:42:01 2014 -0500

    Pull out JSON string from stdout

    When there is a custom message in `.bashrc` on certain fedora based
    distros, the string will be included in the stdout. This will pull out
    the following JSON string, if present, and attempt to parse that.

    Change-Id: I7d0d4e9b36924664d158c62baf8cdef163bd1d85
    Closes-Bug: #1294851

Changed in satori:
status: In Progress → Fix Committed
BK Box (bkbox) on 2014-03-20
Changed in satori:
status: Fix Committed → Fix Released
BK Box (bkbox) on 2014-03-20
Changed in satori:
milestone: none → poc
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers