addnode is thought to be used by the `add` command only.
So check if STDIN or STOUT are connected to a tty and exit with an
error message if this is the case.
The force flag allows overwriting this check.
Fixes bug #294
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
code => sub {
my ($param) = @_;
+ if (!$param->{force} && (-t STDIN || -t STDOUT)) {
+ die "error: `addnode` should not get called interactively!\nUse ".
+ "`pvecm add <cluster-node>` to add a node to a cluster!\n";
+ }
+
PVE::Cluster::check_cfs_quorum();
my $conf = PVE::Cluster::cfs_read_file("corosync.conf");