Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duration + Json parsing #52

Closed
TheFieryLynx opened this issue May 4, 2021 · 5 comments · Fixed by #92
Closed

Duration + Json parsing #52

TheFieryLynx opened this issue May 4, 2021 · 5 comments · Fixed by #92
Labels
bug Something isn't working v1.1.6

Comments

@TheFieryLynx
Copy link

if i make:

execute := execute.NewDefaultExecute(
	execute.WithWrite(io.Writer(buff)),
	execute.WithShowDuration(),
)

then:

StdoutCallback:    	"json",
Exec: 			execute,

then:

err := playbook.Run(context.TODO())
res, err = results.JSONParse(buff.Bytes())

it will be error:

panic: Unmarshall error
	invalid character 'D' after top-level value

goroutine 1 [running]:

Because of line in the end of output: "Duration: 5.348349791s"

Sorry, if it's my mistake! Amazing rep!

@apenella apenella added bug Something isn't working v1.2.0 labels May 4, 2021
@apenella
Copy link
Owner

apenella commented May 4, 2021

Hi @TheFieryLynx!
you are right, when you would like to show the duration with json stdout, it breaks the outcome json returned by ansible.
I am going to think how to be protected again it.

Thanks!

@apenella
Copy link
Owner

hi @TheFieryLynx
I am already working on that issue. You could check the PR #92
The idea is to remove the show duration responsibility from DefaultExecute's Execute method, and define a new method to achieve the duration.

@apenella apenella removed the v1.2.0 label Feb 22, 2022
@apenella apenella removed this from the v1.2.0 milestone Feb 22, 2022
@apenella
Copy link
Owner

hi @TheFieryLynx
although it does not belong to any release yet, on master branch duration time is not measured anymore inside the executor, but has been created a decorator to do that.

Thanks for raising it up!

@apenella
Copy link
Owner

@TheFieryLynx just to let you know, I decided to prepare the release v1.1.6 which will have that changes.
Thank you very much!

@TheFieryLynx
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v1.1.6
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants