summaryrefslogtreecommitdiffstats
path: root/lib/puppet/reference
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/reference')
-rw-r--r--lib/puppet/reference/providers.rb36
1 files changed, 32 insertions, 4 deletions
diff --git a/lib/puppet/reference/providers.rb b/lib/puppet/reference/providers.rb
index 80282b9bc..336f191dc 100644
--- a/lib/puppet/reference/providers.rb
+++ b/lib/puppet/reference/providers.rb
@@ -1,5 +1,5 @@
# This doesn't get stored in trac, since it changes every time.
-providers = Puppet::Util::Reference.newreference :providers, :dynamic => true, :doc => "Which providers are valid for this machine" do
+providers = Puppet::Util::Reference.newreference :providers, :depth => 1, :dynamic => true, :doc => "Which providers are valid for this machine" do
types = []
Puppet::Type.loadall
Puppet::Type.eachtype do |klass|
@@ -8,9 +8,22 @@ providers = Puppet::Util::Reference.newreference :providers, :dynamic => true, :
end
types.sort! { |a,b| a.name.to_s <=> b.name.to_s }
- ret = ""
+ unless ARGV.empty?
+ types.reject! { |type| ! ARGV.include?(type.name.to_s) }
+ end
+
+ ret = "Details about this host:\n\n"
+
+ # Throw some facts in there, so we know where the report is from.
+ ["Ruby Version", "Puppet Version", "Operating System", "Operating System Release"].each do |label|
+ name = label.gsub(/\s+/, '')
+ value = Facter.value(name)
+ ret += option(label, value)
+ end
+ ret += "\n"
types.each do |type|
- ret += h(type.name, 2)
+ ret += h(type.name.to_s + "_", 2)
+ ret += ".. _%s: %s\n\n" % [type.name, "http://reductivelabs.com/trac/puppet/wiki/TypeReference#%s" % type.name]
features = type.features
unless features.empty?
ret += option("Available Features", features.collect { |f| f.to_s }.sort.join(", "))
@@ -23,10 +36,25 @@ providers = Puppet::Util::Reference.newreference :providers, :dynamic => true, :
unless features.empty?
ret += option(:features, provider.features.collect { |a| a.to_s }.sort.join(", "))
end
- if provider.suitable?
+ if missing = provider.suitable?(false) and missing.empty?
ret += option(:suitable?, "true")
else
ret += option(:suitable?, "false")
+ ret += "\n" # must add a blank line before the list
+ missing.each do |test, values|
+ case test
+ when :exists:
+ ret += "- Missing files %s\n" % values.join(", ")
+ when :facter:
+ values.each do |name, facts|
+ ret += "- Fact %s (currently %s) not in list %s\n" % [name, Facter.value(name).inspect, facts.join(", ")]
+ end
+ when :true:
+ ret += "- Got %s true tests that should have been false\n" % values
+ when :false:
+ ret += "- Got %s false tests that should have been true\n" % values
+ end
+ end
end
ret += "\n" # add a trailing newline
end