If an isolator's request is nil, populate it with the limit and vice versa.

The appc spec isn't currently clear about if both fields are required, and before rkt v0.8.1 if either field
was nil it would result in a crash.  Currently rkt will ignore isolators that don't have both fields set, so
I think this is a reasonable approach to making sure isolators are actually used.
This commit is contained in:
Jonathan Wills 2015-09-18 09:51:32 -04:00
parent 0f8cc8926f
commit ad085f78fe

View File

@ -214,10 +214,10 @@ func rawValue(value string) *json.RawMessage {
// rawValue converts the request, limit to *json.RawMessage
func rawRequestLimit(request, limit string) *json.RawMessage {
if request == "" {
return rawValue(fmt.Sprintf(`{"limit":%q}`, limit))
request = limit
}
if limit == "" {
return rawValue(fmt.Sprintf(`{"request":%q}`, request))
limit = request
}
return rawValue(fmt.Sprintf(`{"request":%q,"limit":%q}`, request, limit))
}