...and change $silent to $noerr for consistency.
Commit
3df092f9 (fix #1380: pvecm status: add general cluster
information) broke "pvecm status" on non-cluster nodes (well, it made
the error look worse, ofc it didn't "work" before either) because it
tries to access a totem that cannot exist without a corosync.conf.
pvecm status/nodes/expected already fail without a cluster, so it makes
more sense to fail early. But instead of copying the way the qdevice API
handles it, move the die to check_conf_exists directly, which makes
more sense then a warn anyway IMHO.
check_conf_exists is never called without $noerr = 1 outside of
pvecm.pm, so this change does not require any versioned depends/breaks.
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
code => sub {
my ($param) = @_;
- die "Node not in a cluster. Aborting.\n"
- if !PVE::Corosync::check_conf_exists(1);
+ PVE::Corosync::check_conf_exists();
my $members = PVE::Cluster::get_members();
foreach my $node (sort keys %$members) {
code => sub {
my ($param) = @_;
- die "Node not in a cluster. Aborting.\n"
- if !PVE::Corosync::check_conf_exists(1);
+ PVE::Corosync::check_conf_exists();
my $members = PVE::Cluster::get_members();
foreach my $node (sort keys %$members) {
\&write_conf);
sub check_conf_exists {
- my ($silent) = @_;
-
- $silent = $silent // 0;
+ my ($noerr) = @_;
my $exists = -f "$basedir/corosync.conf";
- warn "Corosync config '$basedir/corosync.conf' does not exist - is this node part of a cluster?\n"
- if !$silent && !$exists;
+ die "Error: Corosync config '$basedir/corosync.conf' does not exist - is this node part of a cluster?\n"
+ if !$noerr && !$exists;
return $exists;
}