Class: Bosh::Director::PostDeploymentScriptRunner
- Defined in:
- lib/bosh/director/post_deployment_script_runner.rb
Class Method Summary collapse
- .run_post_deploys_after_deployment(deployment_plan) ⇒ Object
- .run_post_deploys_after_resurrection(deployment) ⇒ Object
Class Method Details
.run_post_deploys_after_deployment(deployment_plan) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/bosh/director/post_deployment_script_runner.rb', line 26 def self.run_post_deploys_after_deployment(deployment_plan) return unless Config.enable_post_deploy ThreadPool.new(:max_threads => Config.max_threads).wrap do |pool| deployment_plan.instance_groups.each do |job| # No ignored instances will ever come to this point as they were filtered out earlier # BUT JUST IN CASE, check for the ignore flag job.instances.select{|instance| instance.model[:vm_cid] != nil && instance.model.state != "stopped" && !instance.model.ignore}.each do |instance| pool.process do instance.agent_client.run_script('post-deploy', {}) end end end end end |
.run_post_deploys_after_resurrection(deployment) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/bosh/director/post_deployment_script_runner.rb', line 4 def self.run_post_deploys_after_resurrection(deployment) return unless Config.enable_post_deploy instances = Models::Instance.filter(deployment: deployment).exclude(vm_cid: nil).all = { timeout: 10, retry_methods: {get_state: 0} } ThreadPool.new(:max_threads => Config.max_threads).wrap do |pool| instances.each do |instance| pool.process do agent = AgentClient.with_vm_credentials_and_agent_id(instance.credentials, instance.agent_id, ) begin agent.run_script('post-deploy', {}) rescue Bosh::Director::RpcTimeout # Ignoring timeout errors end end end end end |