Hi,
> Hi dear Foreman developers,
>
> i would like to make a modification to the "Run Puppet"
> (multiple_puppetrun) function. Per default, when I go to the "Hosts"
> Section, and then I filter "per class" basis, foreman delivers the
> servers where my class (module) is configured to be deployed. So far so
> good, now, when I select the servers and click on*"Run Puppet" it
> deploys the whole catalogue*.
>
> What I would like to achieve, would be todeploy only the selected
> class from my filter search.
Sounds like a good idea. We should ensure the UI's clear though that
it's referring to tags rather than classes specifically (it's not
entirely precise).
> Any ideas where are the relevant parts on foreman's, foreman-proxy's
> code to do this?? or anyone knows how is the the puppet kick command
> called??
>
> The idea would be basically to translate the selected filter into the
> "–tags" parameter as parameter when calling*/usr/lib/puppet kick*
> from CLI.
The first place to start is the Smart Proxy. This exposes an HTTP REST
API that Foreman calls to trigger Puppet runs using Sinatra. In
lib/puppet_api.rb you'll find where this is defined, currently with a
single nodes parameter. You could also add a tags parameter here.
The implementation to call puppetrun is in lib/proxy/puppet.rb and this
should be simple to extend to add --tags.
In Foreman itself, you'll need to extend lib/proxy_api.rb to expose the
tags parameter that the smart proxy will now support.
Next you're into Rails, so need to update the puppetrun! method in
app/models/host/managed.rb, the controller in
app/controllers/hosts_controller.rb and the UI in app/views. You'll
need to add a way to enter or select the tag here.
I hope that gets you started!
···
On 05/04/13 10:18, MrTelebird wrote:–
Dominic Cleal
Red Hat Engineering