Class: Bosh::Director::InstanceUpdater::InstanceState
- Defined in:
- lib/bosh/director/instance_updater/instance_state.rb
Class Method Summary collapse
- .with_instance_update(instance_model, &update_procedure) ⇒ Object
- .with_instance_update_and_event_creation(instance_model, parent_id, deployment_name, action, &update_procedure) ⇒ Object
Class Method Details
.with_instance_update(instance_model, &update_procedure) ⇒ Object
3 4 5 6 7 |
# File 'lib/bosh/director/instance_updater/instance_state.rb', line 3 def self.with_instance_update(instance_model, &update_procedure) instance_model.update(update_completed: false) update_procedure.call instance_model.update(update_completed: true) end |
.with_instance_update_and_event_creation(instance_model, parent_id, deployment_name, action, &update_procedure) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/bosh/director/instance_updater/instance_state.rb', line 9 def self.with_instance_update_and_event_creation(instance_model, parent_id, deployment_name, action, &update_procedure) begin self.with_instance_update(instance_model, &update_procedure) rescue Exception => e raise e ensure Config.current_job.event_manager.create_event( { parent_id: parent_id, user: Config.current_job.username, action: action, object_type: 'instance', object_name: instance_model.name, task: Config.current_job.task_id, deployment: deployment_name, instance: instance_model.name, error: e, context: {} }) end end |