summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2011-04-13 15:32:55 -0700
committerAn-Cheng Huang <ancheng@vyatta.com>2011-04-13 15:32:55 -0700
commitbea24e830d53460703c9bdefd54476080b011450 (patch)
treea940758dd93c205670d54898ed16a09e33a61899 /src
parent7659d4706b5c167f826d7ab4ecb2ef4a7eb74d7a (diff)
downloadvyatta-cfg-bea24e830d53460703c9bdefd54476080b011450.tar.gz
vyatta-cfg-bea24e830d53460703c9bdefd54476080b011450.zip
fix for bug 6996
* add "ignore-edit" option for config output. * ignore "edit level" when saving config file.
Diffstat (limited to 'src')
-rw-r--r--src/cli_shell_api.cpp6
-rw-r--r--src/cnode/cnode-algorithm.cpp4
-rw-r--r--src/cnode/cnode-algorithm.hpp2
3 files changed, 8 insertions, 4 deletions
diff --git a/src/cli_shell_api.cpp b/src/cli_shell_api.cpp
index 9678e5c..363a38f 100644
--- a/src/cli_shell_api.cpp
+++ b/src/cli_shell_api.cpp
@@ -60,6 +60,7 @@ int op_show_hide_secrets = 0;
int op_show_working_only = 0;
int op_show_context_diff = 0;
int op_show_commands = 0;
+int op_show_ignore_edit = 0;
char *op_show_cfg1 = NULL;
char *op_show_cfg2 = NULL;
@@ -429,6 +430,8 @@ showCfg(Cstore& cstore, const Cpath& args)
* show "context diff" between two configs
* --show-commands
* show output in "commands"
+ * --show-ignore-edit
+ * don't use the edit level in environment
*
* note that when neither cfg1 nor cfg2 specifies a config file, the "args"
* argument specifies the root path for the show output, and the "edit level"
@@ -456,7 +459,7 @@ showConfig(Cstore& cstore, const Cpath& args)
cnode::showConfig(cfg1, cfg2, args, op_show_show_defaults,
op_show_hide_secrets, op_show_context_diff,
- op_show_commands);
+ op_show_commands, op_show_ignore_edit);
}
static void
@@ -535,6 +538,7 @@ struct option options[] = {
{"show-working-only", no_argument, &op_show_working_only, 1},
{"show-context-diff", no_argument, &op_show_context_diff, 1},
{"show-commands", no_argument, &op_show_commands, 1},
+ {"show-ignore-edit", no_argument, &op_show_ignore_edit, 1},
{"show-cfg1", required_argument, NULL, SHOW_CFG1},
{"show-cfg2", required_argument, NULL, SHOW_CFG2},
{NULL, 0, NULL, 0}
diff --git a/src/cnode/cnode-algorithm.cpp b/src/cnode/cnode-algorithm.cpp
index 7574e2e..602d9fb 100644
--- a/src/cnode/cnode-algorithm.cpp
+++ b/src/cnode/cnode-algorithm.cpp
@@ -894,14 +894,14 @@ cnode::get_cmds(const CfgNode& cfg, vector<Cpath>& set_list,
void
cnode::showConfig(const string& cfg1, const string& cfg2,
const Cpath& path, bool show_def, bool hide_secret,
- bool context_diff, bool show_cmds)
+ bool context_diff, bool show_cmds, bool ignore_edit)
{
tr1::shared_ptr<CfgNode> aroot, wroot, croot1, croot2;
tr1::shared_ptr<Cstore> cstore;
Cpath rpath(path);
Cpath cur_path;
- if ((cfg1 == ACTIVE_CFG || cfg1 == WORKING_CFG)
+ if (!ignore_edit && (cfg1 == ACTIVE_CFG || cfg1 == WORKING_CFG)
&& (cfg2 == ACTIVE_CFG || cfg2 == WORKING_CFG)) {
// active/working config only => use edit level and path
cstore.reset(Cstore::createCstore(true));
diff --git a/src/cnode/cnode-algorithm.hpp b/src/cnode/cnode-algorithm.hpp
index 2f8995d..3985b9f 100644
--- a/src/cnode/cnode-algorithm.hpp
+++ b/src/cnode/cnode-algorithm.hpp
@@ -42,7 +42,7 @@ extern const string WORKING_CFG;
void showConfig(const string& cfg1, const string& cfg2,
const Cpath& path, bool show_def = false,
bool hide_secret = false, bool context_diff = false,
- bool show_cmds = false);
+ bool show_cmds = false, bool ignore_edit = false);
} // namespace cnode