Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1451352 - [Ansible Embedded] - Empty stdout after playbook execution
Summary: [Ansible Embedded] - Empty stdout after playbook execution
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: UI - OPS
Version: 5.8.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: GA
: 5.10.0
Assignee: Harpreet Kataria
QA Contact: Dmitry Misharov
URL:
Whiteboard: ansible_embed:ui
: 1515508 (view as bug list)
Depends On:
Blocks: 1451920 1515297
TreeView+ depends on / blocked
 
Reported: 2017-05-16 13:14 UTC by Pavol Kotvan
Modified: 2018-06-21 20:19 UTC (History)
17 users (show)

Fixed In Version: 5.10.0.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1451920 1515297 (view as bug list)
Environment:
Last Closed: 2018-06-21 20:19:32 UTC
Category: Bug
Cloudforms Team: Ansible
Target Upstream Version:


Attachments (Terms of Use)
Absent stdout for Opsui (deleted)
2017-05-16 13:56 UTC, Allen W
no flags Details
proof sui is fine, be sure to have ansible enabled (deleted)
2017-05-17 14:27 UTC, Allen W
no flags Details
Screenshot-Lexer Error (deleted)
2017-11-10 20:25 UTC, Kedar Kulkarni
no flags Details

Comment 3 Allen W 2017-05-16 13:32:50 UTC
Gotta ask, what do you see in opsui for this?  API endpoint for ansible stdout hasn't changed... :thinking:

Comment 5 Allen W 2017-05-16 13:56:48 UTC
Created attachment 1279338 [details]
Absent stdout for Opsui

Right on, so I checked out ops, looks like stdoutput is absent there as well, means this is likely not an SUI thing.

Comment 7 Greg McCullough 2017-05-16 14:15:36 UTC
Lucy - BillW discuss an issue like this the other day, maybe check with him on the best way to validate stdout from the backend model.

Comment 11 Allen W 2017-05-16 16:51:04 UTC
So it looks like we're not getting html, instead we're getting quazi html, which in this case looks like html with a bunch of escaped linebreaks... If ya take the output and run it through an html validator, https://validator.w3.org/nu/#textarea for instance, you'll see we got errors.  Both the sui and the opsui use the ng-html-bind directive to display the output, when its not being given html, it cries and shows nothing.  It should be noted, in the sui the following options are passed attributes: ['job_plays', 'stdout'], format_attributes: 'stdout=html'.  

TL;DR html isn't valid.  Ops/s ui don't display invalid html.  This was working as of https://github.com/ManageIQ/manageiq-ui-service/pull/691

Comment 17 Greg McCullough 2017-05-17 13:01:42 UTC
Worked with DrewB on this yesterday and the output Lucy is seeing is just the embedded control characters in the ruby string.

But if you print the string is displays exact the same as the output displayed from Tower UI.

For example:
irb(main):008:0> x = "Hello\nWorld"
=> "Hello\nWorld"   # <- Here you see \n control character

irb(main):009:0> puts x
Hello
World
=> nil

We will continue to work with UI team to determine the proper resolution.

Comment 19 Allen W 2017-05-17 14:24:31 UTC
Ok, took the plunge and loaded up the ansible db I have kicking around, on the following endpoint (the one that grabs plays and stdout)
`http://localhost:3001/api/services/45/orchestration_stacks/412?attributes=job_plays%2Cstdout&format_attributes=stdout%3Dhtml`
I see this error 
```
error	Object
kind	"internal_server_error"
message	"Embedded ansible is disabled"
klass	"MiqException::MiqOrchestrationStatusError"
```

after enabling "Embedded Ansible" I am able to see the correctly formatted stdout

SO sui is fine, now we have to come together to ensure ops is happy <3

Comment 20 Allen W 2017-05-17 14:27:01 UTC
Created attachment 1279707 [details]
proof sui is fine, be sure to have ansible enabled

Comment 21 CFME Bot 2017-05-17 20:53:34 UTC
New commit detected on ManageIQ/manageiq-ui-classic/master:
https://github.com/ManageIQ/manageiq-ui-classic/commit/c2766036f3f8ebd6ae227fbe9e9fb564ebf9532d

commit c2766036f3f8ebd6ae227fbe9e9fb564ebf9532d
Author:     Harpreet Kataria <hkataria@redhat.com>
AuthorDate: Wed May 17 09:17:52 2017 -0400
Commit:     Harpreet Kataria <hkataria@redhat.com>
CommitDate: Wed May 17 16:13:48 2017 -0400

    Need to gsub occurrences of {{ }} in the output
    
    Moved gsub logic into a helper method. Having ", ', {{, }} characters in the output was causing an issue while rendering html using ngSanitize directive, needed to escape these characters to get the output to be displayed correctly on screen. Have to gsub " on the first line and then gsub for rest of the characters in a one liner works fine.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1451352
    https://bugzilla.redhat.com/show_bug.cgi?id=1444853

 app/controllers/service_controller.rb       | 13 +++++++++++++
 app/views/service/_svcs_show.html.haml      |  6 ++----
 spec/controllers/service_controller_spec.rb |  7 +++++++
 3 files changed, 22 insertions(+), 4 deletions(-)

Comment 23 Dmitry Misharov 2017-10-13 09:41:27 UTC
Standard output is not visible in 5.9.0.2.20171010190026_0413a06.

Comment 25 Dmitry Misharov 2017-11-09 08:26:47 UTC
Fixed and verified in 5.9.0.7.20171107212356_ed87902. The standard output is shown.

Comment 26 Kedar Kulkarni 2017-11-10 20:25:44 UTC
Created attachment 1350656 [details]
Screenshot-Lexer Error

Re-opening, I can still see error. To be precise, I ran playbook 4 times, 2 times I got the output and other 2 times I didn't. Console shows some kind of "Lexer Error". 

See Screenshot.

Comment 31 CFME Bot 2017-11-17 20:18:20 UTC
New commit detected on ManageIQ/manageiq-ui-classic/master:
https://github.com/ManageIQ/manageiq-ui-classic/commit/daf9ddaed1742b7a95af829a2a5e256a7e52278f

commit daf9ddaed1742b7a95af829a2a5e256a7e52278f
Author:     Harpreet Kataria <hkataria@redhat.com>
AuthorDate: Fri Nov 17 14:00:39 2017 -0500
Commit:     Harpreet Kataria <hkataria@redhat.com>
CommitDate: Fri Nov 17 14:08:37 2017 -0500

    escaped \\' in the output to get it to render/display output on screen.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1451352

 app/controllers/service_controller.rb       | 1 +
 spec/controllers/service_controller_spec.rb | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

Comment 33 Harpreet Kataria 2017-11-21 22:11:06 UTC
*** Bug 1515508 has been marked as a duplicate of this bug. ***


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