From 6378af737b35899c3673a435c65ddf141a8f849e Mon Sep 17 00:00:00 2001 From: Michael Larson Date: Wed, 4 May 2011 14:06:08 -0700 Subject: allow "reboot at" and "reboot" to be invoked by the rest api. --- scripts/vyatta-reboot.pl | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/scripts/vyatta-reboot.pl b/scripts/vyatta-reboot.pl index 4d34fee..eaef885 100755 --- a/scripts/vyatta-reboot.pl +++ b/scripts/vyatta-reboot.pl @@ -115,11 +115,12 @@ if ($action eq "reboot") { if (defined $now) { do_reboot($login); } else { - if (prompt("Proceed with reboot? [confirm]", -y1d=>"y")) { + if (defined($ENV{VYATTA_PROCESS_CLIENT} && $ENV{VYATTA_PROCESS_CLIENT} eq 'gui2_rest') || + prompt("Proceed with reboot? [confirm]", -y1d=>"y")) { do_reboot($login); - } else { - print "Reboot canceled\n"; - exit 1; + } else { + print "Reboot canceled\n"; + exit 1; } } } @@ -155,9 +156,11 @@ if ($action eq "reboot_at") { system("atrm $job"); print "\nReload scheduled for $time\n\n"; - if (! prompt("Proceed with reboot schedule? [confirm]", -y1d=>"y")) { - print "Reboot canceled\n"; - exit 1; + if (!defined($ENV{VYATTA_PROCESS_CLIENT}) || $ENV{VYATTA_PROCESS_CLIENT} ne 'gui2_rest') { + if (! prompt("Proceed with reboot schedule? [confirm]", -y1d=>"y")) { + print "Reboot canceled\n"; + exit 1; + } } @lines = `echo sudo /sbin/reboot | at $at_time 2>&1`; -- cgit v1.2.3 From 25b1fa57cd804e91ac8748d03c68b96a68442220 Mon Sep 17 00:00:00 2001 From: Michael Larson Date: Wed, 4 May 2011 14:07:39 -0700 Subject: 0.13.119 --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 08d391a..531b0fd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +vyatta-op (0.13.119) unstable; urgency=low + + * allow "reboot at" and "reboot" to be invoked by the rest api. + + -- Michael Larson Wed, 04 May 2011 14:07:39 -0700 + vyatta-op (0.13.118) unstable; urgency=low * Fail on invalid image name -- cgit v1.2.3 From 5e402d549409e28d148a768e899dc8e50745f636 Mon Sep 17 00:00:00 2001 From: Michael Larson Date: Wed, 4 May 2011 16:08:48 -0700 Subject: allow "clear connection-tracking" op mode command to override query for rest mode. --- scripts/vyatta-clear-conntrack | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/vyatta-clear-conntrack b/scripts/vyatta-clear-conntrack index 99874a3..0979e4a 100644 --- a/scripts/vyatta-clear-conntrack +++ b/scripts/vyatta-clear-conntrack @@ -55,8 +55,12 @@ get_response () { response='' while [ -z "$response" ] do - echo -ne "\nThis will clear all currently tracked and expected connections. Continue? (Y/N) [N]: " - response=$(get_response "N" "Y N") + if [ "$VYATTA_PROCESS_CLIENT" == "gui2_rest" ]; then + response="y" + else + echo -ne "\nThis will clear all currently tracked and expected connections. Continue? (Y/N) [N]: " + response=$(get_response "N" "Y N") + fi if [ "$response" == "n" ]; then exit 1 else -- cgit v1.2.3 From 2bfa80b1495cea774872c1cc91c76d27af4bf28a Mon Sep 17 00:00:00 2001 From: Michael Larson Date: Wed, 4 May 2011 16:10:11 -0700 Subject: 0.13.120 --- debian/changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index 531b0fd..0a4a3db 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +vyatta-op (0.13.120) unstable; urgency=low + + * allow "clear connection-tracking" op mode command to override query + for rest mode. + + -- Michael Larson Wed, 04 May 2011 16:10:11 -0700 + vyatta-op (0.13.119) unstable; urgency=low * allow "reboot at" and "reboot" to be invoked by the rest api. -- cgit v1.2.3 From 7cb0a823196182e7992e043624ad4976c1faa756 Mon Sep 17 00:00:00 2001 From: Michael Larson Date: Thu, 5 May 2011 10:33:35 -0700 Subject: suppress shutdown confirmation query if invoked by rest API. --- templates/shutdown/node.def | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/templates/shutdown/node.def b/templates/shutdown/node.def index 4185f40..81cbc5f 100644 --- a/templates/shutdown/node.def +++ b/templates/shutdown/node.def @@ -1,3 +1,9 @@ help: Shutdown the system -run: ${vyatta_bindir}/yesno -y "Proceed with shutdown? [confirm]" \ - && sudo /sbin/shutdown -h now +run: if [ "$VYATTA_PROCESS_CLIENT" == "gui2_rest" ] + then + sudo /sbin/shutdown -h now + else + ${vyatta_bindir}/yesno -y "Proceed with shutdown? [confirm]" \ + && sudo /sbin/shutdown -h now + fi + -- cgit v1.2.3 From 0ead82c97e51e16ddc7d2eeba6f5dd30aac7466a Mon Sep 17 00:00:00 2001 From: Michael Larson Date: Thu, 5 May 2011 10:34:56 -0700 Subject: 0.13.121 --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 0a4a3db..0e766fe 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +vyatta-op (0.13.121) unstable; urgency=low + + * suppress shutdown confirmation query if invoked by rest API. + + -- Michael Larson Thu, 05 May 2011 10:34:56 -0700 + vyatta-op (0.13.120) unstable; urgency=low * allow "clear connection-tracking" op mode command to override query -- cgit v1.2.3