summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@vyatta.com>2010-11-09 18:14:18 -0800
committerStig Thormodsrud <stig@vyatta.com>2010-11-09 18:14:18 -0800
commitcd9b0d5fa108fe3a24ea8c71cd6be7d0d39f240f (patch)
tree8e254269ecb72fd7fb77b5677974f5185687df0c
parente8e887cb4e7ce38c5e0a0eca8069c0bb2225969d (diff)
parentb63ee9b6c597397f5c80a0b161a8638977f469cc (diff)
downloadvyatta-cfg-cd9b0d5fa108fe3a24ea8c71cd6be7d0d39f240f.tar.gz
vyatta-cfg-cd9b0d5fa108fe3a24ea8c71cd6be7d0d39f240f.zip
Merge branch 'mendocino' of http://git.vyatta.com/vyatta-cfg into mendocino
-rw-r--r--debian/changelog12
-rwxr-xr-xlib/Vyatta/Config.pm11
-rw-r--r--src/commit2.c63
3 files changed, 53 insertions, 33 deletions
diff --git a/debian/changelog b/debian/changelog
index 30f814f..7efa6d9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,15 @@
+vyatta-cfg (0.18.9) unstable; urgency=low
+
+ * additional change in support of error location.
+
+ -- Michael Larson <mike@vyatta.com> Tue, 09 Nov 2010 18:01:31 -0800
+
+vyatta-cfg (0.18.8) unstable; urgency=low
+
+ * make commit aware of error location key and allow for passthrough.
+
+ -- Michael Larson <mike@vyatta.com> Tue, 09 Nov 2010 17:29:59 -0800
+
vyatta-cfg (0.18.7) unstable; urgency=low
[ Michael Larson ]
diff --git a/lib/Vyatta/Config.pm b/lib/Vyatta/Config.pm
index e8fda29..28326dd 100755
--- a/lib/Vyatta/Config.pm
+++ b/lib/Vyatta/Config.pm
@@ -676,13 +676,16 @@ sub compareValueLists {
return %comp_hash;
}
+
sub outputError {
my ($location, $msg) = @_;
- print STDERR $msg . "\n";
if (defined($ENV{VYATTA_OUTPUT_ERROR_LOCATION})) {
- foreach my $elem (@$location) {
- print STDERR "errloc:[" . $elem . "]\n";
- }
+ foreach my $elem (@$location) {
+ print STDERR "_errloc_:[" . $elem . "]\n" . $msg . "\n";
+ }
+ }
+ else {
+ print STDERR $msg . "\n";
}
}
diff --git a/src/commit2.c b/src/commit2.c
index 2f9be94..92f37ed 100644
--- a/src/commit2.c
+++ b/src/commit2.c
@@ -564,36 +564,41 @@ process_func(GNode *node, gpointer data)
status = execute_list(c->_def.actions[result->_action].vtw_list_head,&c->_def,NULL);
}
if (!status && g_print_error_location_all == TRUE) { //EXECUTE_LIST RETURNS FALSE ON FAILURE....
- //just need to convert slashes into spaces here
- char path_buf[1024];
- char tmp[1024];
- char *ptr;
- path_buf[0] = '\0';
-
- strcpy(tmp,d->_path);
- ptr = (char*)tmp;
- char *slash = strchr(tmp,'/');
- if (slash == NULL) {
- strcat(path_buf,d->_path);
+ if (strstr(outbuf,"_errloc_:[") != NULL) {
+ fprintf(out_stream,"%s\n",outbuf);
}
else {
- do { //convert '/' to ' '
- strncat(path_buf,ptr,slash - ptr);
- strcat(path_buf," ");
- ++slash;
- ptr = slash;
- } while ((slash = strchr(slash,'/')) != NULL);
- }
- if (strncmp(ptr,"value:",6) == 0) {
- if (strlen(ptr)-6 > 0) {
- strncat(path_buf,ptr+6,strlen(ptr)-6);
+ //just need to convert slashes into spaces here
+ char path_buf[1024];
+ char tmp[1024];
+ char *ptr;
+ path_buf[0] = '\0';
+
+ strcpy(tmp,d->_path);
+ ptr = (char*)tmp;
+ char *slash = strchr(tmp,'/');
+ if (slash == NULL) {
+ strcat(path_buf,d->_path);
+ }
+ else {
+ do { //convert '/' to ' '
+ strncat(path_buf,ptr,slash - ptr);
+ strcat(path_buf," ");
+ ++slash;
+ ptr = slash;
+ } while ((slash = strchr(slash,'/')) != NULL);
+ }
+ if (strncmp(ptr,"value:",6) == 0) {
+ if (strlen(ptr)-6 > 0) {
+ strncat(path_buf,ptr+6,strlen(ptr)-6);
+ }
+ }
+ char *p = clind_unescape(path_buf);
+
+ if (strlen(outbuf) > 0) {
+ //currently set to format option for GUI client.
+ fprintf(out_stream,"_errloc_:[%s]\n%s\n",p,outbuf);
}
- }
- char *p = clind_unescape(path_buf);
-
- if (strlen(outbuf) > 0) {
- //currently set to format option for GUI client.
- fprintf(out_stream,"_errloc_:[%s]\n%s\n",p,outbuf);
}
}
}
@@ -624,7 +629,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@errloc:[%s]\n",ActionNames[result->_action],d->_path);
+ fprintf(out_stream,"%s@_errloc_:[%s]\n",ActionNames[result->_action],d->_path);
}
result->_err_code = 1;
if (g_debug) {
@@ -1473,7 +1478,7 @@ validate_func(GNode *node, gpointer data)
}
syslog(LOG_ERR,"commit error for %s:[%s]\n",ActionNames[result->_action],d->_path);
if (g_display_error_node) {
- fprintf(out_stream,"%s@errloc:[%s]\n",ActionNames[result->_action],d->_path);
+ fprintf(out_stream,"%s@_errloc_:[%s]\n",ActionNames[result->_action],d->_path);
}
result->_err_code = 1;
if (g_debug) {