summaryrefslogtreecommitdiff
path: root/fact.rb
diff options
context:
space:
mode:
authorKrzysztof Wilczynski <krzysztof.wilczynski@linux.com>2011-04-23 01:56:30 +0100
committerKrzysztof Wilczynski <krzysztof.wilczynski@linux.com>2011-04-23 01:56:30 +0100
commit0b1aab2ed584aa79c14531e5c3d1b0c8a6c00511 (patch)
tree2a722933f6be35c0b393f13c25329e9d64a79a49 /fact.rb
parent54b0d37bacb8b95f1b22aa97bd958ed798da9342 (diff)
Small changes. Mainly to formatting of the help provided.
Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
Diffstat (limited to 'fact.rb')
-rw-r--r--fact.rb37
1 files changed, 19 insertions, 18 deletions
diff --git a/fact.rb b/fact.rb
index 7d170c8..95213cc 100644
--- a/fact.rb
+++ b/fact.rb
@@ -4,42 +4,43 @@
module Puppet::Parser::Functions
newfunction(:fact, :type => :rvalue, :doc => <<-EOS
-This function will retrieve fact from Facter based on the fact name
-and expose it for further use within Puppet manifest file ...
+This function will retrieve fact from Facter based on the fact
+name and expose it for further use within Puppet manifest file ...
For example:
Given the following sample manifest:
- define partitions {
- $result = split(fact("partitions_${name}"), ',')
+ define partitions {
+ $result = split(fact("partitions_${name}"), ',')
- notice $result
+ notice $result
- partition { $result: }
- }
+ partition { $result: }
+ }
- define partition {
- notice $name
- }
+ define partition {
+ notice $name
+ }
- $available_disks = split($disks, ',')
+ $available_disks = split($disks, ',')
- partitions { $available_disks: }
+ partitions { $available_disks: }
This will produce the following:
- notice: Scope(Partitions[hda]): hda1 hda2
- notice: Scope(Partition[hda1]): hda1
- notice: Scope(Partition[hda2]): hda2
+ notice: Scope(Partitions[hda]): hda1 hda2
+ notice: Scope(Partition[hda1]): hda1
+ notice: Scope(Partition[hda2]): hda2
Which allows you to avoid resorting to the following:
- $fact = "partitions_${name}"
- $result = split(inline_template("<%= scope.lookupvar(fact) %>"), ',')
+ $fact = "partitions_${name}"
+ $result = split(inline_template("<%= scope.lookupvar(fact) %>"), ',')
-Taking out the need for using "inline_template" in the "partitions" define above.
+Phasing out the need for use and abuse of the infamous inline_template in the
+partitions define given above.
EOS
) do |arguments|