On Nov 22, 3:06 am, Ramon van Alteren <ra...@hyves.nl> wrote:
> Hi All,
>
> We're trying to get a hudson build working for our puppet modules by using
> manitest.
>
> So far we've had good progress but right now we're stumped.
> We have a set of manifest/template combinations where the
> manifest code uses the hostname fact to pick a specific template tied to a
> particular hostname.
>
> Not the nicest code......
>
> However when running manitest with a yaml file from one of the target
> servers the manifest fails because the hostname fact is still set to the
> hostname of our hudson machine.
> It appears that the hostname fact is not replaced by the manitest code, but
> we can't figure out why not.
> The fqdn fact is set correctly, we verified that the hostname fact is
> present in the yaml file, it is.
>
> This is the manitest snippet that takes care of overriding the facts based
> on the yaml:
>
>  node = YAML.load_file options[:node]
> <snip>
>  # export all parameters as facter env - overriding our real system values
>  # this also works for external nodes parameters
>  puts "Setting up facts:" if options[:debug]
>  node.parameters.each do |k,v|
>    begin
>      if v.is_a?Array
>        if v.empty?
>              puts "! converting empty array to empty variable" if
> options[:debug]
>          ENV["facter_#{k}"]='EMPTY'
>        else
>              puts "! converting array to joined string" if options[:debug]
>          ENV["facter_#{k}"]=v.join(", ")
>            end
>          else
>        ENV["facter_#{k}"]=v
>          end
>      puts "%s=>'%s'" % [k,ENV["facter_#{k}"]] if options[:debug]
>    rescue
>      warn "! failed to set fact #{k} => '#{v}'" if options[:debug]
>    end
>  end
>
> We put some additional code in there to deal with array based facts, which
> cause the manitest run to fail.
>
> Is there anyone who can shed some light on this or knows the issue ?
>
> We're working with puppet-2.6 and the latest trunk version of manitest.
>
> Any clues would be appreciated.
>
> Ramon

Ramon, did you ever make progress on this?
On your test host is the local puppet.conf parameter node_name set to
'cert'? I may be out of date, but I recall the default values of the
'hostname' 'fqdn' & 'domain' puppet variables would be sourced from
the CN of the local cert. The puppet variable 'hostname' is a bit
different than the others. I think it's assigned using ||= internally,
so your facter fact may not override the existing internal value.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to