bosh-stemcell 1.1798.0 → 1.1836.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,9 +13,23 @@ module Bosh::Stemcell
13
13
  end
14
14
 
15
15
  class Go
16
+ def name
17
+ 'go'
18
+ end
19
+
20
+ def ==(other)
21
+ name == other.name
22
+ end
16
23
  end
17
24
 
18
25
  class Ruby
26
+ def name
27
+ 'ruby'
28
+ end
29
+
30
+ def ==(other)
31
+ name == other.name
32
+ end
19
33
  end
20
34
  end
21
35
  end
@@ -1,15 +1,15 @@
1
+ require 'forwardable'
2
+
1
3
  module Bosh::Stemcell
2
4
  class ArchiveFilename
3
- # rubocop:disable ParameterLists
4
- def initialize(version, infrastructure, operating_system, base_name, light, agent_name = 'ruby')
5
+ extend Forwardable
6
+
7
+ def initialize(version, definition, base_name, light)
5
8
  @version = version
6
- @infrastructure = infrastructure
7
- @operating_system = operating_system
9
+ @definition = definition
8
10
  @base_name = base_name
9
11
  @light = light
10
- @agent_name = agent_name
11
12
  end
12
- # rubocop:enable ParameterLists
13
13
 
14
14
  def to_s
15
15
  stemcell_filename_parts = [
@@ -19,7 +19,7 @@ module Bosh::Stemcell
19
19
  infrastructure.hypervisor,
20
20
  operating_system.name,
21
21
  ]
22
- stemcell_filename_parts << "#{agent_name}_agent" unless agent_name == 'ruby'
22
+ stemcell_filename_parts << "#{agent.name}_agent" unless agent.name == 'ruby'
23
23
  "#{stemcell_filename_parts.join('-')}.tgz"
24
24
  end
25
25
 
@@ -29,13 +29,17 @@ module Bosh::Stemcell
29
29
  light ? "light-#{base_name}" : base_name
30
30
  end
31
31
 
32
+ def_delegators(
33
+ :@definition,
34
+ :infrastructure,
35
+ :operating_system,
36
+ :agent,
37
+ )
38
+
32
39
  attr_reader(
33
40
  :base_name,
34
41
  :version,
35
- :infrastructure,
36
- :operating_system,
37
42
  :light,
38
- :agent_name,
39
43
  )
40
44
  end
41
45
  end
@@ -3,26 +3,24 @@ require 'fileutils'
3
3
  require 'bosh/core/shell'
4
4
  require 'bosh/stemcell/builder_options'
5
5
  require 'bosh/stemcell/disk_image'
6
- require 'bosh/stemcell/infrastructure'
7
- require 'bosh/stemcell/operating_system'
6
+ require 'bosh/stemcell/definition'
8
7
  require 'bosh/stemcell/stage_collection'
9
8
  require 'bosh/stemcell/stage_runner'
10
9
 
10
+ require 'forwardable'
11
+
11
12
  module Bosh::Stemcell
12
13
  class BuilderCommand
13
- def initialize(env, options)
14
- @environment = env
15
- @infrastructure = Infrastructure.for(options.fetch(:infrastructure_name))
16
- @operating_system = OperatingSystem.for(options.fetch(:operating_system_name))
17
- @agent_name = options.fetch(:agent_name) || 'ruby'
14
+ extend Forwardable
18
15
 
16
+ def initialize(env, definition, version, release_tarball_path)
17
+ @environment = env
18
+ @definition = definition
19
19
  @stemcell_builder_options = BuilderOptions.new(
20
20
  env,
21
- tarball: options.fetch(:release_tarball_path),
22
- stemcell_version: options.fetch(:version),
23
- infrastructure: infrastructure,
24
- operating_system: operating_system,
25
- agent_name: agent_name,
21
+ definition,
22
+ version,
23
+ release_tarball_path,
26
24
  )
27
25
  @shell = Bosh::Core::Shell.new
28
26
  end
@@ -40,11 +38,7 @@ module Bosh::Stemcell
40
38
 
41
39
  persist_settings_for_bash
42
40
 
43
- stage_collection = StageCollection.new(
44
- infrastructure: infrastructure,
45
- operating_system: operating_system,
46
- agent_name: agent_name,
47
- )
41
+ stage_collection = StageCollection.new(definition)
48
42
  stage_runner = StageRunner.new(
49
43
  build_path: build_path,
50
44
  command_env: command_env,
@@ -63,12 +57,17 @@ module Bosh::Stemcell
63
57
 
64
58
  private
65
59
 
60
+ def_delegators(
61
+ :@definition,
62
+ :infrastructure,
63
+ :operating_system,
64
+ :agent,
65
+ )
66
+
66
67
  attr_reader(
67
68
  :shell,
68
69
  :environment,
69
- :infrastructure,
70
- :operating_system,
71
- :agent_name,
70
+ :definition,
72
71
  :stemcell_builder_options
73
72
  )
74
73
 
@@ -78,7 +77,7 @@ module Bosh::Stemcell
78
77
  "STEMCELL_IMAGE=#{image_file_path}",
79
78
  "bundle exec rspec -fd#{exclude_exclusions}",
80
79
  "spec/stemcells/#{operating_system.name}_spec.rb",
81
- "spec/stemcells/#{agent_name}_agent_spec.rb",
80
+ "spec/stemcells/#{agent.name}_agent_spec.rb",
82
81
  "spec/stemcells/#{infrastructure.name}_spec.rb",
83
82
  ].join(' ')
84
83
  end
@@ -2,22 +2,24 @@ require 'rbconfig'
2
2
  require 'bosh_agent/version'
3
3
  require 'bosh/stemcell/archive_filename'
4
4
 
5
+ require 'forwardable'
6
+
5
7
  module Bosh::Stemcell
6
8
  class BuilderOptions
7
- def initialize(env, options)
9
+ extend Forwardable
10
+
11
+ def initialize(env, definition, version, tarball, disk_size = nil)
8
12
  @environment = env
9
- @infrastructure = options.fetch(:infrastructure)
10
- @operating_system = options.fetch(:operating_system)
11
- @agent_name = options.fetch(:agent_name)
13
+ @definition = definition
12
14
 
13
- @stemcell_version = options.fetch(:stemcell_version)
14
- @image_create_disk_size = options.fetch(:disk_size, infrastructure.default_disk_size)
15
- @bosh_micro_release_tgz_path = options.fetch(:tarball)
15
+ @stemcell_version = version
16
+ @image_create_disk_size = disk_size || infrastructure.default_disk_size
17
+ @bosh_micro_release_tgz_path = tarball
16
18
  end
17
19
 
18
20
  def default
19
21
  stemcell_name = "bosh-#{infrastructure.name}-#{infrastructure.hypervisor}-#{operating_system.name}"
20
- stemcell_name += "-#{agent_name}_agent" unless agent_name == 'ruby'
22
+ stemcell_name += "-#{agent.name}_agent" unless agent.name == 'ruby'
21
23
 
22
24
  {
23
25
  'stemcell_name' => stemcell_name,
@@ -38,12 +40,17 @@ module Bosh::Stemcell
38
40
 
39
41
  private
40
42
 
41
- attr_reader(
42
- :environment,
43
+ def_delegators(
44
+ :@definition,
43
45
  :infrastructure,
44
46
  :operating_system,
45
- :agent_name,
47
+ :agent,
48
+ )
49
+
50
+ attr_reader(
51
+ :environment,
46
52
  :stemcell_version,
53
+ :definition,
47
54
  :image_create_disk_size,
48
55
  :bosh_micro_release_tgz_path
49
56
  )
@@ -73,7 +80,7 @@ module Bosh::Stemcell
73
80
  end
74
81
 
75
82
  def archive_filename
76
- ArchiveFilename.new(stemcell_version, infrastructure, operating_system, 'bosh-stemcell', false, agent_name)
83
+ ArchiveFilename.new(stemcell_version, definition, 'bosh-stemcell', false)
77
84
  end
78
85
 
79
86
  def stemcell_image_name
@@ -19,5 +19,11 @@ module Bosh::Stemcell
19
19
  @operating_system = operating_system
20
20
  @agent = agent
21
21
  end
22
+
23
+ def ==(other)
24
+ infrastructure == other.infrastructure &&
25
+ operating_system == other.operating_system &&
26
+ agent == other.agent
27
+ end
22
28
  end
23
29
  end
@@ -26,6 +26,13 @@ module Bosh::Stemcell
26
26
  def light?
27
27
  @supports_light_stemcell
28
28
  end
29
+
30
+ def ==(other)
31
+ name == other.name &&
32
+ hypervisor == other.hypervisor &&
33
+ default_disk_size == other.default_disk_size &&
34
+ light? == other.light?
35
+ end
29
36
  end
30
37
 
31
38
  class OpenStack < Base
@@ -14,6 +14,10 @@ module Bosh::Stemcell
14
14
  def initialize(options = {})
15
15
  @name = options.fetch(:name)
16
16
  end
17
+
18
+ def ==(other)
19
+ name == other.name
20
+ end
17
21
  end
18
22
 
19
23
  class Centos < Base
@@ -1,13 +1,12 @@
1
- require 'bosh/stemcell/infrastructure'
2
- require 'bosh/stemcell/operating_system'
1
+ require 'bosh/stemcell/definition'
2
+ require 'forwardable'
3
3
 
4
4
  module Bosh::Stemcell
5
5
  class StageCollection
6
+ extend Forwardable
6
7
 
7
- def initialize(options)
8
- @infrastructure = options.fetch(:infrastructure)
9
- @operating_system = options.fetch(:operating_system)
10
- @agent_name = options.fetch(:agent_name)
8
+ def initialize(definition)
9
+ @definition = definition
11
10
  end
12
11
 
13
12
  def all_stages
@@ -16,18 +15,18 @@ module Bosh::Stemcell
16
15
 
17
16
  private
18
17
 
19
- attr_reader :infrastructure, :operating_system, :agent_name
18
+ def_delegators :@definition, :infrastructure, :operating_system, :agent
20
19
 
21
20
  def agent_stages
22
- case agent_name
23
- when 'go'
21
+ case agent
22
+ when Agent::Go
24
23
  [
25
24
  :bosh_ruby,
26
25
  :bosh_go_agent,
27
26
  :bosh_micro_go,
28
27
  :aws_cli,
29
28
  ]
30
- else
29
+ when Agent::Ruby
31
30
  [
32
31
  :bosh_ruby,
33
32
  :bosh_agent,
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Stemcell
3
- VERSION = '1.1798.0'
3
+ VERSION = '1.1836.0'
4
4
  end
5
5
  end
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.1798.0
4
+ version: 1.1836.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-01-18 00:00:00.000000000 Z
12
+ date: 2014-01-23 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.1798.0
21
+ version: 1.1836.0
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.1798.0
29
+ version: 1.1836.0
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: fakefs
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -184,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
184
  version: '0'
185
185
  segments:
186
186
  - 0
187
- hash: 3725339086464005117
187
+ hash: 1486121491974777070
188
188
  requirements: []
189
189
  rubyforge_project:
190
190
  rubygems_version: 1.8.23