Advertisement
Guest User

Untitled

a guest
Mar 5th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Puppet 0.74 KB | None | 0 0
  1. =======================
  2. old way (in module):
  3. =======================
  4. paramp.pp:
  5. class myclass::params {
  6.   $myparam = 'hello'
  7. }
  8.  
  9. init.pp:
  10. class myclass (
  11.   $myparam = hiera('myclass::myparam', myclass::params::myparam),
  12. ) inherits myclass::params {
  13. *snip*
  14. }
  15.  
  16. =======================
  17. new way (in module):
  18. =======================
  19. hiera.yaml:
  20. version: 5
  21. data_dir: data
  22. data_hash: yaml_data
  23. hierarchy:
  24.   - name: 'common'
  25.     path: 'common.yaml'
  26.  
  27. data/common.yaml:
  28. myclass::myparam: 'hello'
  29.  
  30. init.pp:
  31. class myclass (
  32.   String $myparam = lookup('myclass::myparam')
  33. ) {
  34. *snip*
  35. }
  36.  
  37. myparam will always cause failure or be undef here, even if i pass default_value to lookup since i cannot grab
  38. the data from hiera module data again?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement