Skip to content

Instantly share code, notes, and snippets.

@b4ldr
Last active February 21, 2020 17:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save b4ldr/c2d55d5354f755ba3ddc1896d1119ead to your computer and use it in GitHub Desktop.
Save b4ldr/c2d55d5354f755ba3ddc1896d1119ead to your computer and use it in GitHub Desktop.
~ $ grep -v ^# test.pp
$loc = 'ab1'
$arr = ['foo-ab1', 'bar-ab1', 'foo-ab1bar', 'bar-ab1$', 'foo-xz1', 'bar-xz1']
$new_arr = $arr.filter |$items| { $items !~ "-${loc}$" }
notify {$new_arr:}
~ $ puppet apply test.pp
Notice: Compiled catalog for work-laptop.home.arpa in environment production in 0.02 seconds
Notice: foo-ab1bar
Notice: /Stage[main]/Main/Notify[foo-ab1bar]/message: defined 'message' as 'foo-ab1bar'
Notice: bar-ab1$
Notice: /Stage[main]/Main/Notify[bar-ab1$]/message: defined 'message' as 'bar-ab1$'
Notice: foo-xz1
Notice: /Stage[main]/Main/Notify[foo-xz1]/message: defined 'message' as 'foo-xz1'
Notice: bar-xz1
Notice: /Stage[main]/Main/Notify[bar-xz1]/message: defined 'message' as 'bar-xz1'
Notice: Applied catalog in 0.02 seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment