Expose Foreman global parameters in foreman-rundeck integration

Hello!

I'm using foreman 1.5.1 and I needed at some point to expose few Foreman
global parameters as Rundeck tags, and control the parameters exposed with,
of course, another global parameter.

This is the code change used to make that happening:

*** app/models/host/managed.rb.bk 2014-12-08 09:46:20.122905061 +0200
— app/models/host/managed.rb 2014-12-08 09:58:02.412140824 +0200
*************** class Host::Managed < Host::Base
*** 550,555 ****
— 550,556 ----
unless self.params["rundeckfacts"].empty?
rdecktags += self.params["rundeckfacts"].gsub(/\s+/,
'').split(',').map { |rdf| "#{rdf}=" + (facts_hash[rdf] || "undefined") }
end

  • rdecktags += self.params[&quot;rundeckglobalparams&quot;].gsub(/\s+/, 
    

'').split(',').map { |rdg| "#{rdg}=" + (self.params[rdg] || "undefined") }
{ name => { "description" => comment, "hostname" => name, "nodename"
=> name,
"Environment" => environment.name,
"osArch" => arch.name, "osFamily" => os.family, "osName" => os.name,

If you find the change useful, please include this functionality in Foreman.

Best regards,
Virgil

>
> Hello!
>
> I'm using foreman 1.5.1 and I needed at some point to expose few Foreman
> global parameters as Rundeck tags, and control the parameters exposed with,
> of course, another global parameter.
>
> This is the code change used to make that happening:
>
> *** app/models/host/managed.rb.bk 2014-12-08 09:46:20.122905061 +0200
> — app/models/host/managed.rb 2014-12-08 09:58:02.412140824 +0200
> *************** class Host::Managed < Host::Base
> *** 550,555 ****
> — 550,556 ----
> unless self.params["rundeckfacts"].empty?
> rdecktags += self.params["rundeckfacts"].gsub(/\s+/,
> '').split(',').map { |rdf| "#{rdf}=" + (facts_hash[rdf] || "undefined") }
> end
> + rdecktags += self.params["rundeckglobalparams"].gsub(/\s+/,
> '').split(',').map { |rdg| "#{rdg}=" + (self.params[rdg] || "undefined") }
> { name => { "description" => comment, "hostname" => name, "nodename"
> => name,
> "Environment" => environment.name,
> "osArch" => arch.name, "osFamily" => os.family, "osName" =>
> os.name,
>
>
> If you find the change useful, please include this functionality in
> Foreman.
>

Virgil,

Rundeck has been extracted to its own plugin,[1] would you mind submitting
a pull request to it? See general instruction for how to contribute [2]

thanks!

Ohad

[1] https://github.com/theforeman/foreman_host_rundeck
[2] Foreman :: Contribute

··· On Mon, Dec 8, 2014 at 2:22 PM, wrote:

Best regards,
Virgil


You received this message because you are subscribed to the Google Groups
"foreman-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.