S H
2009-Jul-22 15:55 UTC
[Puppet Users] Newbie provider development: Failed to retrieve current state of resource
As I mentioned in another thread, I''m trying to work through the kinks in developing my own types/providers. I appear to be doing something very wrong, but I don''t know what. On my puppetmaster, I''ve got the following: --------------------------------------------- # modules/test/plugins/puppet/type/testtype.rb Puppet::Type.newtype(:testtype) do @doc = "A test type" ensurable newparam(:name, :namevar => true) do desc "The name" end end --------------------------------------------- # modules/test/plugins/puppet/provider/testtype.rb Puppet::Type.type(:testtype).provide do desc "Test provider" def create return true end def destroy return true end def exists? return true end end --------------------------------------------- # modules/test/manifests/init.pp testtype { "testinstance": ensure => present, } --------------------------------------------- My test machine downloads the plugins to the right location but throws this error when it makes the catalog run: err: //unix/test/Testtype[testinstance]: Failed to retrieve current state of resource: No ability to determine if testtype exists If I skip the "ensurable" and provider steps and just dump the right code into the newproperty(:ensure) do block, it works fine. What am I doing wrong here? -Shawn --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Luke Kanies
2009-Jul-22 17:59 UTC
[Puppet Users] Re: Newbie provider development: Failed to retrieve current state of resource
On Jul 22, 2009, at 8:55 AM, S H wrote:> As I mentioned in another thread, I''m trying to work through the > kinks in developing my own types/providers. I appear to be doing > something very wrong, but I don''t know what. > > On my puppetmaster, I''ve got the following: > > --------------------------------------------- > # modules/test/plugins/puppet/type/testtype.rb > Puppet::Type.newtype(:testtype) do > @doc = "A test type" > ensurable > > newparam(:name, :namevar => true) do > desc "The name" > end > end > --------------------------------------------- > # modules/test/plugins/puppet/provider/testtype.rb > Puppet::Type.type(:testtype).provide do > desc "Test provider" > > def create > return true > end > def destroy > return true > end > def exists? > return true > end > end > --------------------------------------------- > # modules/test/manifests/init.pp > testtype { "testinstance": > ensure => present, > } > --------------------------------------------- > > My test machine downloads the plugins to the right location but > throws this error when it makes the catalog run: > err: //unix/test/Testtype[testinstance]: Failed to retrieve current > state of resource: No ability to determine if testtype exists > > If I skip the "ensurable" and provider steps and just dump the right > code into the newproperty(:ensure) do block, it works fine. > > What am I doing wrong here?It looks like your provider isn''t valid - you haven''t provided (heh) a name for it. My guess is that you''re using an older version of Puppet that''s not correctly showing the error that comes up with that code, so your type isn''t getting the provider which means it''s not seeing those methods. Try ''ruby -rpuppet </path/to/file>'' to make sure your provider works. -- Reality is that which, when you stop believing in it, doesn''t go away. -- Philip K. Dick, "How to Build a Universe" --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
S H
2009-Jul-22 18:13 UTC
[Puppet Users] Re: Newbie provider development: Failed to retrieve current state of resource
On Wed, Jul 22, 2009 at 1:59 PM, Luke Kanies <luke@madstop.com> wrote:> > On Jul 22, 2009, at 8:55 AM, S H wrote: > > > As I mentioned in another thread, I''m trying to work through the > > kinks in developing my own types/providers. I appear to be doing > > something very wrong, but I don''t know what. > > > > On my puppetmaster, I''ve got the following: > > > > --------------------------------------------- > > # modules/test/plugins/puppet/type/testtype.rb > > Puppet::Type.newtype(:testtype) do > > @doc = "A test type" > > ensurable > > > > newparam(:name, :namevar => true) do > > desc "The name" > > end > > end > > --------------------------------------------- > > # modules/test/plugins/puppet/provider/testtype.rb > > Puppet::Type.type(:testtype).provide do > > desc "Test provider" > > > > def create > > return true > > end > > def destroy > > return true > > end > > def exists? > > return true > > end > > end > > --------------------------------------------- > > # modules/test/manifests/init.pp > > testtype { "testinstance": > > ensure => present, > > } > > --------------------------------------------- > > > > My test machine downloads the plugins to the right location but > > throws this error when it makes the catalog run: > > err: //unix/test/Testtype[testinstance]: Failed to retrieve current > > state of resource: No ability to determine if testtype exists > > > > If I skip the "ensurable" and provider steps and just dump the right > > code into the newproperty(:ensure) do block, it works fine. > > > > What am I doing wrong here? > > It looks like your provider isn''t valid - you haven''t provided (heh) a > name for it. > > My guess is that you''re using an older version of Puppet that''s not > correctly showing the error that comes up with that code, so your type > isn''t getting the provider which means it''s not seeing those methods. > > Try ''ruby -rpuppet </path/to/file>'' to make sure your provider works. > > -- > Reality is that which, when you stop believing in it, doesn''t go > away. -- Philip K. Dick, "How to Build a Universe" > --------------------------------------------------------------------- > Luke Kanies | http://reductivelabs.com | http://madstop.comThis actually turned out to two issues. First, I didn''t name it. I wasn''t clear that the name was required and had removed it while testing to eliminate possible variables. Second, and the one that made it work once the name was in there, was the path. I had it at modules/test/plugins/puppet/provider/testtype.rb when there really needed to be a subdirectory under provider named after the type. So moving the provider under modules/test/plugins/puppet/provider/testtype/ made things happy. Is there somewhere in the documentation that the latter part is noted? If not, I''d be glad to add it to the wiki. -Shawn --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---