summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-02-18 10:10:20 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-02-18 10:10:20 -0800
commit8090fd56ca7709786916dc73f433d81bc5b8fbfa (patch)
treef04d117a2543f05b01a483a5b1826231c6c7be2b
parent06d822175c89242b4a0246d84a4e5611a8233a8f (diff)
parent3882b0e90aaa3b1e2d9963584a1e703f1d45d079 (diff)
downloadvyatta-cfg-8090fd56ca7709786916dc73f433d81bc5b8fbfa.tar.gz
vyatta-cfg-8090fd56ca7709786916dc73f433d81bc5b8fbfa.zip
Merge branch 'jenner' of suva.vyatta.com:/git/vyatta-cfg into jenner
-rw-r--r--debian/changelog15
-rw-r--r--src/commit2.c112
-rw-r--r--src/common/unionfs.c12
-rw-r--r--templates/priority6
4 files changed, 105 insertions, 40 deletions
diff --git a/debian/changelog b/debian/changelog
index 7780d2a..c94db2d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,18 @@
+vyatta-cfg (0.14.16) unstable; urgency=low
+
+ [ Stephen Hemminger ]
+ * change bgp disable node priority
+
+ [ slioch ]
+ * added generic commit failed message on any portion of the
+ configuration failing. To get
+ * added dump transaction support to write to stdout rather than
+ redirected /tmp/cfg-stdout.log
+ * added additional debug output and fixed dumping of trans nodes to
+ screen. added default
+
+ -- slioch <slioch@eng-140.vyatta.com> Tue, 17 Feb 2009 16:47:46 -0800
+
vyatta-cfg (0.14.15) unstable; urgency=low
[ slioch ]
diff --git a/src/commit2.c b/src/commit2.c
index b56fceb..82045fc 100644
--- a/src/commit2.c
+++ b/src/commit2.c
@@ -8,16 +8,30 @@
boolean g_debug = FALSE;
boolean g_display_error_node = FALSE;
boolean g_coverage = FALSE;
+boolean g_dump_trans = FALSE;
+
+int ActionOrder[top_act] = {
+ 4,
+ 5,
+ 6,
+ 0,
+ 1,
+ 2,
+ 3,
+ 7
+};
+
+
char* ActionNames[top_act] = {
- "delete",
- "create",
- "activate",
- "update",
- "syntax",
- "commit",
- "begin",
- "end"
+ "delete", //0
+ "create", //1
+ "activate", //2
+ "update", //3
+ "syntax", //4
+ "commit", //5
+ "begin", //6
+ "end" //7
};
extern boolean
@@ -98,7 +112,6 @@ int
main(int argc, char** argv)
{
int ch;
- boolean dump_trans = TRUE;
boolean priority_mode = TRUE;
boolean test_mode = FALSE;
@@ -119,7 +132,7 @@ main(int argc, char** argv)
test_mode = TRUE;
break;
case 's':
- dump_trans = TRUE;
+ g_dump_trans = TRUE;
break;
case 'e':
g_display_error_node = TRUE;
@@ -154,8 +167,10 @@ main(int argc, char** argv)
exit(0);
}
- if (dump_trans == TRUE) {
- printf("Dumping transactions\n");
+ if (g_debug == TRUE || g_dump_trans == TRUE) {
+ if (g_dump_trans == TRUE) {
+ fprintf(out_stream,"Dumping transactions\n");
+ }
//iterate over config_data and dump...
g_node_traverse(trans_coll,
G_PRE_ORDER,
@@ -163,7 +178,9 @@ main(int argc, char** argv)
-1,
(GNodeTraverseFunc)dump_func,
(gpointer)NULL);
- // exit(0);
+ if (g_dump_trans == TRUE) {
+ exit(0);
+ }
}
GNode *trans_child_node = (GNode*)g_node_first_child(trans_coll);
@@ -178,13 +195,24 @@ main(int argc, char** argv)
do {
boolean success = TRUE;
if (g_debug == TRUE) {
- printf("commit2: Starting new transaction processing pass on root\n");
+ if (trans_child_node != NULL && trans_child_node->data != NULL && ((struct VyattaNode*)(trans_child_node->data))->_data._name != NULL) {
+ printf("commit2: Starting new transaction processing pass on root: %s\n", ((struct VyattaNode*)(trans_child_node->data))->_data._name);
+ }
+ else {
+ printf("commit2: Starting new transaction processing pass on root:\n");
+ }
}
//on each priority node now execute actions
if ((success = process_priority_node(trans_child_node)) == TRUE) {
//this below copies the node directory from the local to active location
- complete(trans_child_node, test_mode);
+ //if this is true root skip
+ if (trans_child_node != NULL && trans_child_node->data != NULL && strcmp(((struct VyattaNode*)(trans_child_node->data))->_data._path,"/") == 0) {
+ //no op, need better way to define true root
+ }
+ else {
+ complete(trans_child_node, test_mode);
+ }
}
if (success == FALSE) {
@@ -202,6 +230,10 @@ main(int argc, char** argv)
printf("commit2: successful commit, now cleaning up temp directories\n");
}
}
+ else {
+ fprintf(out_stream,"Commit failed\n");
+ }
+
set_in_commit(FALSE);
cleanup(config_data);
@@ -559,11 +591,19 @@ cleanup(GNode *root_node)
gboolean
dump_func(GNode *node, gpointer data)
{
+ FILE *out;
+ if (g_dump_trans) {
+ out = out_stream;
+ }
+ else {
+ out = stdout;
+ }
+
if (node != NULL) {
guint depth = g_node_depth(node);
if (depth == 2) {
- printf("NEW TRANS\n");
+ fprintf(out,"NEW TRANS\n");
}
gpointer gp = ((GNode*)node)->data;
@@ -571,57 +611,57 @@ dump_func(GNode *node, gpointer data)
int i;
if (IS_DELETE(((struct VyattaNode*)gp)->_data._operation)) {
- printf("-");
+ fprintf(out,"-");
}
else if (IS_CREATE(((struct VyattaNode*)gp)->_data._operation)) {
- printf("+");
+ fprintf(out,"+");
}
else if (IS_SET(((struct VyattaNode*)gp)->_data._operation)) {
- printf(">");
+ fprintf(out,">");
}
else {
- printf(" ");
+ fprintf(out," ");
}
for (i = 0; i < depth; ++i) {
- printf(" ");
+ fprintf(out," ");
}
- printf("%s (t: %d, p: %d)", ((struct VyattaNode*)gp)->_data._name,((struct VyattaNode*)gp)->_config._def.def_type,((struct VyattaNode*)gp)->_priority);
+ fprintf(out,"%s (t: %d, p: %d)", ((struct VyattaNode*)gp)->_data._name,((struct VyattaNode*)gp)->_config._def.def_type,((struct VyattaNode*)gp)->_priority);
if (((struct VyattaNode*)gp)->_data._value == TRUE) {
- printf(" [VALUE]");
+ fprintf(out," [VALUE]");
}
if (((struct VyattaNode*)gp)->_config._multi == TRUE) {
- printf(" [MULTI]");
+ fprintf(out," [MULTI]");
}
if (((struct VyattaNode*)gp)->_config._def.actions[syntax_act].vtw_list_head &&
((struct VyattaNode*)gp)->_config._def.actions[syntax_act].vtw_list_head->vtw_node_aux == 0) {
- printf(" [SYNTAX]");
+ fprintf(out," [SYNTAX]");
}
if (((struct VyattaNode*)gp)->_config._def.actions[create_act].vtw_list_head) {
- printf(" [CREATE]");
+ fprintf(out," [CREATE]");
}
if (((struct VyattaNode*)gp)->_config._def.actions[activate_act].vtw_list_head) {
- printf(" [ACTIVATE]");
+ fprintf(out," [ACTIVATE]");
}
if (((struct VyattaNode*)gp)->_config._def.actions[update_act].vtw_list_head) {
- printf(" [UPDATE]");
+ fprintf(out," [UPDATE]");
}
if (((struct VyattaNode*)gp)->_config._def.actions[delete_act].vtw_list_head) {
- printf(" [DELETE]");
+ fprintf(out," [DELETE]");
}
if (((struct VyattaNode*)gp)->_config._def.actions[syntax_act].vtw_list_head &&
((struct VyattaNode*)gp)->_config._def.actions[syntax_act].vtw_list_head->vtw_node_aux == 1) {
- printf(" [COMMIT]");
+ fprintf(out," [COMMIT]");
}
if (((struct VyattaNode*)gp)->_config._def.actions[begin_act].vtw_list_head) {
- printf(" [BEGIN]");
+ fprintf(out," [BEGIN]");
}
if (((struct VyattaNode*)gp)->_config._def.actions[end_act].vtw_list_head) {
- printf(" [END]");
+ fprintf(out," [END]");
}
if (((struct VyattaNode*)gp)->_config._help != NULL) {
- // printf("[help: %s]",((struct VyattaNode*)gp)->_config._help);
+ // fprintf(out,"[help: %s]",((struct VyattaNode*)gp)->_config._help);
}
- printf("\n");
+ fprintf(out,"\n");
}
}
@@ -677,7 +717,7 @@ process_priority_node(GNode *priority_node)
order = G_POST_ORDER;
}
- result._action = i;
+ result._action = ActionOrder[i];
g_node_traverse((GNode*)priority_node,
order,
G_TRAVERSE_ALL,
@@ -733,7 +773,7 @@ enclosing_process_func(GNode *node, gpointer data)
order = G_POST_ORDER;
}
- result->_action = i;
+ result->_action = ActionOrder[i];
g_node_traverse((GNode*)node,
order,
G_TRAVERSE_ALL,
diff --git a/src/common/unionfs.c b/src/common/unionfs.c
index 1d9cbe8..7084893 100644
--- a/src/common/unionfs.c
+++ b/src/common/unionfs.c
@@ -381,7 +381,9 @@ value_exists(char *path)
void
common_set_parent_context(char *cpath, char *dpath)
{
- printf("common_set_parent_context(incoming): %s, %s\n",cpath,dpath);
+ if (g_debug) {
+ printf("common_set_parent_context(incoming): %s, %s\n",cpath,dpath);
+ }
//strip off last path and set
int index = strlen(cpath)-1;
if (cpath[index] == '/') {
@@ -412,7 +414,9 @@ common_set_parent_context(char *cpath, char *dpath)
*ptr = '\0';
}
set_path(dpath,FALSE);
- printf("common_set_parent_context: %s, %s\n",cpath,dpath);
+ if (g_debug) {
+ printf("common_set_parent_context: %s, %s\n",cpath,dpath);
+ }
}
/**
@@ -421,7 +425,9 @@ common_set_parent_context(char *cpath, char *dpath)
void
common_set_context(char *cpath, char *dpath)
{
- printf("common_set_context: %s, %s\n",cpath,dpath);
+ if (g_debug) {
+ printf("common_set_context: %s, %s\n",cpath,dpath);
+ }
set_path(cpath,TRUE);
set_path(dpath,FALSE);
}
diff --git a/templates/priority b/templates/priority
index f8e3063..c9c3415 100644
--- a/templates/priority
+++ b/templates/priority
@@ -1,4 +1,4 @@
-200 firewall/group/node.tag
+200 firewall/group
210 firewall
300 protocols/bgp/disable
301 protocols/ospf/disable
@@ -25,5 +25,9 @@
620 protocols/rip
630 protocols
700 vpn
+800 interfaces/ethernet/node.tag/vif/node.tag/vrrp
900 cluster
+900 qos-policy
+900 test-definition
+900 content-inspection
900 load-balancing