summaryrefslogtreecommitdiff
path: root/scripts/vyatta-config-mgmt.pl
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@vyatta.com>2010-11-10 16:42:08 -0800
committerStig Thormodsrud <stig@vyatta.com>2010-11-10 16:42:08 -0800
commit4d00261f1e05335a14ec873c99c869c9e9c1374b (patch)
tree980f105536f57d99516c14f5d90c5ffdee2a55d9 /scripts/vyatta-config-mgmt.pl
parent54e206593bbc8aeaa4e49641c4406510ceeee476 (diff)
downloadvyatta-config-mgmt-4d00261f1e05335a14ec873c99c869c9e9c1374b.tar.gz
vyatta-config-mgmt-4d00261f1e05335a14ec873c99c869c9e9c1374b.zip
Fix rollback such that it also goes throught the revisioning.
Diffstat (limited to 'scripts/vyatta-config-mgmt.pl')
-rwxr-xr-xscripts/vyatta-config-mgmt.pl8
1 files changed, 5 insertions, 3 deletions
diff --git a/scripts/vyatta-config-mgmt.pl b/scripts/vyatta-config-mgmt.pl
index a28942a..31ccca9 100755
--- a/scripts/vyatta-config-mgmt.pl
+++ b/scripts/vyatta-config-mgmt.pl
@@ -328,20 +328,22 @@ if ($action eq 'rollback') {
# called internally. If we later expose this to cli
# we'll need to prompt for confirmation.
my @lines = cm_read_file($filename);
- $rollback_config = join("\n", @lines);
+ $rollback_config = join("\n", @lines);
+ $rollback_config .= "\n";
}
if (!defined $method) {
die "Error: must define either revnum or file";
}
my ($user) = getpwuid($<);
- cm_commit_add_log($user, 'rollback', '');
my $boot_config_file = cm_get_boot_config_file();
my $archive_dir = cm_get_archive_dir();
my $last_commit_file = cm_get_last_commit_file();
- system("sudo mv $boot_config_file $archive_dir/config.boot-prerollback");
+ system("sudo cp $boot_config_file $archive_dir/config.boot-prerollback");
cm_write_file($boot_config_file, $rollback_config);
cm_write_file($last_commit_file, $rollback_config); # white lie
+ my $cmd = "$commit_revs_script --rollback=1 rollback/reboot";
+ system("sudo sg vyattacfg \"$cmd\"");
openlog($0, "", LOG_USER);
my $login = getpwuid($<) || "unknown";
syslog("warning", "Rollback reboot requested by $login");