diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-05-07 22:29:44 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-05-07 22:29:44 +0000 |
commit | 1decfa31a588bc46249c89680c80f74e14183ab1 (patch) | |
tree | 0f67d5aa595bb8763ac889db7327f90482b11909 /lib/puppet/reference | |
parent | 69cb72120ced589b81038f685f9765ceb353e062 (diff) | |
download | puppet-1decfa31a588bc46249c89680c80f74e14183ab1.tar.gz puppet-1decfa31a588bc46249c89680c80f74e14183ab1.tar.xz puppet-1decfa31a588bc46249c89680c80f74e14183ab1.zip |
Lots of work related to generating more reference. Moving all of the individual references out of puppetdoc and into an external "reference" class, which itself can autoload, so it is now easy to add new types of references. Also adding a network reference, along with an unfinished provider reference.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2479 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/reference')
-rw-r--r-- | lib/puppet/reference/network.rb | 33 | ||||
-rw-r--r-- | lib/puppet/reference/providers.rb | 49 |
2 files changed, 82 insertions, 0 deletions
diff --git a/lib/puppet/reference/network.rb b/lib/puppet/reference/network.rb new file mode 100644 index 000000000..32a1fdd89 --- /dev/null +++ b/lib/puppet/reference/network.rb @@ -0,0 +1,33 @@ +network = Puppet::Util::Reference.newreference :network, :depth => 2, :doc => "Available network handlers and clients" do + ret = "" + Puppet::Network::Handler.subclasses.each do |name| + handler = Puppet::Network::Handler.handler(name) + + next if ! handler.doc or handler.doc == "" + + interface = handler.interface + + ret += h(name, 2) + + ret += scrub(handler.doc) + ret += "\n\n" + ret += option(:prefix, interface.prefix) + ret += option(:side, handler.side.to_s.capitalize) + ret += option(:methods, interface.methods.collect { |ary| ary[0] }.join(", ") ) + ret += "\n\n" + end + + ret +end + +network.header = " +This is a list of all Puppet network interfaces. Each interface is +implemented in the form of a client and a handler; the handler is loaded +on the server, and the client knows how to call the handler's methods +appropriately. + +Most handlers are meant to be started on the server, usually within +``puppetmasterd``, and the clients are mostly started on the client, +usually within ``puppetd``. + +" diff --git a/lib/puppet/reference/providers.rb b/lib/puppet/reference/providers.rb new file mode 100644 index 000000000..2d9d7f8cb --- /dev/null +++ b/lib/puppet/reference/providers.rb @@ -0,0 +1,49 @@ +providers = Puppet::Util::Reference.newreference :providers, :doc => "Which providers are valid for this machine" do + types = [] + Puppet::Type.loadall + Puppet::Type.eachtype do |klass| + next unless klass.providers.length > 0 + types << klass + end + types.sort! { |a,b| a.name.to_s <=> b.name.to_s } + + ret = "" + types.each do |type| + ret += h(type.name, 2) + features = type.features + unless features.empty? + ret += option("Available Features", features.collect { |f| f.to_s }.sort.join(", ")) + end + ret += "\n" # add a trailing newline + type.providers.sort { |a,b| a.to_s <=> b.to_s }.each do |pname| + provider = type.provider(pname) + ret += h(provider.name, 3) + + unless features.empty? + ret += option(:features, provider.features.collect { |a| a.to_s }.sort.join(", ")) + end + if provider.suitable? + ret += option(:suitable?, "true") + else + ret += option(:suitable?, "false") + end + ret += "\n" # add a trailing newline + end + ret += "\n" + end + + ret += "\n" + + ret +end +providers.header = " +Puppet resource types are usually backed by multiple implementations called ``providers``, +which handle variance between platforms and tools. + +Different providers are suitable or unsuitable on different platforms based on things +like the presence of a given tool. + +Here are all of the provider-backed types and their different providers. Any unmentioned +types do not use providers yet. + +" |