From 89a8f27b3d905501c9097544f27dd76208303b80 Mon Sep 17 00:00:00 2001 From: slioch Date: Mon, 2 Nov 2009 17:22:05 -0800 Subject: fix for missing priority value on embedded multinode. bug behavior was more limited than this--at least tag node.def and multiple configuration on commit. tested fix with limited regression test. also slightly modified break on priority values where embedded multinodes with priority values are treated as discrete transactions (which isolates failures within the multinode and not the parent of the multinode). --- src/common/unionfs.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/common/unionfs.c b/src/common/unionfs.c index 45127e8..452c774 100644 --- a/src/common/unionfs.c +++ b/src/common/unionfs.c @@ -225,13 +225,6 @@ retrieve_data(char* rel_data_path, GNode *node, char* root, NODE_OPERATION op) } //either multi or tag--shouldn't have made a difference, but arkady was confused. vn->_config._multi = (def.tag | def.multi); - if (def.def_priority == 0) { - vn->_config._priority = LOWEST_PRIORITY; - } - else { - vn->_config._priority = def.def_priority; - } - } } @@ -252,12 +245,6 @@ retrieve_data(char* rel_data_path, GNode *node, char* root, NODE_OPERATION op) //Need to do two things: // 1. Come to agreement on where the behavior splits on priority multinodes // 2. Not check for tag node in the def datastructure but use the new datastructure as at some point tag and multi will be the same - if (vn_parent->_config._def.tag == TRUE) { //only for embedded multinodes - vn->_config._priority = vn_parent->_config._priority; - vn_parent->_config._priority = LOWEST_PRIORITY; - } - - //now let's patch up the def multi-nodes //move the def for the multinode from the parent to the value node struct VyattaNode* vn2 = (struct VyattaNode*)node->data; @@ -282,6 +269,25 @@ retrieve_data(char* rel_data_path, GNode *node, char* root, NODE_OPERATION op) } } + + if (G_NODE_IS_ROOT(node) == FALSE) { + struct VyattaNode* vn_parent = (struct VyattaNode*)node->parent->data; + struct VyattaNode* vn = (struct VyattaNode*)node->data; + // vn->_config._priority = vn_parent->_config._def.def_priority; + if (vn->_config._def.tag && vn->_config._multi) { + vn->_config._priority = LOWEST_PRIORITY; + } + else if (vn->_config._def.def_priority == 0) { + vn->_config._priority = LOWEST_PRIORITY; + } + else { + vn->_config._priority = vn->_config._def.def_priority; + } + } + + + + if (final_node == TRUE) { //move defs to child... get_term_data_values(node); -- cgit v1.2.3 From 5edd540c79f349cbe5f377f5b0e8ed16dcf7cf99 Mon Sep 17 00:00:00 2001 From: Bob Gilligan Date: Thu, 5 Nov 2009 16:39:30 -0800 Subject: Allow inline comments in config template fields. Also change priority.pl script to display inline comments found in "priority:" fields if they are present. --- scripts/priority.pl | 31 +++++++++++++++++++++---------- src/cli_def.l | 1 + 2 files changed, 22 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/scripts/priority.pl b/scripts/priority.pl index 59239bf..39f6220 100644 --- a/scripts/priority.pl +++ b/scripts/priority.pl @@ -2,16 +2,29 @@ my %pri; - # first check if this file exists, and if so ensure this is a config file. +# Look at all node.def files in the configuration template tree my @files = `find /opt/vyatta/share/vyatta-cfg -name 'node.def'`; foreach my $f (@files) { my $result = `grep 'priority:' $f`; - if (defined $result && length($result) != 0) { - my @r = split " ", $result; - if (defined $r[1]) { - #stuff in hash here - push @{$pri{$r[1]}},$f; - } + if (defined $result && length($result) != 0) { + my @r = split " ", $result; + if (defined $r[1]) { + # Strip off trailing "/node.def\n" from file pathname + my $line = substr($f, 0, -10); + + # Strip off leading "/opt/vyatta/share/vyatta-cfg/templates/" + $line = substr($line, 39); + + # See if there is a comment in entry + my ($entry, $comment) = split /#/, $result; + if (defined $comment) { + $comment =~ s/\n//; + $line = $line . " #" . $comment; + } + + # stuff resulting line into hash + push @{$pri{$r[1]}}, $line; + } } } @@ -21,8 +34,6 @@ foreach my $f (@files) { foreach my $key ( sort { $a <=> $b } keys %pri ) { my @a = @{$pri{$key}}; foreach my $val (@a) { - my $loc = substr($val,0,-10); - my $loc = substr($loc,39); - print $key," ",$loc,"\n"; + print $key," ",$val,"\n"; } } diff --git a/src/cli_def.l b/src/cli_def.l index d73f1c4..721e5f0 100644 --- a/src/cli_def.l +++ b/src/cli_def.l @@ -271,6 +271,7 @@ RE_ACT_FIELD (help|syntax|commit|delete|update|activate|create|begin|end|comp_he #[^\n]*\n { /* comment */ ++yy_cli_def_lineno; + return EOL; } \n { -- cgit v1.2.3 From 3238b588efc4bc2766edeaec9b1d0369815186f7 Mon Sep 17 00:00:00 2001 From: Michael Larson Date: Tue, 10 Nov 2009 12:04:23 -0800 Subject: preserve node.val order for term multinodes. fix for bug 5103 --- src/common/unionfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/common/unionfs.c b/src/common/unionfs.c index 452c774..ed40bf8 100644 --- a/src/common/unionfs.c +++ b/src/common/unionfs.c @@ -1023,8 +1023,9 @@ dlist_test_func(GQuark key_id,gpointer data,gpointer user_data) if (vn->_data._value == TRUE) { new_vn = copy_vyatta_node(vn); GNode *new_node = g_node_new(new_vn); - //g_node_insert(node, -1, new_node); - insert_sibling_in_order(node,new_node); + // g_node_insert(node, -1, new_node); + g_node_insert_after(node, NULL, new_node); + // insert_sibling_in_order(node,new_node); new_vn->_config._def = vn->_config._def; } else { -- cgit v1.2.3