From 32a6fb29b05d0df233a83982d48b7448d97f48eb Mon Sep 17 00:00:00 2001 From: Reid Vandewiele Date: Fri, 21 Jul 2017 12:16:36 -0700 Subject: Update README for fact() function --- README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index b92c226..2b1e005 100644 --- a/README.md +++ b/README.md @@ -895,6 +895,31 @@ userlist: ensure_resources('user', hiera_hash('userlist'), {'ensure' => 'present'}) ``` +#### `fact` + +Return the value of a given fact. Supports the use of dot-notation for referring to structured facts. If a fact requested does not exist, returns Undef. + +Example usage: + +```puppet +fact('kernel') +fact('osfamily') +fact('os.architecture') +``` + +Array indexing: + +```puppet +$first_processor = fact('processors.models.0') +$second_processor = fact('processors.models.1') +``` + +Fact containing a "." in the fact name: + +```puppet +fact('vmware."VRA.version"') +``` + #### `flatten` Flattens deeply nested arrays and returns a single flat array as a result. -- cgit v1.2.3