Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Fact.new(:databases) do
setcode do
output = Facter::Util::Resolution.exec('pgsql listdb')
if $?.success?
{
status: :ok,
list: output.split("\n")
}
else:
raise output
end
rescue e
{
status: e,
list: []
}
end
end
# databases.status: ok
# databases.list: ['acme', 'foo']
# databases.status: Brak polaczenia do bazy
# databases.list: []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.