bosh-stemcell 1.5.0.pre.1210 → 1.5.0.pre.1211

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,16 +1,21 @@
1
1
  module Bosh::Stemcell
2
2
  class ArchiveFilename
3
- def initialize(version, infrastructure, operating_system, base_name, light)
3
+ # rubocop:disable ParameterLists
4
+ def initialize(version, infrastructure, operating_system, base_name, light, agent_name = 'ruby')
4
5
  @version = version
5
6
  @infrastructure = infrastructure
6
7
  @operating_system = operating_system
7
8
  @base_name = base_name
8
9
  @light = light
10
+ @agent_name = agent_name
9
11
  end
12
+ # rubocop:enable ParameterLists
10
13
 
11
14
  def to_s
12
15
  stemcell_filename_parts = [name, version, infrastructure.name, infrastructure.hypervisor, operating_system.name]
13
16
 
17
+ stemcell_filename_parts << "#{agent_name}_agent" unless agent_name == 'ruby'
18
+
14
19
  "#{stemcell_filename_parts.join('-')}.tgz"
15
20
  end
16
21
 
@@ -20,10 +25,13 @@ module Bosh::Stemcell
20
25
  light ? "light-#{base_name}" : base_name
21
26
  end
22
27
 
23
- attr_reader :base_name,
24
- :version,
25
- :infrastructure,
26
- :operating_system,
27
- :light
28
+ attr_reader(
29
+ :base_name,
30
+ :version,
31
+ :infrastructure,
32
+ :operating_system,
33
+ :light,
34
+ :agent_name,
35
+ )
28
36
  end
29
37
  end
@@ -22,6 +22,7 @@ module Bosh::Stemcell
22
22
  stemcell_version: options.fetch(:version),
23
23
  infrastructure: infrastructure,
24
24
  operating_system: operating_system,
25
+ agent_name: agent_name,
25
26
  )
26
27
  @shell = Bosh::Core::Shell.new
27
28
  end
@@ -8,6 +8,7 @@ module Bosh::Stemcell
8
8
  @environment = env
9
9
  @infrastructure = options.fetch(:infrastructure)
10
10
  @operating_system = options.fetch(:operating_system)
11
+ @agent_name = options.fetch(:agent_name)
11
12
 
12
13
  @stemcell_version = options.fetch(:stemcell_version)
13
14
  @image_create_disk_size = options.fetch(:disk_size, infrastructure.default_disk_size)
@@ -15,8 +16,11 @@ module Bosh::Stemcell
15
16
  end
16
17
 
17
18
  def default
19
+ stemcell_name = "bosh-#{infrastructure.name}-#{infrastructure.hypervisor}-#{operating_system.name}"
20
+ stemcell_name += "-#{agent_name}_agent" unless agent_name == 'ruby'
21
+
18
22
  {
19
- 'stemcell_name' => "bosh-#{infrastructure.name}-#{infrastructure.hypervisor}-#{operating_system.name}",
23
+ 'stemcell_name' => stemcell_name,
20
24
  'stemcell_tgz' => archive_filename.to_s,
21
25
  'stemcell_image_name' => stemcell_image_name,
22
26
  'stemcell_version' => stemcell_version,
@@ -38,6 +42,7 @@ module Bosh::Stemcell
38
42
  :environment,
39
43
  :infrastructure,
40
44
  :operating_system,
45
+ :agent_name,
41
46
  :stemcell_version,
42
47
  :image_create_disk_size,
43
48
  :bosh_micro_release_tgz_path
@@ -68,7 +73,7 @@ module Bosh::Stemcell
68
73
  end
69
74
 
70
75
  def archive_filename
71
- ArchiveFilename.new(stemcell_version, infrastructure, operating_system, 'bosh-stemcell', false)
76
+ ArchiveFilename.new(stemcell_version, infrastructure, operating_system, 'bosh-stemcell', false, agent_name)
72
77
  end
73
78
 
74
79
  def stemcell_image_name
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Stemcell
3
- VERSION = '1.5.0.pre.1210'
3
+ VERSION = '1.5.0.pre.1211'
4
4
  end
5
5
  end
@@ -37,6 +37,20 @@ module Bosh::Stemcell
37
37
  expect(archive_filename.to_s).to eq ('light-FAKE_NAME-007-INFRASTRUCTURE-HYPERVISOR-OPERATING_SYSTEM.tgz')
38
38
  end
39
39
  end
40
+
41
+ context 'when stemcell has ruby agent' do
42
+ it 'does not include the agent name in the archive name' do
43
+ archive_filename = ArchiveFilename.new(version, infrastructure, operating_system, 'FAKE_NAME', false, 'ruby')
44
+ expect(archive_filename.to_s).to eq ('FAKE_NAME-007-INFRASTRUCTURE-HYPERVISOR-OPERATING_SYSTEM.tgz')
45
+ end
46
+ end
47
+
48
+ context 'when stemcell has go agent' do
49
+ it 'includes go_agent in the archive name' do
50
+ archive_filename = ArchiveFilename.new(version, infrastructure, operating_system, 'FAKE_NAME', false, 'go')
51
+ expect(archive_filename.to_s).to eq ('FAKE_NAME-007-INFRASTRUCTURE-HYPERVISOR-OPERATING_SYSTEM-go_agent.tgz')
52
+ end
53
+ end
40
54
  end
41
55
  end
42
56
  end
@@ -52,7 +52,8 @@ module Bosh::Stemcell
52
52
  tarball: release_tarball_path,
53
53
  stemcell_version: version,
54
54
  infrastructure: infrastructure,
55
- operating_system: operating_system
55
+ operating_system: operating_system,
56
+ agent_name: expected_agent_name,
56
57
  ).and_return(stemcell_builder_options)
57
58
  end
58
59
 
@@ -12,18 +12,20 @@ module Bosh::Stemcell
12
12
  tarball: 'fake/release.tgz',
13
13
  stemcell_version: '007',
14
14
  infrastructure: infrastructure,
15
- operating_system: operating_system
15
+ operating_system: operating_system,
16
+ agent_name: agent_name,
16
17
  }
17
18
  end
18
19
 
19
20
  let(:infrastructure) { Infrastructure.for('aws') }
20
21
  let(:operating_system) { OperatingSystem.for('ubuntu') }
22
+ let(:agent_name) { 'ruby' }
21
23
  let(:expected_source_root) { File.expand_path('../../../../..', __FILE__) }
22
24
  let(:archive_filename) { instance_double('Bosh::Stemcell::ArchiveFilename', to_s: 'FAKE_STEMCELL.tgz') }
23
25
 
24
26
  before do
25
27
  ArchiveFilename.stub(:new).
26
- with('007', infrastructure, operating_system, 'bosh-stemcell', false).and_return(archive_filename)
28
+ with('007', infrastructure, operating_system, 'bosh-stemcell', false, agent_name).and_return(archive_filename)
27
29
  end
28
30
 
29
31
  describe '#initialize' do
@@ -149,6 +151,17 @@ module Bosh::Stemcell
149
151
  expect(result['image_create_disk_size']).to eq(1234)
150
152
  end
151
153
  end
154
+
155
+ context 'when go agent is used' do
156
+ let(:agent_name) { 'go' }
157
+
158
+ it 'changes the stemcell_name' do
159
+ result = stemcell_builder_options.default
160
+
161
+ expect(result['stemcell_name']).to eq(
162
+ "bosh-#{infrastructure.name}-#{infrastructure.hypervisor}-#{operating_system.name}-go_agent")
163
+ end
164
+ end
152
165
  end
153
166
  end
154
167
  # rubocop:enable MethodLength
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh-stemcell
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0.pre.1210
4
+ version: 1.5.0.pre.1211
5
5
  prerelease: 6
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: 2013-10-30 00:00:00.000000000 Z
12
+ date: 2013-10-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bosh_aws_cpi
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 1.5.0.pre.1210
21
+ version: 1.5.0.pre.1211
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: 1.5.0.pre.1210
29
+ version: 1.5.0.pre.1211
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: rake
32
32
  requirement: !ruby/object:Gem::Requirement