From 7a82196d79f6b755db514e002216340223e61de7 Mon Sep 17 00:00:00 2001 From: slioch Date: Fri, 15 May 2009 20:33:44 -0700 Subject: root node support on load merge operation. additional work needed for deeper merge path support --- lib/Vyatta/ConfigLoad.pm | 13 ++++++++++++- 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 -- cgit v1.2.3