diff options
author | Hunter Haugen <hunter@puppet.com> | 2017-07-21 14:46:19 -0700 |
---|---|---|
committer | Hunter Haugen <hunter@puppet.com> | 2017-07-21 14:46:19 -0700 |
commit | 4a658957db669efef666feb61b5d5c1406d105e9 (patch) | |
tree | 3d77a55c797847e63ca50995e943b62f54395c00 | |
parent | 539ba5d8a78f0f41736d605e0027ef61113ed515 (diff) | |
parent | 32a6fb29b05d0df233a83982d48b7448d97f48eb (diff) |
Merge pull request #797 from reidmv/fact_function
Update README for fact() function
-rw-r--r-- | README.md | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -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. |