diff options
author | slioch <slioch@eng-140.vyatta.com> | 2009-05-15 20:33:44 -0700 |
---|---|---|
committer | slioch <slioch@eng-140.vyatta.com> | 2009-05-15 20:33:44 -0700 |
commit | 7a82196d79f6b755db514e002216340223e61de7 (patch) | |
tree | 660fcc052fb5bb2e479089eb65c8b9501f6f06e5 | |
parent | deb86bf2b27631f66e5ffd849ba45db895dbd091 (diff) | |
download | vyatta-cfg-7a82196d79f6b755db514e002216340223e61de7.tar.gz vyatta-cfg-7a82196d79f6b755db514e002216340223e61de7.zip |
root node support on load merge operation. additional work needed for deeper merge path support
-rwxr-xr-x | lib/Vyatta/ConfigLoad.pm | 13 | ||||
-rwxr-xr-x | scripts/vyatta-load-config.pl | 2 |
2 files changed, 13 insertions, 2 deletions
diff --git a/lib/Vyatta/ConfigLoad.pm b/lib/Vyatta/ConfigLoad.pm index c1ea5e7..a1c0b8f 100755 --- a/lib/Vyatta/ConfigLoad.pm +++ b/lib/Vyatta/ConfigLoad.pm @@ -225,10 +225,21 @@ sub loadConfigHierarchy { if (!defined($load_cfg)) { return (); } + + #allows loading from arbritary root + my $root_node = shift; my $xcp = new XorpConfigParser(); $xcp->parse($load_cfg); - my $root = $xcp->get_node( () ); + my $root; + if (defined($root_node)) { + my $tmp = [$root_node]; + $root = $xcp->get_node($tmp); + #root_path= --except last node and needs to be passed to enumerate_branch + } + else { + $root = $xcp->get_node( () ); + } if (!defined($root)) { return (); } diff --git a/scripts/vyatta-load-config.pl b/scripts/vyatta-load-config.pl index 4073905..6755015 100755 --- a/scripts/vyatta-load-config.pl +++ b/scripts/vyatta-load-config.pl @@ -163,7 +163,7 @@ syslog( "warning", "Load config [$orig_load_file] by $login" ); system("$sbindir/vyatta_config_migrate.pl $load_file"); print "Loading config file $load_file...\n"; -my %cfg_hier = Vyatta::ConfigLoad::loadConfigHierarchy($load_file); +my %cfg_hier = Vyatta::ConfigLoad::loadConfigHierarchy($load_file,$merge); if ( scalar( keys %cfg_hier ) == 0 ) { print "The specified file does not contain any configuration.\n"; print |