Skip to content

Commit a9d86d1

Browse files
another try to fix without service bug
1 parent 6c5d078 commit a9d86d1

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

manifests/haproxy/autoload.pp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@
9999
$http_response_status410_rules_real = concat($http_response_rules, 'set-status 410 if { var(txn.status410) -m bool }')
100100
}
101101
if 'canonicals' in $http_edge_services and 'status410' in $http_edge_services {
102-
$http_response_rules_real = deep_merge($http_response_canonicals_rules_real, $http_response_status410_rules_real)
102+
$http_response_rules_real_placeholder = concat($http_response_canonicals_rules_real, $http_response_status410_rules_real)
103+
$http_response_rules_real = unique($http_response_rules_real_placeholder)
103104
} elsif 'canonicals' in $http_edge_services {
104105
$http_response_rules_real = $http_response_canonicals_rules_real
105106
} else {
@@ -113,34 +114,41 @@
113114
if 'redirects' in $http_edge_services and grep($http_request_rules, $http_edge_markers['redirects']) == [] {
114115
$http_request_rules_with_redirects = concat($http_request_rules, $http_edge_rules_all_real['redirects'])
115116
}
116-
else {
117+
elsif 'redirects' in $http_edge_services {
117118
$http_request_rules_with_redirects = split(regsubst(join($http_request_rules, "\n"), $http_edge_markers['redirects'], join($http_edge_rules_all_real['redirects'], "\n")), "\n")
119+
} else {
120+
$http_request_rules_with_redirects = $http_request_rules
118121
}
119122

120123
if 'status410' in $http_edge_services and grep($http_request_rules_with_redirects, $http_edge_markers['status410']) == [] {
121124
$http_request_rules_with_status410 = concat($http_request_rules_with_redirects, $http_edge_rules_all_real['status410'])
122125
}
123-
else {
126+
elsif 'status410' in $http_edge_services {
124127
$http_request_rules_with_status410 = split(regsubst(join($http_request_rules_with_redirects, "\n"), $http_edge_markers['status410'], join($http_edge_rules_all_real['status410'], "\n")), "\n")
128+
} else {
129+
$http_request_rules_with_status410 = $http_request_rules_with_redirects
125130
}
126131

127132
if 'nofollow' in $http_edge_services and grep($http_request_rules_with_status410, $http_edge_markers['nofollow']) == [] {
128133
$http_request_rules_with_nofollow = concat($http_request_rules_with_status410, $http_edge_rules_all_real['nofollow'])
129134
}
130-
else {
135+
elsif 'nofollow' in $http_edge_services {
131136
$http_request_rules_with_nofollow = split(regsubst(join($http_request_rules_with_status410, "\n"), $http_edge_markers['nofollow'], join($http_edge_rules_all_real['nofollow'], "\n")), "\n")
137+
} else {
138+
$http_request_rules_with_nofollow = $http_request_rules_with_status410
132139
}
133140

134141
if 'canonicals' in $http_edge_services and grep($http_request_rules_with_nofollow, $http_edge_markers['canonicals']) == [] {
135142
$http_request_rules_real = concat($http_request_rules_with_nofollow, $http_edge_canonicals_rules_real)
136143
}
137-
else {
144+
elsif 'canonicals' in $http_edge_services {
138145
$http_request_rules_real = split(regsubst(join($http_request_rules_with_nofollow, "\n"), $http_edge_markers['canonicals'], join($http_edge_canonicals_rules_real, "\n")), "\n")
146+
} else {
147+
$http_request_rules_real = $http_request_rules_with_nofollow
139148
}
140149

141150
$http_request_rules_hash = {$http_edge_frontend => {'options' => {'http-request' => $http_request_rules_real}}}
142-
$frontends_real = deep_merge($ducktape::haproxy::frontends, $http_request_rules_hash)
143-
if 'canonicals' in $http_edge_services {
151+
if 'canonicals' in $http_edge_services or 'status410' in $http_edge_services {
144152
$frontends_real_placeholder = deep_merge($ducktape::haproxy::frontends, $http_request_rules_hash)
145153
$frontends_real = deep_merge($frontends_real_placeholder, $http_response_rules_hash)
146154
} else {

0 commit comments

Comments
 (0)