class Inspec::Resources::Postgres
def cluster_from_dir(dir)
def cluster_from_dir(dir) # Main is the default cluster name on debian use it if it # exists. if inspec.directory("#{dir}/main").exist? 'main' else dirs = inspec.command("ls -d #{dir}/*/").stdout.lines first = dirs.first.chomp.split('/').last if dirs.count > 1 warn "Multiple postgresql clusters configured or incorrect base dir #{dir}" warn "Using the first directory found: #{first}" end first end end