From e396460d35f11b95434e5f08d6376859b0eb5bcd Mon Sep 17 00:00:00 2001 From: John Southworth Date: Thu, 14 Jul 2011 19:39:03 -0500 Subject: Bugfix 7331: better fix for the bug (cherry picked from commit fdac525b7596f1b18c201bdcd5923d3e76453ebd) --- etc/bash_completion.d/vyatta-cfg | 2 -- scripts/vyatta-save-config.pl | 3 --- src/cstore/cstore.cpp | 8 +++++--- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/etc/bash_completion.d/vyatta-cfg b/etc/bash_completion.d/vyatta-cfg index 8626342..01b2a13 100755 --- a/etc/bash_completion.d/vyatta-cfg +++ b/etc/bash_completion.d/vyatta-cfg @@ -97,9 +97,7 @@ show () args+=("$arg") fi done - # Note: the sed command below is to fix bug 7331 cli-shell-api "${opts[@]}" -- showCfg "${args[@]}" \ - | sed -e '/--- CONFIGURATION COMMENTED OUT DURING MIGRATION BELOW ---/,/--- CONFIGURATION COMMENTED OUT DURING MIGRATION ABOVE ---/d'\ | eval "${VYATTA_PAGER:-cat}" } diff --git a/scripts/vyatta-save-config.pl b/scripts/vyatta-save-config.pl index 6dc833c..00f5854 100755 --- a/scripts/vyatta-save-config.pl +++ b/scripts/vyatta-save-config.pl @@ -107,9 +107,6 @@ my $show_cmd = 'cli-shell-api showConfig --show-active-only --show-ignore-edit'; if ($show_default) { $show_cmd .= ' --show-show-defaults'; } -# add a sed command to remove unwanted configuration comments. -$show_cmd .= "| sed -e \'/--- CONFIGURATION COMMENTED OUT DURING MIGRATION BELOW ---/"; -$show_cmd .= ",/--- CONFIGURATION COMMENTED OUT DURING MIGRATION ABOVE ---/d\'"; open(my $show_fd, '-|', $show_cmd) or die 'Cannot execute config output'; while (<$show_fd>) { print; diff --git a/src/cstore/cstore.cpp b/src/cstore/cstore.cpp index c86631b..b8ab82f 100644 --- a/src/cstore/cstore.cpp +++ b/src/cstore/cstore.cpp @@ -999,12 +999,10 @@ Cstore::commentCfgPath(const Cpath& args) } if (comment.find("CONFIGURATION COMMENTED OUT DURING MIGRATION BELOW") != string::npos){ // Don't allow users to set configuration migration comments - output_user("Cannot use the string 'CONFIGURATION COMMENTED OUT DURING MIGRATION BELOW' in a comment\n"); return false; } if (comment.find("CONFIGURATION COMMENTED OUT DURING MIGRATION ABOVE") != string::npos){ // Don't allow users to set configuration migration comments - output_user("Cannot use the string 'CONFIGURATION COMMENTED OUT DURING MIGRATION ABOVE' in a comment\n"); return false; } @@ -1826,7 +1824,11 @@ Cstore::loadFile(const char *filename) } for (size_t i = 0; i < com_list.size(); i++) { if (!commentCfgPath(com_list[i])) { - print_path_vec("Comment [", "] failed\n", com_list[i], "'"); + string comment = string(com_list[i][com_list[i].size()-1]); + if (comment.find("CONFIGURATION COMMENTED OUT DURING MIGRATION BELOW") == string::npos + && comment.find("CONFIGURATION COMMENTED OUT DURING MIGRATION ABOVE") == string::npos) { + print_path_vec("Comment [", "] failed\n", com_list[i], "'"); + } } } -- cgit v1.2.3