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
Fixes #32030, #32188 - process events with unknown hosts #55
Fixes #32030, #32188 - process events with unknown hosts #55
Conversation
d42a2a0
to
cb2a760
Compare
When ansible-runner executes a local task (through `delegate_to: localhost` or any other available mechanism in Ansible to do so), it breaks the implicit assumption that all logs are related to a host that we know about (with “we” being Foreman in general, and the `inputs["targets"]` Dynflow structure in this particular case). - Guard against this possibility (and drop the log entry in this case). - Thwart silly Rubocop check - IMO "bite if angry" style with a composite "angry" clause (as in here) makes the code easy to misunderstand. - Broadcast messages for `localhost` - Raise an error for unknown other hosts For events that don't have host, try to get the `remote_addr` that is being reported for underlying communication events and guess hosts from there.
cb2a760
to
09b4fc4
Compare
@adamruzicka this came off of my radar, but I belive the theforeman/foreman_ansible#398 (comment) is not entirely trua and this would be beneficial (try guess the host from the addr field). Should this be warning if we don't find a host? Probably not. Happy to remove or change any part of it, but would love to get it in :) |
If I have a task with
|
Interesting 🤔 that's not what I've seen, happy to see. |
Co-authored-by: Ondřej Ezr <ezrik12@gmail.com>
This is what I had to use to break things
The
I'd say maybe yes? It breaks our assumptions about what's going on and we should mention somewhere that anything that happens from that point onwards is in a grey area?
An edge case, but what if I have a regular host in foreman called |
then your whole infrustructure breaks I guess, but here it would only break if that host is in the current batch I think, becuase we try to look for it in the current batch only, not in the whole Foreman inventory. For what would happen tho: It would just sent the localhost runs to that host if it is in the batch 🤷 |
If I'm reading it right we don't check for it at all, events for localhost get caught by the guard and broadcasted silently. If those updates went to host called
Touche :) |
You're right, looks cleaner, just sqush on merge PLS :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, let's get this in
Thank you @ezr-ondrej ! |
When ansible-runner executes a local task (through
delegate_to: localhost
or any other available mechanism in Ansible to do so), itbreaks the implicit assumption that all logs are related to a host
that we know about (with “we” being Foreman in general, and the
inputs["targets"]
Dynflow structure in this particular case).composite "angry" clause (as in here) makes the code easy to misunderstand.
localhost
For events that don't have host, try to get the
remote_addr
that isbeing reported for underlying communication events and guess hosts from
there.