mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-28 16:40:37 +00:00
MINOR: dumpstat/conf: display all the configuration lines that using pattern reference
This commit is contained in:
parent
eeaa951726
commit
94580c9f52
@ -186,7 +186,7 @@ int pat_ref_load(struct pat_ref *ref, struct pattern_expr *expr, int patflags, i
|
||||
*/
|
||||
void pattern_init_head(struct pattern_head *head);
|
||||
void pattern_prune(struct pattern_head *head);
|
||||
int pattern_read_from_file(struct pattern_head *head, unsigned int refflags, const char *filename, int patflags, int load_smp, char **err, const char *display, const char *file, int line);
|
||||
int pattern_read_from_file(struct pattern_head *head, unsigned int refflags, const char *filename, int patflags, int load_smp, char **err, const char *file, int line);
|
||||
|
||||
/*
|
||||
* pattern_expr manipulation.
|
||||
|
@ -449,11 +449,7 @@ struct acl_expr *parse_acl_expr(const char **args, char **err, struct arg_list *
|
||||
goto out_free_expr;
|
||||
}
|
||||
|
||||
/* Create displayed reference */
|
||||
snprintf(trash.str, trash.size, "acl(s) loaded from file '%s'", args[1]);
|
||||
trash.str[trash.size - 1] = '\0';
|
||||
|
||||
if (!pattern_read_from_file(&expr->pat, PAT_REF_ACL, args[1], patflags | PAT_F_FROM_FILE, load_as_map, err, trash.str, file, line))
|
||||
if (!pattern_read_from_file(&expr->pat, PAT_REF_ACL, args[1], patflags | PAT_F_FROM_FILE, load_as_map, err, file, line))
|
||||
goto out_free_expr;
|
||||
is_loaded = 1;
|
||||
args++;
|
||||
|
@ -152,13 +152,9 @@ static int sample_load_map(struct arg *arg, struct sample_conv *conv,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Build displayed message. */
|
||||
snprintf(trash.str, trash.size, "map(s) loaded from file '%s'", arg[0].data.str.str);
|
||||
trash.str[trash.size - 1] = '\0';
|
||||
|
||||
/* Load map. */
|
||||
if (!pattern_read_from_file(&desc->pat, PAT_REF_MAP, arg[0].data.str.str, 0,
|
||||
1, err, trash.str, file, line))
|
||||
1, err, file, line))
|
||||
return 0;
|
||||
|
||||
/* The second argument is the default value */
|
||||
|
@ -1972,8 +1972,7 @@ int pat_ref_read_from_file(struct pat_ref *ref, const char *filename, char **err
|
||||
|
||||
int pattern_read_from_file(struct pattern_head *head, unsigned int refflags,
|
||||
const char *filename, int patflags, int load_smp,
|
||||
char **err, const char *display, const char *file,
|
||||
int line)
|
||||
char **err, const char *file, int line)
|
||||
{
|
||||
struct pat_ref *ref;
|
||||
struct pattern_expr *expr;
|
||||
@ -1984,7 +1983,11 @@ int pattern_read_from_file(struct pattern_head *head, unsigned int refflags,
|
||||
|
||||
/* If the reference doesn't exists, create it and load associated file. */
|
||||
if (!ref) {
|
||||
ref = pat_ref_new(filename, display, refflags);
|
||||
chunk_printf(&trash,
|
||||
"pattern loaded from file '%s' used by %s at file '%s' line %d",
|
||||
filename, refflags & PAT_REF_MAP ? "map" : "acl", file, line);
|
||||
|
||||
ref = pat_ref_new(filename, trash.str, refflags);
|
||||
if (!ref) {
|
||||
memprintf(err, "out of memory");
|
||||
return 0;
|
||||
@ -2026,6 +2029,17 @@ int pattern_read_from_file(struct pattern_head *head, unsigned int refflags,
|
||||
}
|
||||
}
|
||||
|
||||
/* Extends display */
|
||||
chunk_printf(&trash, "%s", ref->display);
|
||||
chunk_appendf(&trash, ", by %s at file '%s' line %d",
|
||||
refflags & PAT_REF_MAP ? "map" : "acl", file, line);
|
||||
free(ref->display);
|
||||
ref->display = strdup(trash.str);
|
||||
if (!ref->display) {
|
||||
memprintf(err, "out of memory");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Merge flags. */
|
||||
ref->flags |= refflags;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user