]> git.proxmox.com Git - pve-cluster.git/blobdiff - data/PVE/API2/ClusterConfig.pm
api: join info: return explicit error code for no-cluster
[pve-cluster.git] / data / PVE / API2 / ClusterConfig.pm
index df3332d21c9588d2815e6a637562377de30f1b16..8f4a5bbe88e18d668bba64dcf8263a823d6aeaa9 100644 (file)
@@ -546,8 +546,11 @@ __PACKAGE__->register_method ({
        PVE::Cluster::cfs_update(1);
        my $conf = PVE::Cluster::cfs_read_file('corosync.conf');
 
-       die "node is not in a cluster, no join info available!\n"
-           if !($conf && $conf->{main});
+       # FIXME: just return undef or empty object in PVE 8.0 (check if manager can handle it!)
+       PVE::Exception::raise(
+           'node is not in a cluster, no join info available!',
+           code => HTTP::Status::HTTP_FAILED_DEPENDENCY,
+       ) if !($conf && $conf->{main});
 
        my $totem_cfg = $conf->{main}->{totem} // {};
        my $nodelist = $conf->{main}->{nodelist}->{node} // {};