summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaurav Sinha <gaurav.sinha@vyatta.com>2012-11-17 00:34:54 -0800
committerGaurav Sinha <gaurav.sinha@vyatta.com>2012-11-19 10:24:45 -0800
commitfffe09f9d7a53d5d74bae6bafc2c7b7409a4babf (patch)
treef3b8097ba41868fe2bcecfbce21145945928f758
parent2c2cd1aef9eada852084ecebb3c76e468cc56a2a (diff)
downloadvyatta-cfg-firewall-fffe09f9d7a53d5d74bae6bafc2c7b7409a4babf.tar.gz
vyatta-cfg-firewall-fffe09f9d7a53d5d74bae6bafc2c7b7409a4babf.zip
Add warning prompt before doing reset
(cherry picked from commit 3d248225eecc99e3e39c497f3a4bd76d5d3aac96)
-rwxr-xr-xscripts/firewall/vyatta-ipset.pl14
1 files changed, 13 insertions, 1 deletions
diff --git a/scripts/firewall/vyatta-ipset.pl b/scripts/firewall/vyatta-ipset.pl
index 99ae085..0f8c27e 100755
--- a/scripts/firewall/vyatta-ipset.pl
+++ b/scripts/firewall/vyatta-ipset.pl
@@ -32,13 +32,25 @@ use Vyatta::TypeChecker;
use Vyatta::Misc;
use Vyatta::IpTables::IpSet;
use Sort::Versions;
+use IO::Prompt;
use warnings;
use strict;
+
+sub warn_before_reset {
+ if (prompt("This can be temporarily disruptive: Proceed with reset? (Yes/No) [No] ", -ynd=>"n")) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
sub ipset_reset {
my ($set_name, $set_type) = @_;
-
+ if (!warn_before_reset()) {
+ die "Cancelling reset\n";
+ }
my $group = new Vyatta::IpTables::IpSet($set_name, $set_type);
return $group->reset_ipset();