On Thursday, December 8, 2011 at 10:02 AM, Greg Hellings wrote:
> Without the "newproperty(:provider)" I receive this message:
> 
> err: Could not run Puppet configuration client: Could not find a default 
> provider for rvmgem
> 
Ah, I suspect that your command for gemcmd needs to be only the command name. 
It's most likely trying to validate the existence of a command called "su - 
rvmuser -c", which of course doesn't exist. That makes the provider unsuitable, 
and so there is no usable (and therefore no default) provider. If you change 
the command to just "su", it should work, although then you may want to wrap 
gemcmd in another method that adds the other arguments.

> On Thu, Dec 8, 2011 at 9:52 AM, Nick Lewis <[email protected] 
> (mailto:[email protected])> wrote:
> > On Thursday, December 8, 2011 at 9:44 AM, ghellings wrote:
> > > I've been trying to create a custom provider and I keep running into
> > > the same error
> > > err: /Stage[main]/Rvmspokeo::Install/Rvmgem[gearman-ruby]: Could not
> > > evaluate: No ability to determine if rvmgem exists
> > > 
> > > My type and provider seem pretty straight forward to me, what am I 
> > > doing wrong?
> > > 
> > > lib/puppet/type/rvmgem.rb
> > > 
> > > Puppet::Type.newtype(:rvmgem) do
> > > @doc = "Manage RVM Gems"
> > > ensurable
> > > newproperty(:provider) do
> > > desc "Provider from gem"
> > > newvalue(:gem)
> > > end
> > > newparam(:name) do
> > > desc "Name of gem"
> > > isnamevar
> > > end
> > > newparam(:version) do
> > > desc "Version of gem"
> > > end
> > > end
> > > 
> > > lib/puppet/provider/rvmgem/gem.rb
> > > 
> > > Puppet::Type.type(:rvmgem).provide(:gem) do
> > > desc "Provides RVM Gem support"
> > > commands :gemcmd => "su - rvmuser -c"
> > > def exists?
> > > if resource[:version].empty?
> > > gemcmd "'gem query -n #{resource[:gem]} -i'"
> > > else
> > > gemcmd "'gem query -n #{resource[:gem]} -v #{resource[:version]}
> > > -i'"
> > > end
> > > return true
> > > end
> > > def create
> > > if resource[:version].empty?
> > > gemcmd "'gem install #{resource[:gem]}'"
> > > else
> > > gemcmd "'gem install #{resource[:gem]} -v
> > > #{resource[:version]}'"
> > > end
> > > end
> > > def destroy
> > > gemcmd "'gem uninstall #{resource[:gem]}'"
> > > end
> > > end
> > > 
> > > --
> > > Greg
> > > 
> > 
> > You don't need to explicitly specify newproperty(:provider). There is a 
> > default provider parameter which is added when you create a provider for 
> > the type. That default parameter handles making the provider available via 
> > resource.provider (rather than the usual resource[:provider]), which is how 
> > the default ensure property interacts with it. So currently Puppet doesn't 
> > realize your type has a provider as Puppet understand providers. Other than 
> > that, your code looks fine. Remove the provider property, and it should 
> > work. 
> > > -- 
> > > 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] 
> > > (mailto:[email protected]).
> > > To unsubscribe from this group, send email to 
> > > [email protected] 
> > > (mailto:[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] 
> > (mailto:[email protected]).
> > To unsubscribe from this group, send email to 
> > [email protected] 
> > (mailto:puppet-dev%[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] 
> (mailto:[email protected]).
> To unsubscribe from this group, send email to 
> [email protected] 
> (mailto:[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