diff options
author | An-Cheng Huang <ancheng@vyatta.com> | 2011-05-16 20:18:05 -0700 |
---|---|---|
committer | An-Cheng Huang <ancheng@vyatta.com> | 2011-05-16 20:18:05 -0700 |
commit | 4e85f8981ff93348c74f637730dad097eaaddc1a (patch) | |
tree | 899d07ac3f3cb464c23040dece93d400adef76e7 | |
parent | 9b94391b28690f4805219034c2d2eb0835c51073 (diff) | |
download | vyatta-config-mgmt-4e85f8981ff93348c74f637730dad097eaaddc1a.tar.gz vyatta-config-mgmt-4e85f8981ff93348c74f637730dad097eaaddc1a.zip |
eliminate hard-coded commit hook directory
-rw-r--r-- | lib/Vyatta/ConfigMgmt.pm | 4 | ||||
-rwxr-xr-x | scripts/vyatta-commit-revs.pl | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/Vyatta/ConfigMgmt.pm b/lib/Vyatta/ConfigMgmt.pm index f896922..43e267c 100644 --- a/lib/Vyatta/ConfigMgmt.pm +++ b/lib/Vyatta/ConfigMgmt.pm @@ -43,7 +43,7 @@ use POSIX; use IO::Zlib; -my $commit_hook_dir = '/etc/commit/'; +my $commit_hook_dir = `cli-shell-api getPostCommitHookDir`; my $config_dir = '/opt/vyatta/etc/config'; my $archive_dir = "$config_dir/archive"; my $config_file = "$config_dir/config.boot"; @@ -63,7 +63,7 @@ sub cm_get_config_rb { } sub cm_get_commit_hook_dir { - return $commit_hook_dir; + return "$commit_hook_dir/"; } sub cm_get_archive_dir { diff --git a/scripts/vyatta-commit-revs.pl b/scripts/vyatta-commit-revs.pl index 0c49008..f9fd2ff 100755 --- a/scripts/vyatta-commit-revs.pl +++ b/scripts/vyatta-commit-revs.pl @@ -54,8 +54,10 @@ my $tmp_config_file = "/tmp/config.boot.$$"; my $commit_status = $ENV{'COMMIT_STATUS'}; my $commit_via = $ENV{'COMMIT_VIA'}; +my $commit_cmt = $ENV{'COMMIT_COMMENT'}; $commit_status = 'unknown' if !defined $commit_via; $commit_via = 'other' if !defined $commit_via; +$commit_cmt = 'commit' if !defined $commit_cmt; if (! -d $archive_dir) { system("sudo mkdir $archive_dir"); @@ -75,7 +77,7 @@ if (! defined $rollback) { system("sudo logrotate -f -s $lr_state_file $lr_conf_file"); my $user = getlogin() || getpwuid($>) || "unknown"; -cm_commit_add_log($user, $commit_via, $ARGV[0]); +cm_commit_add_log($user, $commit_via, $commit_cmt); exit 0; |