Skip to content

Instantly share code, notes, and snippets.

@hlindberg
Created March 8, 2016 17:17
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 hlindberg/3ee308e5470b98f563c7 to your computer and use it in GitHub Desktop.
Save hlindberg/3ee308e5470b98f563c7 to your computer and use it in GitHub Desktop.
$limited_sudo = hiera('staff::allowed::sudo', undef)
if ( $limited_sudo ) {
$allowed_sudo = $limited_sudo.reduce( false ) |$allowed_sudo, $entry[ {
$team = $entry[1]
case [$allowed_sudo, $team, $username in hiera($team)] {
[ false, /::team::/, true] : {
warning ("Allowing sudo")
warning ("1: true")
true
}
default : {
$allowed_sudo
}
}
}
}
warning ("2: $allowed_sudo")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment