summaryrefslogtreecommitdiff
path: root/src/commit2.c
diff options
context:
space:
mode:
authorslioch <slioch@eng-140.vyatta.com>2009-03-03 17:06:06 -0800
committerslioch <slioch@eng-140.vyatta.com>2009-03-03 17:06:06 -0800
commit11d77d7b77d0dae8c5d41ff692a8b01eebafc9fb (patch)
tree29834956a1ccbba37862976f316a572035768aae /src/commit2.c
parent5921105087a4efb2af329f312390c22c9260c0de (diff)
downloadvyatta-cfg-11d77d7b77d0dae8c5d41ff692a8b01eebafc9fb.tar.gz
vyatta-cfg-11d77d7b77d0dae8c5d41ff692a8b01eebafc9fb.zip
fixed -o option on commit. modified empty multinode behavior so action is NOT executed if a multinode does not possess a value. Other source cleanup.
Diffstat (limited to 'src/commit2.c')
-rw-r--r--src/commit2.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/commit2.c b/src/commit2.c
index 858cf90..5e75151 100644
--- a/src/commit2.c
+++ b/src/commit2.c
@@ -34,9 +34,6 @@ char* ActionNames[top_act] = {
"end" //7
};
-extern boolean
-check_syn(vtw_node *cur);
-
GNode*
get_transactions(GNode*, boolean priority);
@@ -76,15 +73,6 @@ also, the algorithm for collapsing the tree into a transaction list is:
1) iterate through tree and mark all explicit transactions
2) when done, prune the tree of all root explicit transactions
3) Now iterate through remaining tree and remove each node and append to transaction list.
-
-
-TODO:
-> Implement transactional sorting functions (test)
-> possibly add back validation sequence (difference in committing failed user w/o pw)
-> memory handling code (i.e. all the frees I left out)
-> test on boot by having boot call load rather than running through boot (and adding priority file)
->
-
*/
/**
@@ -164,6 +152,11 @@ main(int argc, char** argv)
fprintf(out_stream, "No configuration changes to commit\n");
return 0;
}
+
+ GNode *orig_node_tree = NULL;
+ if (disable_partial_commit == TRUE) {
+ orig_node_tree = g_node_copy(config_data);
+ }
// Get collection of transactions, i.e. trans nodes that have been activated.
GNode *trans_coll = get_transactions(config_data, priority_mode);
@@ -235,6 +228,9 @@ main(int argc, char** argv)
} while ((trans_child_node = (GNode*)g_node_nth_child((GNode*)trans_coll,(guint)i)) != NULL);
if (no_errors == TRUE) {
+ if (disable_partial_commit == TRUE) {
+ complete(orig_node_tree, test_mode);
+ }
common_commit_clean_temp_config(test_mode);
if (g_debug == TRUE) {
printf("commit2: successful commit, now cleaning up temp directories\n");
@@ -306,6 +302,11 @@ process_func(GNode *node, gpointer data)
return FALSE;
}
+ //let's skip any multi-node that does not have have a value (an empty multi-node)
+ if (c->_multi && node->children == NULL) {
+ return FALSE;
+ }
+
//look at parent for multi tag
if (d->_value && d->_name) {
if (g_debug) {
@@ -379,8 +380,7 @@ complete(GNode *node, boolean test_mode)
gpointer gp = ((GNode*)node)->data;
if (g_debug) {
if (((struct VyattaNode*)gp)->_data._name != NULL) {
- printf("commit2::complete():name: %s\n",((struct VyattaNode*)gp)->_data._name);
- printf("commit2::complete():path: %s\n",((struct VyattaNode*)gp)->_data._path);
+ printf("commit2::complete():name: %s, path: %s\n",((struct VyattaNode*)gp)->_data._name,((struct VyattaNode*)gp)->_data._path);
}
else {
printf("commit2::complete()\n");