Issue #7318 has been updated by Daniel Pittman.

Status changed from Needs Decision to Accepted

Dan Bode wrote:
> The issue is that the parent yaml indirection class always assumes that any 
> child class overriding the path method will always be able to return the path 
> where it wishes to load the indirected object from.

In principal I don't object to this.

> In some cases (in my case where I want to return the path with the latest 
> timestamp) it is possible that child class would either return a yaml file 
> path (if one exists) or wish to return something to indicate that there is no 
> file (b/c the actual file name being returned is dynamically determined) I 
> would like nil to indicate that we do not have a file path to return.

In the specific case, this violates the API promise of the indirector; your 
terminus is not polymorphic with the other terminuses, so having it break 
doesn't bother me.

> The parent class methods should treat the case where nil from the path method 
> the same as the case where the file from the path returned does not exist.

I probably wouldn't reject a patch, though, if you submitted one.
----------------------------------------
Feature #7318: Puppet::Indirector::Yaml should support nil return from path
https://projects.puppetlabs.com/issues/7318

Author: Dan Bode
Status: Accepted
Priority: Normal
Assignee: Daniel Pittman
Category: plumbing
Target version: 
Affected Puppet version: 
Keywords: devtriage
Branch: 


I have created a new terminus as a child class of 
Puppet::Resource::Catalog::Yaml

<pre>
class Puppet::Resource::Catalog::Latest < Puppet::Resource::Catalog::Yaml
</pre>

this terminus overrides path and may return nil in the case where there are no 
stored catalogs for a given host.

I have a patch ready as long as this behavior is acceptable.

Example of failure:

<pre>
# puppet catalog diffstore bar --trace -v
/usr/local/dev/puppet//lib/puppet/indirector/yaml.rb:12:in `exist?'
/usr/local/dev/puppet//lib/puppet/indirector/yaml.rb:12:in `find'
/usr/local/dev/puppet//lib/puppet/indirector/indirection.rb:188:in `find'
/usr/local/dev/puppet//lib/puppet/face/indirector.rb:30:in `__send__'
/usr/local/dev/puppet//lib/puppet/face/indirector.rb:30:in 
`call_indirection_method'
/usr/local/dev/puppet//lib/puppet/face/indirector.rb:44:in `find 
implementation, required on Ruby 1.8'
/usr/local/dev/puppet//lib/puppet/interface/action.rb+eval[wrapper]:189:in 
`__send__'
/usr/local/dev/puppet//lib/puppet/interface/action.rb+eval[wrapper]:189:in 
`find'
/usr/local/dev/puppet-store-diffs/lib/puppet/face/catalog/diffstore.rb:23:in 
`diffstore implementation, required on Ruby 1.8'
/usr/local/dev/puppet//lib/puppet/interface/action.rb+eval[wrapper]:189:in 
`__send__'
/usr/local/dev/puppet//lib/puppet/interface/action.rb+eval[wrapper]:189:in 
`diffstore'
/usr/local/dev/puppet//lib/puppet/application/face_base.rb:203:in `send'
/usr/local/dev/puppet//lib/puppet/application/face_base.rb:203:in `main'
/usr/local/dev/puppet//lib/puppet/application.rb:315:in `run_command'
/usr/local/dev/puppet//lib/puppet/application.rb:307:in `run'
/usr/local/dev/puppet//lib/puppet/application.rb:411:in `hook'
/usr/local/dev/puppet//lib/puppet/application.rb:307:in `run'
/usr/local/dev/puppet//lib/puppet/application.rb:402:in `exit_on_fail'
/usr/local/dev/puppet//lib/puppet/application.rb:307:in `run'
/usr/local/dev/puppet//lib/puppet/util/command_line.rb:62:in `execute'
/usr/local/dev/puppet//bin/puppet:4
/usr/local/dev/puppet//lib/puppet/face/indirector.rb:33:in 
`call_indirection_method'
/usr/local/dev/puppet//lib/puppet/face/indirector.rb:44:in `find 
implementation, required on Ruby 1.8'
/usr/local/dev/puppet//lib/puppet/interface/action.rb+eval[wrapper]:189:in 
`__send__'
/usr/local/dev/puppet//lib/puppet/interface/action.rb+eval[wrapper]:189:in 
`find'
/usr/local/dev/puppet-store-diffs/lib/puppet/face/catalog/diffstore.rb:23:in 
`diffstore implementation, required on Ruby 1.8'
/usr/local/dev/puppet//lib/puppet/interface/action.rb+eval[wrapper]:189:in 
`__send__'
/usr/local/dev/puppet//lib/puppet/interface/action.rb+eval[wrapper]:189:in 
`diffstore'
/usr/local/dev/puppet//lib/puppet/application/face_base.rb:203:in `send'
/usr/local/dev/puppet//lib/puppet/application/face_base.rb:203:in `main'
/usr/local/dev/puppet//lib/puppet/application.rb:315:in `run_command'
/usr/local/dev/puppet//lib/puppet/application.rb:307:in `run'
/usr/local/dev/puppet//lib/puppet/application.rb:411:in `hook'
/usr/local/dev/puppet//lib/puppet/application.rb:307:in `run'
/usr/local/dev/puppet//lib/puppet/application.rb:402:in `exit_on_fail'
/usr/local/dev/puppet//lib/puppet/application.rb:307:in `run'
/usr/local/dev/puppet//lib/puppet/util/command_line.rb:62:in `execute'
/usr/local/dev/puppet//bin/puppet:4
Could not run: Could not call 'find' on 'catalog': can't convert nil into String
</pre>


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" 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-bugs?hl=en.

Reply via email to