Actually, I had it _that_ way before I tried the ways I posted previously,
in imitation of the exact same code.  But, to make sure I wasn't just
messing it up, I went ahead and tried it again with this code:

# subpaths.rb
#
module Puppet::Parser::Functions
  newfunction(:subpaths, :type => :rvalue) do |args|
    args = [args] unless args.is_a?(Array)
    args.each do |path|
      temp_path = path
      begin
        result << temp_path
        temp_path = File.dirname(temp_path)
      end while (temp_path != "/" and temp_path != ".")
    end
    return result.uniq
  end
end



The result was similar:



# puppet agent --test --noop --trace
notice: Ignoring --listen on onetime run
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/rest.rb:56:in `deserialize'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/rest.rb:120:in `find'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/indirection.rb:196:in `find'
/usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:240:in
`retrieve_new_catalog'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:490:in `thinmark'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/lib/ruby/1.8/benchmark.rb:307:in `realtime'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:489:in `thinmark'
/usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:239:in
`retrieve_new_catalog'
/usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:86:in `retrieve_catalog'
/usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:112:in
`retrieve_and_apply_catalog'
/usr/lib/ruby/site_ruby/1.8/puppet/configurer.rb:152:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:43:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/agent/locker.rb:21:in `lock'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:43:in `run'
/usr/lib/ruby/1.8/sync.rb:229:in `synchronize'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:43:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:95:in `with_client'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:41:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:172:in `call'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:172:in `controlled_run'
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:39:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/application/agent.rb:337:in `onetime'
/usr/lib/ruby/site_ruby/1.8/puppet/application/agent.rb:311:in `run_command'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:309:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:416:in `hook'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:309:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:407:in `exit_on_fail'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:309:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:69:in `execute'
/usr/bin/puppet:4
err: Could not retrieve catalog from remote server: Error 400 on SERVER:
can't convert Array into String at
/etc/puppet/environments/development/modules/testing/manifests/init.pp:7 on
node puppet-client
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run



At this point I want to give it a try from the puppet master side, to make
sure it isn't just some network error.  That trace mentions things related
to REST and deserializing, which is not what I expected, though I admit my
inexperience.

Remember, in my first post, I mentioned that I also tried it with a
function that does no processing on the args, and just returns empty
string.  I'll try that again too and get back.





On Tue, Jul 24, 2012 at 3:21 PM, Nick Fagerlund <
[email protected]> wrote:

> So I just took a look at how "include" does it:
>
>   1 # Include the specified classes
>   2 Puppet::Parser::Functions::newfunction(:include, :doc => "Evaluate one
> or more classes.") do |vals|
>   3     vals = [vals] unless vals.is_a?(Array)
>
> Maybe try that? Or maybe modify what you did and try [args].flatten.each
> do etc. etc.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Developers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/puppet-dev/-/ARmOiWuJuzAJ.
> 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.
>

-- 
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