Hi, I'm on my first attempt of writing a custom type/provider and hope to learn on the process. I'm got a stumbling block and lost on what's going with this as I have defined the exist? method which apparently the usual suspect for this error.
puppet resource tsam_host 'wakwak' ip='192.168.20.1' ensure=present Error: /Tsam_host[wakwak]: Could not evaluate: No ability to determine if tsam_host exists Error: Could not run: No ability to determine if tsam_host exists modules/tsam/lib/puppet/provider/tsam_host/ruby.rb Puppet::Type.type(:tsam_host).provide(:ruby) do header = ':content_type => :json, :accept => :json' baseurl = 'https://xxx.xxxx@172.16.210.10' host_uri = '/isam/host_records' deploy_uri = '/pending_changes/deploy' def exist? ip = resource[:ip] begin response = RestClient.get "#{baseurl}#{host_uri}/#{ip}/hostnames",header exit if response.code == 200 rescue Puppet::ExecutionFailure => e exit! end end def create host = resource[:name] ip = resource[:ip] postdata = '{ "addr" => ip, "hostnames" => [{ host }]}' RestClient.post "#{baseurl}#{host_uri}", postdata.to_json, header RestClient.get "#{baseurl}#{deploy_uri}",header end def destroy end end /modules/tsam/lib/puppet/type$ cat tsam_host.rb Puppet::Type.newtype(:tsam_host) do desc 'Create hostname/ip mapping( hostfile ) entry on Access Manager Appliance Web Service API' ensurable newproperty(:ip) do desc 'The IPV4 address of the host to be added' end newparam(:name, :namevar => true) do desc 'The host name.' end end Appreciate for any pointers. Lupin -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/b05738a5-719b-4843-96d3-f61c3363bde2%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.