Hello all!
I am having trouble with custom types. I am simply trying to invoke a
provider function to learn how the "type" and "provider"
interact with
each other, but I keep getting the same error message of "Could not
find resource type filetest", with "filetest" being the resource
I am
trying to declare. Here is what I have:
/etc/puppet/puppet.conf
---------------------------------
[main]
vardir = /var/lib/puppet/
pluginsync = true
server = localhost.localdomain
reportdir = /etc/puppet/reports/
report = true
daemonize = false
/etc/puppet/manifests/modules.pp
---------------------------------
import "testClass"
/etc/puppet/manifests/nodes.pp
---------------------------------
node basenode { include testClass }
node ''localhost.localdomain'' inherits basenode {}
/etc/puppet/manifests/site.pp
---------------------------------
import "modules"
import "nodes"
/etc/puppet/modules/testClass/manifests/init.pp
---------------------------------
class testClass {
filetest { "/theTestFile":
ensure => insync,
file => "/testFile",
line => "This is a test line",
}
/etc/puppet/modules/testClass/plugins/puppet/type/filetest.rb
---------------------------------
module Puppet
newtype(:filetest) do
@doc = "Testing the new resource type"
newparam(:name) do
isnamevar
end
newparam(:file)
newparam(:line)
newproperty(:ensure) do
def retrieve do
:outofsync
end
newvalue :outofsync
provider.putline
end
newvalue :insync
end
end
end
/etc/puppet/modules/testClass/plugins/puppet/provider/filetest/
putfile.rb
---------------------------------
Puppet::Type.type(:filetest).provide :putfile do
def putline
File.open(@resource[:name]) { |f| f.puts "HELLO
\n" }
end
end
---------------------------------
And then when I run the puppetmasterd master and then puppetd client
with debug and trace options, I get the following below (it appears
that the resource isn''t even instantiated)?:
debug: Creating default schedules
debug: Failed to load library ''ldap'' for feature
''ldap''
debug: Failed to load library ''shadow'' for feature
''libshadow''
debug: /Settings[/etc/puppet/puppet.conf]/Settings[main]/File[/var/
lib/
puppet/state]: Autorequiring File[/var/lib/puppet]
debug: /Settings[/etc/puppet/puppet.conf]/Settings[main]/File[/var/
lib/
puppet/lib]: Autorequiring File[/var/lib/puppet]
debug: /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/etc/
puppet/ssl/private_keys/localhost.localdomain.pem]: Autorequiring File
[/etc/puppet/ssl/private_keys]
debug: /Settings[/etc/puppet/puppet.conf]/Settings[puppetd]/File[/etc/
puppet/puppet.conf]: Autorequiring File[/etc/puppet]
debug: /Settings[/etc/puppet/puppet.conf]/Settings[main]/File[/var/
lib/
puppet/log]: Autorequiring File[/var/lib/puppet]
debug: /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/etc/
puppet/ssl/csr_localhost.localdomain.pem]: Autorequiring File[/etc/
puppet/ssl]
debug: /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/etc/
puppet/ssl/certs/localhost.localdomain.pem]: Autorequiring File[/etc/
puppet/ssl/certs]
debug: /Settings[/etc/puppet/puppet.conf]/Settings[main]/File[/etc/
puppet/ssl]: Autorequiring File[/etc/puppet]
debug: /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/etc/
puppet/ssl/public_keys/localhost.localdomain.pem]: Autorequiring File
[/
etc/puppet/ssl/public_keys]
debug: /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/etc/
puppet/ssl/public_keys]: Autorequiring File[/etc/puppet/ssl]
debug: /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/etc/
puppet/ssl/certs]: Autorequiring File[/etc/puppet/ssl]
debug: /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/etc/
puppet/ssl/certs/ca.pem]: Autorequiring File[/etc/puppet/ssl/certs]
debug: /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/etc/
puppet/ssl/private]: Autorequiring File[/etc/puppet/ssl]
debug: /Settings[/etc/puppet/puppet.conf]/Settings[main]/File[/var/
lib/
puppet/run]: Autorequiring File[/var/lib/puppet]
debug: /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/etc/
puppet/ssl/private_keys]: Autorequiring File[/etc/puppet/ssl]
debug: Finishing transaction -606342368 with 0 changes
notice: Starting Puppet client version 0.24.8
debug: Puppet::Network::Client::File: defining fileserver.describe
debug: Puppet::Network::Client::File: defining fileserver.list
debug: Puppet::Network::Client::File: defining fileserver.retrieve
info: Retrieving plugins
debug: Calling fileserver.list
debug: /File[/var/lib/puppet/lib]/checksum: Initializing checksum hash
debug: /File[/var/lib/puppet/lib]: Creating checksum {mtime}Wed Apr 29
08:06:22 -0400 2009
debug: Calling fileserver.describe
debug: Calling fileserver.list
debug: /File[/var/lib/puppet/lib/puppet]/checksum: Initializing
checksum hash
debug: /File[/var/lib/puppet/lib/puppet]: Creating checksum {mtime}Wed
Apr 29 08:06:25 -0400 2009
debug: Calling fileserver.describe
debug: Calling fileserver.list
debug: /File[/var/lib/puppet/lib/puppet/provider]/checksum:
Initializing checksum hash
debug: /File[/var/lib/puppet/lib/puppet/provider]: Creating checksum
{mtime}Wed Apr 29 08:06:24 -0400 2009
debug: Calling fileserver.describe
debug: Calling fileserver.list
debug: /File[/var/lib/puppet/lib/puppet/provider/filetest]/checksum:
Initializing checksum hash
debug: /File[/var/lib/puppet/lib/puppet/provider/filetest]: Creating
checksum {mtime}Wed Apr 29 08:06:25 -0400 2009
debug: Calling fileserver.describe
debug: Calling fileserver.list
debug: /File[/var/lib/puppet/lib/puppet/provider/filetest/putfile.rb]/
checksum: Initializing checksum hash
debug: /File[/var/lib/puppet/lib/puppet/provider/filetest/putfile.rb]:
Creating checksum {md5}d142f8f6b5847de4522e468f66dab8ed
debug: Calling fileserver.describe
debug: Calling fileserver.list
debug: /File[/var/lib/puppet/lib/puppet/type]/checksum: Initializing
checksum hash
debug: /File[/var/lib/puppet/lib/puppet/type]: Creating checksum
{mtime}Wed Apr 29 08:06:26 -0400 2009
debug: Calling fileserver.describe
debug: /File[/var/lib/puppet/lib/puppet/type/filetest.rb~]: Changing
ensure
debug: /File[/var/lib/puppet/lib/puppet/type/filetest.rb~]: 1 change
(s)
debug: /File[/var/lib/puppet/lib/puppet/type/filetest.rb~]: Removing
existing file for replacement with absent
notice: /File[/var/lib/puppet/lib/puppet/type/filetest.rb~]/ensure:
removed
debug: Calling fileserver.list
debug: /File[/var/lib/puppet/lib/puppet/type/filetest.rb]/checksum:
Initializing checksum hash
debug: /File[/var/lib/puppet/lib/puppet/type/filetest.rb]: Creating
checksum {md5}0134dffa08117d6939e16bff404d5ef3
debug: Calling fileserver.describe
debug: /File[/var/lib/puppet/lib/puppet/type/filetest.rb]: Changing
source
debug: /File[/var/lib/puppet/lib/puppet/type/filetest.rb]: 1 change(s)
debug: Calling fileserver.retrieve
debug: /File[/var/lib/puppet/lib/puppet/type/filetest.rb]/checksum:
Replacing /var/lib/puppet/lib/puppet/type/filetest.rb checksum {md5}
0134dffa08117d6939e16bff404d5ef3 with {md5}
551d22f8581da011dd80f8070988a368
notice: /File[/var/lib/puppet/lib/puppet/type/filetest.rb]/source:
replacing from source
puppet://localhost.localdomain/plugins/puppet/type/filetest.rb
with contents {md5}551d22f8581da011dd80f8070988a368
debug: Finishing transaction -606167198 with 2 changes
debug: Retrieved facts in 0.55 seconds
debug: Retrieving catalog
debug: Calling puppetmaster.getconfig
err: Could not retrieve catalog: Could not find resource type filetest
at /etc/puppet/modules/testClass/manifests/init.pp:6 on node
localhost.localdomain
Any suggestions? Again, I''m only trying to create a default situation
where the provider is called and automatically creates and populates a
file with a given string in order to better understand how the
resource interacts with the provider.
Thank you!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---