Else only the first error got reported and we had no idea what else was possible wrong.
I'll also use the $err method more in next commits Signed-off-by: Thomas Lamprecht <t.lampre...@proxmox.com> --- data/PVE/CLI/pvecm.pm | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/data/PVE/CLI/pvecm.pm b/data/PVE/CLI/pvecm.pm index e4de650..df94c2e 100755 --- a/data/PVE/CLI/pvecm.pm +++ b/data/PVE/CLI/pvecm.pm @@ -504,26 +504,41 @@ __PACKAGE__->register_method ({ my $host = $param->{hostname}; + my ($errors, $warnings) = ('', ''); + + my $error = sub { + my ($msg, $suppress) = @_; + + if ($suppress) { + $warnings .= "* $msg\n"; + } else { + $errors .= "* $msg\n"; + } + }; + if (!$param->{force}) { if (-f $authfile) { - die "authentication key already exists\n"; + &$error("authentication key '$authfile' already exists", $param->{force}); } if (-f $clusterconf) { - die "cluster config '$clusterconf' already exists\n"; + &$error("cluster config '$clusterconf' already exists", $param->{force}); } my $vmlist = PVE::Cluster::get_vmlist(); if ($vmlist && $vmlist->{ids} && scalar(keys %{$vmlist->{ids}})) { - die "this host already contains virtual machines - please remove them first\n"; + &$error("this host already contains virtual guests", $param->{force}); } if (system("corosync-quorumtool -l >/dev/null 2>&1") == 0) { - die "corosync is already running\n"; + &$error("corosync is already running, is this node already in a cluster?!", $param->{force}); } } + warn "warning, ignore the following errors:\n$warnings" if $warnings; + die "detected the following error(s):\n$errors" if $errors; + # make sure known_hosts is on local filesystem PVE::Cluster::ssh_unmerge_known_hosts(); -- 2.1.4 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel