summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2010-12-01 15:52:22 -0800
committerAn-Cheng Huang <ancheng@vyatta.com>2010-12-01 15:52:22 -0800
commit58005829f825c3e6843d0c2c36e1e343194ec3dd (patch)
tree6a7ca11281b7666263242f28a4a7e1bf3e5d992f /scripts
parent215aec2b47e91ad8a2c8ef4c71af79f34c494e11 (diff)
downloadvyatta-cfg-58005829f825c3e6843d0c2c36e1e343194ec3dd.tar.gz
vyatta-cfg-58005829f825c3e6843d0c2c36e1e343194ec3dd.zip
clean up merge argument processing
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/vyatta-load-config.pl14
1 files changed, 4 insertions, 10 deletions
diff --git a/scripts/vyatta-load-config.pl b/scripts/vyatta-load-config.pl
index f3339f7..2767d9f 100755
--- a/scripts/vyatta-load-config.pl
+++ b/scripts/vyatta-load-config.pl
@@ -62,11 +62,6 @@ GetOptions(
"merge:s" => \$merge,
) or usage();
-my $merge_mode = 'false';
-if (defined $merge) {
- $merge_mode = 'true';
-}
-
my $mode = 'local';
my $proto;
@@ -195,7 +190,7 @@ my @deactivate_list = @{ $cfg_diff{'deactivate'} };
my @activate_list = @{ $cfg_diff{'activate'} };
my @comment_list = @{ $cfg_diff{'comment'} };
-if ($merge_mode eq 'false') {
+if (!defined($merge)) {
my @delete_list = @{ $cfg_diff{'delete'} };
foreach (@delete_list) {
@@ -244,7 +239,7 @@ foreach (@deactivate_list) {
foreach (@comment_list) {
my ( $cmd_ref ) = $_;
#apply comment if it doesn't have an empty element at the array and a .comment file exists and this is not a merge
- if ($merge_mode eq 'false' && $cmd_ref =~ /\"\"$/) {
+ if (!defined($merge) && $cmd_ref =~ /\"\"$/) {
my @cmd_array = split(" ",$cmd_ref);
pop(@cmd_array);
my $rel_path = join '/', @cmd_array;
@@ -283,7 +278,6 @@ if (defined $rc and $rc > 0) {
exit 0;
}
-my $load_merge = 'Load';
-$load_merge = 'Merge' if $merge_mode eq 'true';
-print "\n$load_merge complete. Use 'commit' to make changes active.\n";
+print ("\n" . (defined($merge) ? 'Merge' : 'Load')
+ . " complete. Use 'commit' to make changes active.\n");
exit 0;