mirror of
https://github.com/haproxy/haproxy.git
synced 2026-03-28 13:24:28 -04:00
BUG/MINOR: config: Warn only if warnif_cond_conflicts report a conflict
When warnif_cond_conflicts() is called, we must take care to emit a warning only when a conflict is reported. We cannot rely on the err_code variable because some warnings may have been already reported. We now rely on the errmsg variable. If it contains something, a warning is emitted. It is good enough becasue warnif_cond_conflicts() only reports warnings. This patch should fix the issue #3305. It is a 3.4-dev specific issue. No backport needed.
This commit is contained in:
parent
0e36267aac
commit
4e99cddde4
1 changed files with 10 additions and 10 deletions
|
|
@ -1365,7 +1365,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
|
|||
if (curproxy->cap & PR_CAP_BE)
|
||||
where |= SMP_VAL_BE_HRQ_HDR;
|
||||
err_code |= warnif_cond_conflicts(rule->cond, where, &errmsg);
|
||||
if (err_code)
|
||||
if (errmsg && *errmsg)
|
||||
ha_warning("parsing [%s:%d] : '%s.\n'", file, linenum, errmsg);
|
||||
|
||||
LIST_APPEND(&curproxy->http_req_rules, &rule->list);
|
||||
|
|
@ -1400,7 +1400,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
|
|||
if (curproxy->cap & PR_CAP_BE)
|
||||
where |= SMP_VAL_BE_HRS_HDR;
|
||||
err_code |= warnif_cond_conflicts(rule->cond, where, &errmsg);
|
||||
if (err_code)
|
||||
if (errmsg && *errmsg)
|
||||
ha_warning("parsing [%s:%d] : '%s.\n'", file, linenum, errmsg);
|
||||
|
||||
LIST_APPEND(&curproxy->http_res_rules, &rule->list);
|
||||
|
|
@ -1434,7 +1434,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
|
|||
if (curproxy->cap & PR_CAP_BE)
|
||||
where |= SMP_VAL_BE_HRS_HDR;
|
||||
err_code |= warnif_cond_conflicts(rule->cond, where, &errmsg);
|
||||
if (err_code)
|
||||
if (errmsg && *errmsg)
|
||||
ha_warning("parsing [%s:%d] : '%s.\n'", file, linenum, errmsg);
|
||||
|
||||
LIST_APPEND(&curproxy->http_after_res_rules, &rule->list);
|
||||
|
|
@ -1498,7 +1498,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
|
|||
if (curproxy->cap & PR_CAP_BE)
|
||||
where |= SMP_VAL_BE_HRQ_HDR;
|
||||
err_code |= warnif_cond_conflicts(rule->cond, where, &errmsg);
|
||||
if (err_code)
|
||||
if (errmsg && *errmsg)
|
||||
ha_warning("parsing [%s:%d] : '%s.\n'", file, linenum, errmsg);
|
||||
}
|
||||
else if (strcmp(args[0], "use_backend") == 0) {
|
||||
|
|
@ -1528,7 +1528,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
|
|||
}
|
||||
|
||||
err_code |= warnif_cond_conflicts(cond, SMP_VAL_FE_SET_BCK, &errmsg);
|
||||
if (err_code)
|
||||
if (errmsg && *errmsg)
|
||||
ha_warning("parsing [%s:%d] : '%s.\n'", file, linenum, errmsg);
|
||||
}
|
||||
else if (*args[2]) {
|
||||
|
|
@ -1591,7 +1591,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
|
|||
}
|
||||
|
||||
err_code |= warnif_cond_conflicts(cond, SMP_VAL_BE_SET_SRV, &errmsg);
|
||||
if (err_code)
|
||||
if (errmsg && *errmsg)
|
||||
ha_warning("parsing [%s:%d] : '%s.\n'", file, linenum, errmsg);
|
||||
|
||||
rule = calloc(1, sizeof(*rule));
|
||||
|
|
@ -1646,7 +1646,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
|
|||
* where force-persist is applied.
|
||||
*/
|
||||
err_code |= warnif_cond_conflicts(cond, SMP_VAL_BE_REQ_CNT, &errmsg);
|
||||
if (err_code)
|
||||
if (errmsg && *errmsg)
|
||||
ha_warning("parsing [%s:%d] : '%s.\n'", file, linenum, errmsg);
|
||||
|
||||
rule = calloc(1, sizeof(*rule));
|
||||
|
|
@ -1814,7 +1814,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
|
|||
err_code |= warnif_cond_conflicts(cond, SMP_VAL_BE_STO_RUL, &errmsg);
|
||||
else
|
||||
err_code |= warnif_cond_conflicts(cond, SMP_VAL_BE_SET_SRV, &errmsg);
|
||||
if (err_code)
|
||||
if (errmsg && *errmsg)
|
||||
ha_warning("parsing [%s:%d] : '%s.\n'", file, linenum, errmsg);
|
||||
|
||||
rule = calloc(1, sizeof(*rule));
|
||||
|
|
@ -1872,7 +1872,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
|
|||
if (curproxy->cap & PR_CAP_BE)
|
||||
where |= SMP_VAL_BE_HRQ_HDR;
|
||||
err_code |= warnif_cond_conflicts(cond, where, &errmsg);
|
||||
if (err_code)
|
||||
if (errmsg && *errmsg)
|
||||
ha_warning("parsing [%s:%d] : '%s.\n'", file, linenum, errmsg);
|
||||
|
||||
rule = calloc(1, sizeof(*rule));
|
||||
|
|
@ -1952,7 +1952,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
|
|||
if (curproxy->cap & PR_CAP_BE)
|
||||
where |= SMP_VAL_BE_HRQ_HDR;
|
||||
err_code |= warnif_cond_conflicts(rule->cond, where, &errmsg);
|
||||
if (err_code)
|
||||
if (errmsg && *errmsg)
|
||||
ha_warning("parsing [%s:%d] : '%s.\n'", file, linenum, errmsg);
|
||||
LIST_APPEND(&curproxy->uri_auth->http_req_rules, &rule->list);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue