Validates that all offers belongs to the expected framework.
| 2262 | |
| 2263 | // Validates that all offers belongs to the expected framework. |
| 2264 | Option<Error> validateFramework( |
| 2265 | const RepeatedPtrField<OfferID>& offerIds, |
| 2266 | Master* master, |
| 2267 | Framework* framework) |
| 2268 | { |
| 2269 | foreach (const OfferID& offerId, offerIds) { |
| 2270 | Try<FrameworkID> offerFrameworkId = getFrameworkId(master, offerId); |
| 2271 | if (offerFrameworkId.isError()) { |
| 2272 | return offerFrameworkId.error(); |
| 2273 | } |
| 2274 | |
| 2275 | if (framework->id() != offerFrameworkId.get()) { |
| 2276 | return Error( |
| 2277 | "Offer " + stringify(offerId) + |
| 2278 | " has invalid framework " + stringify(offerFrameworkId.get()) + |
| 2279 | " while framework " + stringify(framework->id()) + " is expected"); |
| 2280 | } |
| 2281 | } |
| 2282 | |
| 2283 | return None(); |
| 2284 | } |
| 2285 | |
| 2286 | |
| 2287 | // Validate that all offers in one operation must be |
no test coverage detected