bosh-director 1.2448.0 → 1.2479.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -53,7 +53,7 @@ module Bosh::Director
53
53
  agent = AgentClient.with_defaults(agent_id)
54
54
 
55
55
  drain_time = agent.drain("shutdown")
56
- if drain_time < 0
56
+ while drain_time < 0
57
57
  drain_time = drain_time.abs
58
58
  begin
59
59
  Config.job_cancelled?
@@ -64,10 +64,10 @@ module Bosh::Director
64
64
  @logger.warn("Failed to check drain-status: #{e.inspect}")
65
65
  raise if e.kind_of?(Bosh::Director::TaskCancelled)
66
66
  break
67
- end while drain_time > 0
68
- else
69
- sleep(drain_time)
67
+ end
70
68
  end
69
+
70
+ sleep(drain_time)
71
71
  agent.stop
72
72
  end
73
73
 
@@ -55,6 +55,10 @@ module Bosh::Director
55
55
  end
56
56
  end
57
57
 
58
+ def task_cancelled?
59
+ super unless @ignore_cancellation
60
+ end
61
+
58
62
  private
59
63
 
60
64
  def with_updated_instances(deployment, job, &blk)
@@ -71,15 +75,23 @@ module Bosh::Director
71
75
 
72
76
  blk.call
73
77
  ensure
74
- logger.info('Starting to delete job instances')
75
- job_manager(deployment, job).delete_instances
78
+ ignore_cancellation do
79
+ logger.info('Starting to delete job instances')
80
+ job_manager(deployment, job).delete_instances
76
81
 
77
- logger.info('Starting to refill resource pool')
78
- rp_manager(job).refill
82
+ logger.info('Starting to refill resource pool')
83
+ rp_manager(job).refill
84
+ end
79
85
  end
80
86
  end
81
87
  end
82
88
 
89
+ def ignore_cancellation
90
+ @ignore_cancellation = true
91
+ yield
92
+ @ignore_cancellation = false
93
+ end
94
+
83
95
  def prepare_deployment(deployment, job)
84
96
  deployment_preparer = Errand::DeploymentPreparer.new(
85
97
  deployment, job, event_log, self)
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Director
3
- VERSION = '1.2448.0'
3
+ VERSION = '1.2479.0'
4
4
  end
5
5
  end
data/lib/cloud/dummy.rb CHANGED
@@ -40,9 +40,6 @@ module Bosh
40
40
  # rubocop:disable ParameterLists
41
41
  def create_vm(agent_id, stemcell, resource_pool, networks, disk_locality = nil, env = nil)
42
42
  # rubocop:enable ParameterLists
43
- root_dir = File.join(agent_base_dir(agent_id), 'root_dir')
44
- FileUtils.mkdir_p(File.join(root_dir, 'etc', 'logrotate.d'))
45
-
46
43
  write_agent_settings(agent_id, {
47
44
  agent_id: agent_id,
48
45
  blobstore: @options['agent']['blobstore'],
@@ -52,10 +49,7 @@ module Bosh
52
49
  mbus: @options['nats'],
53
50
  })
54
51
 
55
- agent_cmd = agent_cmd(agent_id, root_dir)
56
- agent_log = "#{@base_dir}/agent.#{agent_id}.log"
57
- agent_pid = Process.spawn(*agent_cmd, chdir: agent_base_dir(agent_id), out: agent_log, err: agent_log)
58
- Process.detach(agent_pid)
52
+ agent_pid = spawn_agent_process(agent_id)
59
53
 
60
54
  FileUtils.mkdir_p(@running_vms_dir)
61
55
  File.write(vm_file(agent_pid), agent_id)
@@ -150,8 +144,30 @@ module Bosh
150
144
  end
151
145
  end
152
146
 
147
+ def agent_log_path(agent_id)
148
+ "#{@base_dir}/agent.#{agent_id}.log"
149
+ end
150
+
153
151
  private
154
152
 
153
+ def spawn_agent_process(agent_id)
154
+ root_dir = File.join(agent_base_dir(agent_id), 'root_dir')
155
+ FileUtils.mkdir_p(File.join(root_dir, 'etc', 'logrotate.d'))
156
+
157
+ agent_cmd = agent_cmd(agent_id, root_dir)
158
+ agent_log = agent_log_path(agent_id)
159
+
160
+ agent_pid = Process.spawn(*agent_cmd, {
161
+ chdir: agent_base_dir(agent_id),
162
+ out: agent_log,
163
+ err: agent_log,
164
+ })
165
+
166
+ Process.detach(agent_pid)
167
+
168
+ agent_pid
169
+ end
170
+
155
171
  def agent_id_for_vm_id(vm_id)
156
172
  File.read(vm_file(vm_id))
157
173
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh-director
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2448.0
4
+ version: 1.2479.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-22 00:00:00.000000000 Z
12
+ date: 2014-04-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bcrypt-ruby
@@ -34,7 +34,7 @@ dependencies:
34
34
  requirements:
35
35
  - - ~>
36
36
  - !ruby/object:Gem::Version
37
- version: 1.2448.0
37
+ version: 1.2479.0
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
- version: 1.2448.0
45
+ version: 1.2479.0
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: bosh-core
48
48
  requirement: !ruby/object:Gem::Requirement
@@ -50,7 +50,7 @@ dependencies:
50
50
  requirements:
51
51
  - - ~>
52
52
  - !ruby/object:Gem::Version
53
- version: 1.2448.0
53
+ version: 1.2479.0
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,7 +58,7 @@ dependencies:
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: 1.2448.0
61
+ version: 1.2479.0
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: bosh-director-core
64
64
  requirement: !ruby/object:Gem::Requirement
@@ -66,7 +66,7 @@ dependencies:
66
66
  requirements:
67
67
  - - ~>
68
68
  - !ruby/object:Gem::Version
69
- version: 1.2448.0
69
+ version: 1.2479.0
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
@@ -74,7 +74,7 @@ dependencies:
74
74
  requirements:
75
75
  - - ~>
76
76
  - !ruby/object:Gem::Version
77
- version: 1.2448.0
77
+ version: 1.2479.0
78
78
  - !ruby/object:Gem::Dependency
79
79
  name: bosh_common
80
80
  requirement: !ruby/object:Gem::Requirement
@@ -82,7 +82,7 @@ dependencies:
82
82
  requirements:
83
83
  - - ~>
84
84
  - !ruby/object:Gem::Version
85
- version: 1.2448.0
85
+ version: 1.2479.0
86
86
  type: :runtime
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
@@ -90,7 +90,7 @@ dependencies:
90
90
  requirements:
91
91
  - - ~>
92
92
  - !ruby/object:Gem::Version
93
- version: 1.2448.0
93
+ version: 1.2479.0
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: bosh_cpi
96
96
  requirement: !ruby/object:Gem::Requirement
@@ -98,7 +98,7 @@ dependencies:
98
98
  requirements:
99
99
  - - ~>
100
100
  - !ruby/object:Gem::Version
101
- version: 1.2448.0
101
+ version: 1.2479.0
102
102
  type: :runtime
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
@@ -106,7 +106,7 @@ dependencies:
106
106
  requirements:
107
107
  - - ~>
108
108
  - !ruby/object:Gem::Version
109
- version: 1.2448.0
109
+ version: 1.2479.0
110
110
  - !ruby/object:Gem::Dependency
111
111
  name: bosh_openstack_cpi
112
112
  requirement: !ruby/object:Gem::Requirement
@@ -114,7 +114,7 @@ dependencies:
114
114
  requirements:
115
115
  - - ~>
116
116
  - !ruby/object:Gem::Version
117
- version: 1.2448.0
117
+ version: 1.2479.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
@@ -122,7 +122,7 @@ dependencies:
122
122
  requirements:
123
123
  - - ~>
124
124
  - !ruby/object:Gem::Version
125
- version: 1.2448.0
125
+ version: 1.2479.0
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: bosh_aws_cpi
128
128
  requirement: !ruby/object:Gem::Requirement
@@ -130,7 +130,7 @@ dependencies:
130
130
  requirements:
131
131
  - - ~>
132
132
  - !ruby/object:Gem::Version
133
- version: 1.2448.0
133
+ version: 1.2479.0
134
134
  type: :runtime
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
@@ -138,7 +138,7 @@ dependencies:
138
138
  requirements:
139
139
  - - ~>
140
140
  - !ruby/object:Gem::Version
141
- version: 1.2448.0
141
+ version: 1.2479.0
142
142
  - !ruby/object:Gem::Dependency
143
143
  name: bosh_vsphere_cpi
144
144
  requirement: !ruby/object:Gem::Requirement
@@ -146,7 +146,7 @@ dependencies:
146
146
  requirements:
147
147
  - - ~>
148
148
  - !ruby/object:Gem::Version
149
- version: 1.2448.0
149
+ version: 1.2479.0
150
150
  type: :runtime
151
151
  prerelease: false
152
152
  version_requirements: !ruby/object:Gem::Requirement
@@ -154,7 +154,7 @@ dependencies:
154
154
  requirements:
155
155
  - - ~>
156
156
  - !ruby/object:Gem::Version
157
- version: 1.2448.0
157
+ version: 1.2479.0
158
158
  - !ruby/object:Gem::Dependency
159
159
  name: bosh_vcloud_cpi
160
160
  requirement: !ruby/object:Gem::Requirement
@@ -493,7 +493,7 @@ dependencies:
493
493
  version: '1.0'
494
494
  description: ! 'BOSH Director
495
495
 
496
- c436f4'
496
+ fc12be'
497
497
  email: support@cloudfoundry.com
498
498
  executables:
499
499
  - bosh-director
@@ -749,7 +749,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
749
749
  version: '0'
750
750
  segments:
751
751
  - 0
752
- hash: -4349204265508547601
752
+ hash: 1900748617066523341
753
753
  requirements: []
754
754
  rubyforge_project:
755
755
  rubygems_version: 1.8.23