On Sep 14, 2010, at 4:19 PM, Matt Robinson wrote:

> The problem was that the yaml indirector used different settings
> depending on the run_mode.
> 
> lib/puppet/indirector/yaml.rb:44
>  # Return the path to a given node's file.
>  def path(name,ext='.yaml')
>    base = Puppet.run_mode.master? ? Puppet[:yamldir] : Puppet[:clientyamldir]
>    File.join(base, self.class.indirection_name.to_s, name.to_s + ext)
>  end
> 
> This means in my script I can just set the clientyamldir to be the
> yamldir and it works.  This appears to be the only place in the code
> that either of these settings are used.
> 
> I propose that instead of checking the run_mode in the indirector, we
> combine these settings into one setting and have the location be
> dependent on run_mode in defaults.rb.  I can't think of any reason why
> this wouldn't work and be less confusing.  Anyone else?

The real problem here is that run_mode was a broken model when I did it, and 
the reification of it didn't sufficiently fix it.

IMO, the main fix we need to do is to allow run_mode to be directly set, and 
then require that applications set it, in the same way that they set things 
like terminus_class.  This makes everything simple and obvious, and easy to 
change.  It probably even makes sense to have a DSL-style hook in the 
Application class:

Puppet::Application.new(:mystuff) do
  runs_as :master
  ...
end

As to combining the settings into one and having the conditional in 
defaults.rb, every conditional in defaults.rb is a *huge* pain to maintain 
going forward, and effectively means it's very difficult to change in 
puppet.conf or equivalent.  There really are two distinct directories, and they 
coexist just fine right now.  I agree it could be implemented better, and 
that's some code that should have a "this sucks but is the best way I can think 
of it" marker, but it's done because conditionals in defaults.rb are a 
maintenance nightmare (look at the rundir) and in late-run code like the 
terminus instances they're easy.  There's a reason that conditional is in the 
terminus instance and not the class, for instance.

-- 
Today at work an ethernet switch decided to take the 'N' out of NVRAM
                -- Richard Letts
---------------------------------------------------------------------
Luke Kanies  -|-   http://puppetlabs.com   -|-   +1(615)594-8199




-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to