From: Thomas Lamprecht Date: Wed, 22 Feb 2017 15:59:07 +0000 (+0100) Subject: pvecm addnode: error out on interactive call X-Git-Url: https://git.proxmox.com/?p=pve-cluster.git;a=commitdiff_plain;h=e73b85c0b99cd4da32ed5e3a76e5c8574a956bff pvecm addnode: error out on interactive call 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 --- diff --git a/data/PVE/CLI/pvecm.pm b/data/PVE/CLI/pvecm.pm index 294486f..c3f7905 100755 --- a/data/PVE/CLI/pvecm.pm +++ b/data/PVE/CLI/pvecm.pm @@ -301,6 +301,11 @@ __PACKAGE__->register_method ({ code => sub { my ($param) = @_; + if (!$param->{force} && (-t STDIN || -t STDOUT)) { + die "error: `addnode` should not get called interactively!\nUse ". + "`pvecm add ` to add a node to a cluster!\n"; + } + PVE::Cluster::check_cfs_quorum(); my $conf = PVE::Cluster::cfs_read_file("corosync.conf");