summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@vyatta.com>2010-11-23 15:40:54 -0800
committerStig Thormodsrud <stig@vyatta.com>2010-11-23 15:40:54 -0800
commit2f4ce2dc33bd2f896ad98fde3b595bac9e4661de (patch)
treeaee6893d07eef3de1077864b4aac59544448b045
parent0ad99e54bd9b00f976e6cf735e3f2b863a76e595 (diff)
downloadvyatta-config-mgmt-2f4ce2dc33bd2f896ad98fde3b595bac9e4661de.tar.gz
vyatta-config-mgmt-2f4ce2dc33bd2f896ad98fde3b595bac9e4661de.zip
Change commit revisions script to use COMMIT_VIA env var.
-rwxr-xr-xscripts/vyatta-commit-revs.pl9
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/vyatta-commit-revs.pl b/scripts/vyatta-commit-revs.pl
index 3f522b5..c025342 100755
--- a/scripts/vyatta-commit-revs.pl
+++ b/scripts/vyatta-commit-revs.pl
@@ -52,6 +52,11 @@ my $lr_conf_file = cm_get_lr_conf_file();
my $last_commit_file = cm_get_last_commit_file();
my $tmp_config_file = "/tmp/config.boot.$$";
+my $commit_status = $ENV{'COMMIT_STATUS'};
+my $commit_via = $ENV{'COMMIT_VIA'};
+$commit_status = 'unknown' if !defined $commit_via;
+$commit_via = 'other' if !defined $commit_via;
+
if (! -d $archive_dir) {
system("sudo mkdir $archive_dir");
system("sudo chown vyatta:vyattacfg $archive_dir");
@@ -69,8 +74,8 @@ if (! defined $rollback) {
}
system("sudo logrotate -f -s $lr_state_file $lr_conf_file");
-my ($user) = getpwuid($<);
-cm_commit_add_log($user, 'cli', $ARGV[0]);
+my $user = getlogin() || getpwuid($<) || "unknown";
+cm_commit_add_log($user, $commit_via, $ARGV[0]);
exit 0;