Commit d09868b3 authored by Christoph Berg's avatar Christoph Berg

pg_lsclusters: Raise error when called on a specific cluster that does not exist

This was the behavior before the "accept dead postgresql.conf symlinks" change,
but not coded explicitly.
parent fe99ddcd
postgresql-common (188) UNRELEASED; urgency=medium
* dh_make_pgxs: Add options to set package name and version.
* pg_lsclusters: Raise error when called on a specific cluster that does not
exist. This was the behavior before the "accept dead postgresql.conf
symlinks" change, but not coded explicitly.
-- Christoph Berg <myon@debian.org> Sun, 29 Oct 2017 18:38:33 +0100
......
......@@ -42,6 +42,9 @@ if (@ARGV >= 2 and $ARGV[1] =~ /^([-.\w]+)$/) {
$ls_cluster = $1;
}
error "Cluster @versions $ls_cluster does not exist"
if ($ls_cluster and not cluster_exists(@versions, $ls_cluster));
# data collection
my @lines;
push @lines, ['Ver', 'Cluster', 'Port', 'Status', 'Owner', 'Data directory', 'Log file']
......
......@@ -6,7 +6,7 @@ require File::Temp;
use lib 't';
use TestLib;
use Test::More tests => 146;
use Test::More tests => 149;
use PgCommon;
my $version = $MAJORS[-1];
......@@ -278,6 +278,7 @@ ok_dir $socketdir, [], 'No sockets any more';
rmdir $socketdir or die "rmdir: $!";
# ensure sane error messages for nonexisting clusters
check_nonexisting_cluster_error 'pg_lsclusters 4.5 foo';
check_nonexisting_cluster_error 'psql --cluster 4.5/foo';
check_nonexisting_cluster_error "psql --cluster $MAJORS[0]/foo";
check_nonexisting_cluster_error "pg_dropcluster 4.5 foo";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment