| index fe5b56ec5..7e5c32fa4 100644 |
| --- a/internal/appconfig/syncexec.go |
| +++ b/internal/appconfig/syncexec.go |
| @@ -671,10 +671,15 @@ func (r RestartPending) Empty() bool { |
| } |
| |
| // BlockedStamps applies the door-side rails to the stamped routes of |
| -// (acct, app) in routes. Uniqueness is checked against the FULL list, so |
| -// a route of another account blocks this one, but only this account's |
| -// hosts are returned and no other account's host is named in a reason. |
| -func BlockedStamps(routes []registry.Route, acct, app string) []BlockedHost { |
| +// (acct, app) in routes. Uniqueness is checked against the FULL list |
| +// regardless of envName, so a route of another account or another |
| +// environment still blocks this one's unit — but only this account's |
| +// hosts are returned, no other account's host is named in a reason, and |
| +// (spec §3.4: "the same environment and account narrowing applies as for |
| +// Hosts") only routes bound to envName ("" = every route of the app) are |
| +// returned, so a write to one environment does not report a blocked route |
| +// it never reached. |
| +func BlockedStamps(routes []registry.Route, acct, app, envName string) []BlockedHost { |
| byUnit := map[string]int{} |
| for _, rt := range routes { |
| if Stamped(rt) && StampShape(rt) == nil && DeliverableUnitName(rt.Unit) == nil && BareHostname(rt.Host) { |
| @@ -686,6 +691,9 @@ func BlockedStamps(routes []registry.Route, acct, app string) []BlockedHost { |
| if !Stamped(rt) || rt.App != app || release.RouteAccount(rt) != acct { |
| continue |
| } |
| + if envName != "" && rt.Environment != envName { |
| + continue |
| + } |
| switch { |
| case StampShape(rt) != nil: |
| out = append(out, BlockedHost{rt.Host, StampShape(rt).Error()}) |
| @@ -728,7 +736,7 @@ func BlockedStamps(routes []registry.Route, acct, app string) []BlockedHost { |
| // short list read as a complete one. |
| func AwaitingRestart(ctx context.Context, s release.Store, routes []registry.Route, acct, app, envName string, keys []string) RestartPending { |
| var out RestartPending |
| - out.Blocked = BlockedStamps(routes, acct, app) |
| + out.Blocked = BlockedStamps(routes, acct, app, envName) |
| blocked := map[string]bool{} |
| for _, b := range out.Blocked { |
| blocked[b.Host] = true |