Problem: I have successfully added new column called ipaddress in Foreman Hosts view using this procedure https://github.com/theforeman/foreman_column_view .
When I try to export the list of hosts view to CSV file, the new column ipaddress can not be exported.
**Expected outcome:The new added column should be exported
**Foreman and Proxy versions:1.15.6
**Foreman and Proxy plugin versions:tfm-rubygem-foreman_column_view-0.3.0-1.fm1_14.el7.noarch
foreman_column_view plugin hasn’t seen much significant updates over the past couple of years other than small compatibility fixes. In particular, it doesn’t know about the CSV export option which was added in newer version.
There is an issue by @Dirk open for about half a year regarding this - https://github.com/theforeman/foreman_column_view/issues/33 - but no one has yet implemented a fix.
As always, PRs are most welcome! It should be possible to do it by overriding the
csv_columns method from
app/controllers/hosts_controller.rb from the plugin and adding the custom columns to the list. If you are interested in fixing it and need any assistance, feel free to ping me on
#theforeman-dev channel on freenode IRC.
Thanks for your reply.
I can’t post in the channel, I am getting “Cannot send to nick/channel: #theforeman-dev” error when trying posting in the channel.
I have opened the configuration file /usr/share/foreman/app/controllers/api/v2/hosts_controller.rb, but unfortunately I can’t understand from where I should begin.
Could you please help me to solve this issue.
Thanks & best regards,
due to spam we had to limit the channel only to users registered to freenode - please register your nickname to nickserv (
/msg nickserv register $PASSWORD should do it) and then you will be able to chat on it.
The change needed is in the plugin itself - you need to override a function from foreman core’s hosts controller to add columns to it. To do so you’ll need to create a module in the plugin, e.g.
HostsControllerOverride that contains the
csv_columns method and use
prepend in the plugin engine definition to have it loaded when the plugin is initialized.