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

Add reporter to report logs sent by foreman callback #870

Merged
merged 1 commit into from
Aug 3, 2020

Conversation

m-bucher
Copy link
Contributor

When ansible fails to connect to remote host,
callback sends a report to Foreman without
any indication that the report comes from
Ansible. As a result, Foreman is unable
to determine the report origin.

This adds a 'reporter' attribute into
the logs that are sent.

Fixes #836

mdellweg
mdellweg previously approved these changes Jul 13, 2020
Copy link
Member

@mdellweg mdellweg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good

@ezr-ondrej
Copy link
Member

ezr-ondrej commented Jul 14, 2020

Would it make sense to move this to the report

instead of duplicating this for every log?

@m-bucher
Copy link
Contributor Author

@ezr-ondrej I agree that this would be better.

However, foreman_ansible seems to only get the list of logs for detecting the reporter:

https://github.com/theforeman/foreman_ansible/blob/344333df2905cdb7c8affbb9a1dbb03f6ef7619c/app/services/foreman_ansible/ansible_report_scanner.rb#L8

@ezr-ondrej
Copy link
Member

For now I'd agree, but that can be changed quite "easily".
I'd say it's worth the effort. I'm willing to help as much as I can to get it done properly.
Given the ReportScanner only job is to recognize the report origin, I think it should get all info we see fit.
Take a look at my proposal: theforeman/foreman#7819

@evgeni
Copy link
Member

evgeni commented Jul 15, 2020

today, foreman_ansible looks for _ansible_parsed, not for reporter = ansible, right? So the PR in the current state wouldn't work right now with the currently released foreman_ansible?

@m-bucher
Copy link
Contributor Author

@evgeni correct, but I regard it as the first step to add a change here, before we adopt it in foreman_ansible.
If we can intertwine it with @ezr-ondrej proposed change in foreman that would be good, too.

@evgeni
Copy link
Member

evgeni commented Jul 15, 2020

Cool, then I think Foreman and Foreman Ansible should agree on a way forward and then we can implement the right tag in the callback :)

@ezr-ondrej
Copy link
Member

If we won't move forward with my suggestion soon, I'd say we can role with what is here now and change just ansible implementation and once we agree get it done in core, we can change the implementation here.

@evgeni
Copy link
Member

evgeni commented Jul 29, 2020

Now that theforeman/foreman#7819 is merged, I guess we need the matching change in foreman_ansible?

@evgeni
Copy link
Member

evgeni commented Jul 29, 2020

and then probably set it like in https://github.com/theforeman/foreman-ansible-modules/pull/896/files to the global data, and not on every log object?

@ezr-ondrej
Copy link
Member

@m-bucher could you update this to set it to the global data, please?
I believe this could go even first as the path is now given by foreman core and foreman-ansible needs to follow.

For the record, @xprazak2 is already working on it in theforeman/foreman_ansible#261

When ansible fails to connect to remote host,
callback sends a report to Foreman without
any indication that the report comes from
Ansible. As a result, Foreman is unable
to determine the report origin.

This adds a 'reporter' attribute into
the logs that are sent.
@m-bucher m-bucher force-pushed the add_reporter_to_callback branch from dc430ae to e99e78b Compare July 30, 2020 13:30
Copy link
Member

@evgeni evgeni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@xprazak2 should we merge this now, or wait on theforeman/foreman_ansible#261 -- IMHO merging now is OK if you don't anticipate any design changes in foreman_ansible anymore

Copy link
Member

@ezr-ondrej ezr-ondrej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we are good to merge, foreman_ansible have all means now to adjust to this and IMHO it's the best place to put the reporter tag to, so it should 🤷

@ezr-ondrej
Copy link
Member

hmm what is the release process for this? 🤔

@evgeni
Copy link
Member

evgeni commented Aug 2, 2020

This == this collection? We release new stuff here on GH, it gets pushed to Galaxy, the next time Ansible decides to pull new stuff (aka: next is for 2.10.1) it gets in.

@ezr-ondrej
Copy link
Member

Yeah, I meant this collection :) thanks, I was just checking about the backwards compatibility we will need to get.
That case, I'd say we are ready for this, we will just need to have a talk about the backwards compatibility in foreman_ansible, but it's unrelated to this.

@evgeni
Copy link
Member

evgeni commented Aug 2, 2020

The collection is usable by 2.8 and newer, but in the case of 2.8/2.9 the user needs to install it explicitly to get the callback, instead of getting it automatically.

@ezr-ondrej
Copy link
Member

foreman_ansible is in and waiting for this, could we get it in now? 🙃

@evgeni
Copy link
Member

evgeni commented Aug 3, 2020

up

@evgeni evgeni merged commit 70e039a into theforeman:develop Aug 3, 2020
@quba42 quba42 deleted the add_reporter_to_callback branch December 7, 2020 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ansible-callback plugin should indicate type
4 participants