-
Notifications
You must be signed in to change notification settings - Fork 24
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
CheckWhenObserve mode broken b/c ansible logs are not valid json #290
Comments
Was trying to figure out how to get those ansible logs parsed for another issue (extracting failure message for the Ready condition) and not seeing any quick and elegant solutions tbh. Here's what I explored:
Basically, No.3 is the only option. It's a lot of work for a seemingly small thing, but there's nothing fundamentally wrong with it. Lmk if I have a green light to work on it :) |
@morningspace Since you were looking at my other issues and PRs (thank you!), maybe you could check out this one too? |
Hi @d-honeybadger , is there any progress on being able to use CheckWhenObserve policy? Cheers |
There's some progress in parsing logs in the awx_display format (that's what ansible-runner produces by default), but it isn't comprehensive, it just extracts a few structs that are relevant for determining success/failure. The solution for this bug should probably build up on that parsing to also extract "changed" field from running tasks in check mode. I can take a look in a bit now that there's interest in this ticket :) but also if you're at all interested in tackling it yourself I'll be happy to guide you through it |
Thanks for the update. I am pretty swamped right now. I am interested in figuring out how to construct my role in order to play nicely with CheckWhenObserve mode. There is only one task in my role that returns different results that I would want to use to trigger another run. I was hoping that there is someway with the current release that I could achieve that end goal. cheers |
@d-honeybadger please let me know if you can give me some more guidance on fixing this, I want to see if I can take this on, or someone else on my team. thanks |
@dfry Thanks for considering it! First, to be clear, I think this functionality has never worked in the first place, so look at it as feature work rather than bug fix. Here's a walk-through:
Provider-ansible is using To explore those logs, I'd just Hope this was enough to give you an idea. I'd start just execing into provider-ansible and poking at |
What happened?
In
CheckWhenObserve
mode, reconciliation always fails withobserve failed: Error decoding results\n\tinvalid character
error. This error comes from provider-ansible attempting to parse ansible logs:provider-ansible/internal/controller/ansibleRun/ansibleRun.go
Line 363 in 5e0d992
The function
results.ParseJSONResultsStream
expects logs in json format (e.g. something you'd get using json callback. so, when trying to parse "classic" non-json ansible logs it, natually, fails.How can we reproduce it?
Create any ansiblerun with CheckWhenObserve policy.
Here's my example:
Observe the following status:
Note that the same playbook succeeds in
ObserveAndDelete
mode.What environment did it happen in?
Crossplane version:
1.14.0
The text was updated successfully, but these errors were encountered: