From 5e0d99269289a6c47b232d829eff424cfa374087 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patryk=20Du=C5=84ski?= Date: Mon, 8 Jan 2024 13:45:06 +0100 Subject: [PATCH] Fixes CheckWhenObserve policy (#262) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #261 Signed-off-by: Patryk DuĊ„ski --- internal/controller/ansibleRun/ansibleRun.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/controller/ansibleRun/ansibleRun.go b/internal/controller/ansibleRun/ansibleRun.go index d7f642d..b0d1dc1 100644 --- a/internal/controller/ansibleRun/ansibleRun.go +++ b/internal/controller/ansibleRun/ansibleRun.go @@ -357,11 +357,11 @@ func (c *external) Observe(ctx context.Context, mg resource.Managed) (managed.Ex if err != nil { return managed.ExternalObservation{}, err } - res, err := results.ParseJSONResultsStream(stdoutBuf) - if err != nil { + if err = dc.Wait(); err != nil { return managed.ExternalObservation{}, err } - if err = dc.Wait(); err != nil { + res, err := results.ParseJSONResultsStream(stdoutBuf) + if err != nil { return managed.ExternalObservation{}, err } changes := ansible.Diff(res)