]> gitweb.fluxo.info Git - puppet-stdlib.git/commitdiff
Small changes. Mainly to formatting of the help provided.
authorKrzysztof Wilczynski <krzysztof.wilczynski@linux.com>
Sat, 23 Apr 2011 00:56:30 +0000 (01:56 +0100)
committerKrzysztof Wilczynski <krzysztof.wilczynski@linux.com>
Sat, 23 Apr 2011 00:56:30 +0000 (01:56 +0100)
Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
fact.rb
load_variables.rb

diff --git a/fact.rb b/fact.rb
index 7d170c87ce68a659348822875621aef4be84e737..95213cc6adaba5fc835bbf7976e05397723063ff 100644 (file)
--- 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|
 
index a6ccc608a6e280718653e890d196fb1ced1427cc..a5eb269c8e45a5c1cb3f9a8ff9ba344e5bf7b40d 100644 (file)
@@ -11,19 +11,19 @@ For example:
 
 Given following content of the data.yaml file:
 
-  ---
-  host1.example.com:
-    foo: bar
-    baz: quux
-    question: 42
-  host2.example.com:
-    abc: def
-    this: that
-    darth: vader
+   ---
+   host1.example.com:
+     foo: bar
+     baz: quux
+     question: 42
+   host2.example.com:
+     abc: def
+     this: that
+     darth: vader
 
 Then calling load_variables in Puppet manifest file as follows:
 
-  load_variables("/etc/puppet/data.yaml", $fqdn)
+   load_variables("/etc/puppet/data.yaml", $fqdn)
 
 Will result in addition of variables $foo, $baz and $question
 for matching host name as per the variable $fqdn ...
@@ -32,12 +32,12 @@ Another example which uses per-host file:
 
 Given following content of the file data-host1.example.com.yaml:
 
-  ---
-  foo: bar
+   ---
+   foo: bar
 
 Then when we call load_variables like this:
 
-  load_variables("/etc/puppet/data-$fqdn.yaml")
+   load_variables("/etc/puppet/data-$fqdn.yaml")
 
 This will result in a variable $foo being added and ready for use.
     EOS