| 3109 | } |
| 3110 | |
| 3111 | Future<Response> Master::Http::__updateMaintenanceSchedule( |
| 3112 | const mesos::maintenance::Schedule& schedule, |
| 3113 | const Owned<ObjectApprovers>& approvers) const |
| 3114 | { |
| 3115 | foreach (const mesos::maintenance::Window& window, schedule.windows()) { |
| 3116 | foreach (const MachineID& machine, window.machine_ids()) { |
| 3117 | if (!approvers->approved<UPDATE_MAINTENANCE_SCHEDULE>(machine)) { |
| 3118 | return Forbidden(); |
| 3119 | } |
| 3120 | } |
| 3121 | } |
| 3122 | |
| 3123 | return master->registrar->apply(Owned<RegistryOperation>( |
| 3124 | new maintenance::UpdateSchedule(schedule))) |
| 3125 | .onAny([](const Future<bool>& result) { |
| 3126 | // TODO(fiu): Consider changing/refactoring the registrar itself |
| 3127 | // so the individual call sites don't need to handle this separately. |
| 3128 | // All registrar failures that cause it to abort should instead |
| 3129 | // abort the process. |
| 3130 | CHECK_READY(result) |
| 3131 | << "Failed to update maintenance schedule in the registry"; |
| 3132 | }) |
| 3133 | .then(defer(master->self(), [this, schedule](bool result) { |
| 3134 | return ___updateMaintenanceSchedule(schedule, result); |
| 3135 | })); |
| 3136 | } |
| 3137 | |
| 3138 | Future<Response> Master::Http::___updateMaintenanceSchedule( |
| 3139 | const mesos::maintenance::Schedule& schedule, |