summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-03-09 22:40:07 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-03-09 22:40:07 -0700
commitf51be17447504aed009f3b31fd6868f02019445d (patch)
tree3a82782aa94ad8d760538b00adde68b234b04520
parent9597176ac1f7f2ddee37fc78102185e844bca70f (diff)
parentbd48938b3dc1634c64c6d099ccf5d193d94c4019 (diff)
downloadvyatta-cfg-f51be17447504aed009f3b31fd6868f02019445d.tar.gz
vyatta-cfg-f51be17447504aed009f3b31fd6868f02019445d.zip
Merge branch 'jenner' of suva.vyatta.com:/git/vyatta-cfg into jenner
-rw-r--r--debian/changelog13
-rw-r--r--src/commit2.c5
-rw-r--r--src/common/unionfs.c36
-rw-r--r--templates/interfaces/ethernet/node.def2
-rw-r--r--templates/interfaces/ethernet/node.tag/address/node.def2
5 files changed, 56 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog
index 6dd45fc..186f488 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,16 @@
+vyatta-cfg (0.14.40) unstable; urgency=low
+
+ [ Stig Thormodsrud ]
+ * Change tag node to use 'create' instead of 'update' since the cli
+ orders them differently.
+
+ [ slioch ]
+ * fix for qos-walkthrough. manage def file during commit--should
+ handle general case, just happened to show up on qos-walkthrough
+ (after def files were supported in the new
+
+ -- slioch <slioch@eng-140.vyatta.com> Mon, 09 Mar 2009 12:20:22 -0700
+
vyatta-cfg (0.14.39) unstable; urgency=low
* Fix show_interfaces() so that it includes vlans for $type='all'.
diff --git a/src/commit2.c b/src/commit2.c
index 0d77fb6..e6b63fa 100644
--- a/src/commit2.c
+++ b/src/commit2.c
@@ -1,6 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#include <syslog.h>
#include <sys/time.h>
#include <glib-2.0/glib.h>
#include "common/common.h"
@@ -231,6 +232,9 @@ main(int argc, char** argv)
if (disable_partial_commit == TRUE) {
complete(orig_node_tree, test_mode);
}
+ /*
+ * Need to add to the following func below to clean up dangling .wh. files
+ */
common_commit_clean_temp_config(test_mode);
if (g_debug == TRUE) {
printf("commit2: successful commit, now cleaning up temp directories\n");
@@ -363,6 +367,7 @@ process_func(GNode *node, gpointer data)
}
if (!status) { //EXECUTE_LIST RETURNS FALSE ON FAILURE....
+ syslog(LOG_ERR,"commit error for %s:[%s]\n",ActionNames[result->_action],d->_path);
if (g_display_error_node) {
fprintf(out_stream,"%s:[%s]\n",ActionNames[result->_action],d->_path);
}
diff --git a/src/common/unionfs.c b/src/common/unionfs.c
index 4cb2ed6..4e62b01 100644
--- a/src/common/unionfs.c
+++ b/src/common/unionfs.c
@@ -524,6 +524,7 @@ common_commit_copy_to_live_config(GNode *node, boolean test_mode)
}
char *command = malloc(MAX_LENGTH_DIR_PATH);
static const char format0[]="mkdir -p %s ; /bin/true";
+ static const char formatpoint5[]="rm -fr %s"; /*tmpp*/
static const char format1[]="cp -r -f %s/* %s"; /*mdirp, tmpp*/
static const char format2[]="sudo umount %s"; //mdirp
@@ -564,6 +565,16 @@ common_commit_copy_to_live_config(GNode *node, boolean test_mode)
return;
}
+ //have to clean out tbuf before copying
+ sprintf(command, formatpoint5, tbuf);
+ if (g_debug) {
+ printf("%s\n",command);
+ fflush(NULL);
+ }
+ if (test_mode == FALSE) {
+ system(command);
+ }
+
//mkdir temp merge
sprintf(command,format0,tbuf);
if (g_debug) {
@@ -574,6 +585,8 @@ common_commit_copy_to_live_config(GNode *node, boolean test_mode)
system(command);
}
+
+
//cp merge to temp merge
sprintf(command, format1, mbuf, tbuf);
if (g_debug) {
@@ -622,6 +635,13 @@ common_commit_clean_temp_config(boolean test_mode)
}
//first clean up the root
// common_commit_copy_to_live_config("/");
+
+ /*
+ * Need to add to the following func below to clean up dangling .wh. files.
+ * This pass needs to be prior to the commands below (but after the umount).
+ * This fixes a bug when higher priority root nodes are deleted and not removed.
+ */
+
char *command;
command = malloc(MAX_LENGTH_DIR_PATH);
@@ -1020,12 +1040,28 @@ copy_func(GNode *node, gpointer data)
struct SrcDst *sd = (struct SrcDst*)data;
static const char format[]="mkdir -p %s%s";/*tmpp, adirp*/
static const char format_value[]="cp %s%s{node.val,def} %s%s. 2>/dev/null";/*tmpp, adirp*/
+ static const char clear_def[]="rm %s%sdef 2>/dev/null";/*adirp*/
char *path = ((struct VyattaNode*)(node->data))->_data._path;
//might not work for terminating multinodes as the node.val won't be copied
if (((struct VyattaNode*)(node->data))->_data._value == TRUE &&
((struct VyattaNode*)(node->data))->_config._def.tag == FALSE) {
//THIS IS ONLY FOR NODE.VAL (or leafs, term multis)
+
+ //before copy also need to clear out def file in active directory (will copy over current if found)
+ //this is for the case where it is set by default, then unset at the node--i.e. no longer a default value.
+ if (((struct VyattaNode*)(node->data))->_config._multi == FALSE) { //only for leaf
+ char *parent_path = ((struct VyattaNode*)(node->parent->data))->_data._path;
+ sprintf(command,clear_def,sd->_dst,parent_path,sd->_dst,parent_path);
+ if (g_debug) {
+ printf("%s\n",command);
+ fflush(NULL);
+ }
+ if (sd->_test_mode == FALSE) {
+ system(command);
+ }
+ }
+
char *parent_path = ((struct VyattaNode*)(node->parent->data))->_data._path;
sprintf(command,format_value,sd->_src,parent_path,sd->_dst,parent_path);
if (g_debug) {
diff --git a/templates/interfaces/ethernet/node.def b/templates/interfaces/ethernet/node.def
index c231b74..d4e86c4 100644
--- a/templates/interfaces/ethernet/node.def
+++ b/templates/interfaces/ethernet/node.def
@@ -4,6 +4,6 @@ help: Set ethernet interface
syntax:expression: exec \
"/opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(@) --check=ethernet"
allowed: /opt/vyatta/sbin/vyatta-interfaces.pl --show=ethernet
-update: sudo ip link set "$VAR(@)" up
+create: sudo ip link set "$VAR(@)" up
/opt/vyatta/sbin/vyatta-link-detect $VAR(@) on
delete: sudo ip link set "$VAR(@)" down
diff --git a/templates/interfaces/ethernet/node.tag/address/node.def b/templates/interfaces/ethernet/node.tag/address/node.def
index afbd822..dd4d5fa 100644
--- a/templates/interfaces/ethernet/node.tag/address/node.def
+++ b/templates/interfaces/ethernet/node.tag/address/node.def
@@ -3,7 +3,7 @@ type: txt
help: Set an IP address for this interface
syntax:expression: exec "/opt/vyatta/sbin/vyatta-interfaces.pl --valid-addr $VAR(@) --dev $VAR(../@)"\
; "Invalid IP address/prefix [$VAR(@)] for interface $VAR(../@)"
-update:sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-update $VAR(@) --dev $VAR(../@)
+create:sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-update $VAR(@) --dev $VAR(../@)
delete:sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-delete $VAR(@) --dev $VAR(../@)
allowed: echo "dhcp <>"
comp_help:Possible completions: