Skip to content

Instantly share code, notes, and snippets.

@hunner
Created May 18, 2017 17:59
Show Gist options
  • Save hunner/a324bd9588d1cf4e14eb506fbdb00d0b to your computer and use it in GitHub Desktop.
Save hunner/a324bd9588d1cf4e14eb506fbdb00d0b to your computer and use it in GitHub Desktop.
include postgresql::server
# fails because you can't override from outside a class
Fail['/var/lib/postgresql9.5/datadir'] {
mode => '0755',
}
# succeeds because inheritance lets you override, but inheritance is spaghetti code
class test inherits postgresql::server::initdb {
File['/var/lib/postgresql9.5/datadir'] {
mode => '0755',
}
}
# works because collectors can directly modify resource declarations; super hacky but less spaghetti
File <| title == '/var/lib/postgresql9.5/datadir' |> {
mode => '0755',
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment