summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-09-21 19:43:45 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-09-21 19:43:45 +0000
commit9afdf1fa429cd5f81f68d27e172af208d6118e22 (patch)
treec0d31891ab7f87fd5753bfab9b058b156d1b5bf3
parent1ae434461d074dc859f768776af3934b66282d07 (diff)
downloadpuppet-9afdf1fa429cd5f81f68d27e172af208d6118e22.tar.gz
puppet-9afdf1fa429cd5f81f68d27e172af208d6118e22.tar.xz
puppet-9afdf1fa429cd5f81f68d27e172af208d6118e22.zip
Adding an Autoload instance to Type.rb so that I can load all known types for documentation purposes. And, of course, loading all types in puppetdoc. Also updating zone.rb to fix markdown's stupidity in trying to interpret the ERB template, and adding some timeouts to puppettest.rb
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1651 980ebf18-57e1-0310-9a29-db15c13687c0
-rwxr-xr-xbin/puppetdoc5
-rw-r--r--lib/puppet/type.rb20
-rw-r--r--lib/puppet/type/zone.rb16
-rw-r--r--test/lib/puppettest.rb10
4 files changed, 40 insertions, 11 deletions
diff --git a/bin/puppetdoc b/bin/puppetdoc
index 3b3d2babb..8185ed773 100755
--- a/bin/puppetdoc
+++ b/bin/puppetdoc
@@ -89,6 +89,9 @@ rescue GetoptLong::InvalidOption => detail
end
def scrub(text)
+
+ # Stupid markdown
+ #text = text.gsub("<%=", "&lt;%=")
# For text with no carriage returns, there's nothing to do.
if text !~ /\n/
return text
@@ -191,6 +194,8 @@ orderInfo: 4
}
types = {}
+ Puppet::Type.loadall
+
Puppet::Type.eachtype { |type|
next if type.name == :puppet
next if type.name == :component
diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb
index 0e0628202..13caf1973 100644
--- a/lib/puppet/type.rb
+++ b/lib/puppet/type.rb
@@ -128,6 +128,11 @@ class Type < Puppet::Element
end
+ # Load all types. Only currently used for documentation.
+ def self.loadall
+ typeloader.loadall
+ end
+
# Do an on-demand plugin load
def self.loadplugin(name)
unless Puppet[:pluginpath].split(":").include?(Puppet[:plugindest])
@@ -213,12 +218,11 @@ class Type < Puppet::Element
end
unless @types.include? name
- begin
- require "puppet/type/#{name}"
+ if typeloader.load(name)
unless @types.include? name
Puppet.warning "Loaded puppet/type/#{name} but no class was created"
end
- rescue LoadError => detail
+ else
# If we can't load it from there, try loading it as a plugin.
loadplugin(name)
end
@@ -227,6 +231,16 @@ class Type < Puppet::Element
@types[name]
end
+ def self.typeloader
+ unless defined? @typeloader
+ @typeloader = Puppet::Autoload.new(self,
+ "puppet/type", :wrap => false
+ )
+ end
+
+ @typeloader
+ end
+
# class methods dealing with type instance management
public
diff --git a/lib/puppet/type/zone.rb b/lib/puppet/type/zone.rb
index de94e51ca..c882e199c 100644
--- a/lib/puppet/type/zone.rb
+++ b/lib/puppet/type/zone.rb
@@ -287,21 +287,23 @@ end
desc %{The text to go into the sysidcfg file when the zone is first
booted. The best way is to use a template:
+ <pre><code>
# $templatedir/sysidcfg
system_locale=en_US
timezone=GMT
terminal=xterms
security_policy=NONE
- root_password=<%= password %>
+ root_password=&lt;%= password %>
timeserver=localhost
- name_service=DNS {domain_name=<%= domain %>
- name_server=<%= nameserver %>}
- network_interface=primary {hostname=<%= realhostname %>
- ip_address=<%= ip %>
- netmask=<%= netmask %>
+ name_service=DNS {domain_name=&lt;%= domain %>
+ name_server=&lt;%= nameserver %>}
+ network_interface=primary {hostname=&lt;%= realhostname %>
+ ip_address=&lt;%= ip %>
+ netmask=&lt;%= netmask %>
protocol_ipv6=no
- default_route=<%= defaultroute %>}
+ default_route=&lt;%= defaultroute %>}
nfs4_domain=dynamic
+ </code></pre>
And then call that:
diff --git a/test/lib/puppettest.rb b/test/lib/puppettest.rb
index bff410060..4fa7a676f 100644
--- a/test/lib/puppettest.rb
+++ b/test/lib/puppettest.rb
@@ -179,7 +179,15 @@ module PuppetTest
Puppet::Log.close
# Just in case there are processes waiting to die...
- Process.waitall
+ require 'timeout'
+
+ begin
+ Timeout::timeout(5) do
+ Process.waitall
+ end
+ rescue Timeout::Error
+ # just move on
+ end
if File.stat("/dev/null").mode & 007777 != 0666
File.open("/tmp/nullfailure", "w") { |f|
f.puts self.class