bosh-bootstrap 0.14.1 → 0.14.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e3238fa74762c2cb66869506e04fd4b1e27d8cfa
4
- data.tar.gz: 79d009099d3035550f43ce73d4a3f7703516f670
3
+ metadata.gz: af248e749e33a61d0c03cc066b5200b093c3b835
4
+ data.tar.gz: a6de1b93227da6d75030c2f38cf7e08dedf86c0a
5
5
  SHA512:
6
- metadata.gz: 907a2aeb2f8ee2e4bd400474b90282c5ec3e2e9c3d07e0b848d2e6ad19f18fe99570adaa13639bd29f7c424a4e00d4f3edbc3613f432c4b645189db10b14185a
7
- data.tar.gz: 0113d4800c5d799f2223300790278a02a86af09e3971242e9ceee9da6e359f1d2cbf476b5f95acd00d9d537bfa77c7842e38005b4a6715adfe3d883f6c5b0a9a
6
+ metadata.gz: d5e5a743abb0cf0462e9f8f362dc7b874dd222ccb175bb3a5a7bcc3a276b7fe8e2f7f8bf6565e66b02538caef168376778dc80a9b1396e5f96a1a7c185943b49
7
+ data.tar.gz: cda9ac07e4a1827cf3be8be1b30987c42f44930a999205cd8ba1a4f816efcc0ace9ddbf04c97da1bce8785684a4771fd855a75ee2fb6242500a9d8ecaa06d757
data/.travis.yml CHANGED
@@ -1,9 +1,7 @@
1
1
  language: ruby
2
2
  script: bundle exec rake spec:$SUITE
3
3
  rvm:
4
- - ruby-1.9.3
5
- - ruby-2.0.0
6
- - ruby-2.1.0
4
+ - ruby-2.1.3
7
5
  notifications:
8
6
  email:
9
7
  recipients:
@@ -24,4 +22,3 @@ matrix:
24
22
  # - rvm: rbx-19mode
25
23
  # - rvm: ruby-2.0.0
26
24
  - env: SUITE=integration:aws:basic
27
-
data/ChangeLog.md CHANGED
@@ -10,58 +10,58 @@ bosh-bootstrap deploy
10
10
 
11
11
  v0.14
12
12
 
13
- - default target directory is current director, rather than `~/.microbosh`
14
- - fixed to use new stemcells
15
- - [aws] VPC support - detects if VPCs available and allows selection, then select of subset, then creates security groups into the VPC
16
- - [aws] Using m3.medium instead of m1.medium
17
- - [aws vpc] network type: manual for vpc
13
+ - default target directory is current director, rather than `~/.microbosh`
14
+ - fixed to use new stemcells
15
+ - [aws] VPC support - detects if VPCs available and allows selection, then select of subset, then creates security groups into the VPC
16
+ - [aws vpc] network type: manual for vpc
17
+ - [aws] reuse existing bosh stemcell AMIs - automatically detects if a stemcell has been uploaded/converted into an AMI [v0.14.2]
18
18
 
19
19
  v0.13
20
20
  -----
21
21
 
22
- - [openstack] Neutron support - detects that Neutron is available and prompts for which subnet to use
23
- - [openstack] Boot from volume - prompt for which images should be used (QCOW2 vs RAW) and configure MicroBOSH to use boot_from_volume if RAW format required
24
- - only create 3 security groups instead of many (fix for new AWS accounts and OpenStack tenants with small quotas)
25
- - testing for ruby 2.1.0; though BOSH still requires 1.9.3 at time of writing
26
- - upgrade rspec for 3.0 and using expect/to syntax
27
- - ignore SSL verification [v0.13.1] - to be made optional in future
28
- - loosen requirement on cyoi to major version [v0.13.2]
22
+ - [openstack] Neutron support - detects that Neutron is available and prompts for which subnet to use
23
+ - [openstack] Boot from volume - prompt for which images should be used (QCOW2 vs RAW) and configure MicroBOSH to use boot_from_volume if RAW format required
24
+ - only create 3 security groups instead of many (fix for new AWS accounts and OpenStack tenants with small quotas)
25
+ - testing for ruby 2.1.0; though BOSH still requires 1.9.3 at time of writing
26
+ - upgrade rspec for 3.0 and using expect/to syntax
27
+ - ignore SSL verification [v0.13.1] - to be made optional in future
28
+ - loosen requirement on cyoi to major version [v0.13.2]
29
29
 
30
30
  v0.12
31
31
  -----
32
32
 
33
- - vSphere support [thanks Matt Stine!!]
33
+ - vSphere support [thanks Matt Stine!!]
34
34
 
35
35
  v0.11
36
36
  -----
37
37
 
38
- - Complete rewrite of bosh-bootstrap in orphan branch
39
- - CodeClimate score changed from 0.82 to 3.85
40
- - Initial support for AWS EC2; WIP for OpenStack; initial unit tests for vSphere
41
- - Interactive Q&A is extracted into [cyoi](https://github.com/drnic/cyoi) (choose-your-own-infrastructure) library
42
- - Accessing settings is much cleaner; functionality moved into fork of settingslogic called [readwritesettings](https://github.com/drnic/readwritesettings)
43
- - Inception VM/server is now provisioned via separate CLI project [inception-server](https://github.com/drnic/inception-server)
44
- - AWS/us-east-1 uses public AMIs; other regions & other CPIs use stemcells
45
- - CLI via bosh plugin (`bosh bootstrap`) rather than a stand alone CLI (`bosh-bootstrap`)
46
- - Added `ssh` action to ssh into the microbosh
47
- - Added `delete` actions to delete the microbosh (but not the IP address and security groups)
48
- - Add back `bosh-bootstrap` CLI & remove bosh_cli dependency (v0.11.1)
49
- - Specify which AWS AZ to use via `provider.az` in settings.yml (v0.11.2)
50
- - Support for OpenStack (also in cyoi 0.4.3) thanks to Ferdy! (v0.11.3)
51
- - Ensure CLI loads bundler (v0.11.4)
52
- - rubygem users should be able to install & run from rubygems instead of source workaround (v0.11.5)
53
- - microbosh volume is smaller 4G and automatically fits on devstack/openstack (v0.11.5; thx @ryfow)
54
- - Security group `bosh_agent_http` renamed to `bosh_agent_https`, with same 6868 port for talking to bosh_agent running in https mode (`bosh_agent_http` can then be deleted) (v0.11.5)
55
- - Add port 53/dns security group (v0.11.6)
56
- - Port 53 open on UDP only as workaround for multi-region AWS (v0.11.7; thx @yudai)
57
- - Suppress bundler git "fatal" warnings (by converting ~/.microbosh into git repo) (v0.11.8)
58
- - Update to newer-er-er stemcell paths from Pivotal's s3 bucket (v0.11.9, v0.11.10)
59
- - Enlarge persistent disk from 4G to 16G (v0.11.11)
60
- - bosh_cli gems now on rubygems instead of pivotal s3 bucket (v0.11.12)
61
- - OpenStack improvements to reduce POST API throttling (v0.11.13)
62
- - Can now update a running microbosh (thanks @lookitup4me) (v0.11.14)
63
- - OpenStack uses commonly available m1.medium flavor instead of bespoke m1.microbosh (v0.11.14)
64
- - Properly enlarge persistent disk from 4G to 16G (v0.11.15)
38
+ - Complete rewrite of bosh-bootstrap in orphan branch
39
+ - CodeClimate score changed from 0.82 to 3.85
40
+ - Initial support for AWS EC2; WIP for OpenStack; initial unit tests for vSphere
41
+ - Interactive Q&A is extracted into [cyoi](https://github.com/drnic/cyoi) (choose-your-own-infrastructure) library
42
+ - Accessing settings is much cleaner; functionality moved into fork of settingslogic called [readwritesettings](https://github.com/drnic/readwritesettings)
43
+ - Inception VM/server is now provisioned via separate CLI project [inception-server](https://github.com/drnic/inception-server)
44
+ - AWS/us-east-1 uses public AMIs; other regions & other CPIs use stemcells
45
+ - CLI via bosh plugin (`bosh bootstrap`) rather than a stand alone CLI (`bosh-bootstrap`)
46
+ - Added `ssh` action to ssh into the microbosh
47
+ - Added `delete` actions to delete the microbosh (but not the IP address and security groups)
48
+ - Add back `bosh-bootstrap` CLI & remove bosh_cli dependency (v0.11.1)
49
+ - Specify which AWS AZ to use via `provider.az` in settings.yml (v0.11.2)
50
+ - Support for OpenStack (also in cyoi 0.4.3) thanks to Ferdy! (v0.11.3)
51
+ - Ensure CLI loads bundler (v0.11.4)
52
+ - rubygem users should be able to install & run from rubygems instead of source workaround (v0.11.5)
53
+ - microbosh volume is smaller 4G and automatically fits on devstack/openstack (v0.11.5; thx @ryfow)
54
+ - Security group `bosh_agent_http` renamed to `bosh_agent_https`, with same 6868 port for talking to bosh_agent running in https mode (`bosh_agent_http` can then be deleted) (v0.11.5)
55
+ - Add port 53/dns security group (v0.11.6)
56
+ - Port 53 open on UDP only as workaround for multi-region AWS (v0.11.7; thx @yudai)
57
+ - Suppress bundler git "fatal" warnings (by converting ~/.microbosh into git repo) (v0.11.8)
58
+ - Update to newer-er-er stemcell paths from Pivotal's s3 bucket (v0.11.9, v0.11.10)
59
+ - Enlarge persistent disk from 4G to 16G (v0.11.11)
60
+ - bosh_cli gems now on rubygems instead of pivotal s3 bucket (v0.11.12)
61
+ - OpenStack improvements to reduce POST API throttling (v0.11.13)
62
+ - Can now update a running microbosh (thanks @lookitup4me) (v0.11.14)
63
+ - OpenStack uses commonly available m1.medium flavor instead of bespoke m1.microbosh (v0.11.14)
64
+ - Properly enlarge persistent disk from 4G to 16G (v0.11.15)
65
65
 
66
66
  v0.10
67
67
  -----
@@ -74,85 +74,85 @@ Install using:
74
74
  gem install bosh-bootstrap -v "~> 0.10.0"
75
75
  ```
76
76
 
77
- - Only using latest pre-release bosh gems & stemcells/amis - do not upgrade if you want the old 2012 gems
78
- - AWS us-east-1 uses a pre-built AMI for extra speed
79
- - AWS all regions are working (using pre-created stemcell)
80
- - OpenStack is now working (using pre-created stemcell)
81
- - `deploy --create-inception` chooses to create an inception VM
82
- - Using `bosh_cli_plugin_micro` (for `bosh micro`) [was `bosh_deployer`](v1.10.1)
83
- - `bosh-cloudfoundry` gem installed with prerelease gems (fix in v0.10.1)
84
- - AWS inception VM gets its attached volume again (v1.10.2)
77
+ - Only using latest pre-release bosh gems & stemcells/amis - do not upgrade if you want the old 2012 gems
78
+ - AWS us-east-1 uses a pre-built AMI for extra speed
79
+ - AWS all regions are working (using pre-created stemcell)
80
+ - OpenStack is now working (using pre-created stemcell)
81
+ - `deploy --create-inception` chooses to create an inception VM
82
+ - Using `bosh_cli_plugin_micro` (for `bosh micro`) [was `bosh_deployer`](v1.10.1)
83
+ - `bosh-cloudfoundry` gem installed with prerelease gems (fix in v0.10.1)
84
+ - AWS inception VM gets its attached volume again (v1.10.2)
85
85
 
86
86
  v0.9
87
87
  ----
88
88
 
89
- - v0.8 wasn't working for many people; and neither will v0.9; but its a move in the right direction.
90
- - Moving towards new 1.5.0 version of bosh that hasn't come out yet formally.
91
- - AWS us-east-1 will use a pre-created AMI. It saves about 10-15 minutes!
92
- - AWS other regions will use a pre-created stemcell. I haven't tested this well yet.
93
- - OpenStack support is still broken because you need to create your own stemcells and for that you need a 12.10 inception VM and that work isn't quite done yet.
89
+ - v0.8 wasn't working for many people; and neither will v0.9; but its a move in the right direction.
90
+ - Moving towards new 1.5.0 version of bosh that hasn't come out yet formally.
91
+ - AWS us-east-1 will use a pre-created AMI. It saves about 10-15 minutes!
92
+ - AWS other regions will use a pre-created stemcell. I haven't tested this well yet.
93
+ - OpenStack support is still broken because you need to create your own stemcells and for that you need a 12.10 inception VM and that work isn't quite done yet.
94
94
 
95
95
  v0.8
96
96
  ----
97
97
 
98
- - SSH keys used to access inception VM are now generated and stored within the `~/.bosh_bootstrap/ssh` folder. This fixes many issues that many people were having (their keys had passphrases, their fog_default keypair was old). It also allows a manifest file to be shared between people as it contains the private key contents, and the private key file will be recreated if it is missing.
99
- - existing inception VMs' manifest.yml will be upgraded automatically and a backup file created (just in case)
100
- - tightening of net-ssh & net-scp gems to ensure the bosh-bootstrap gem can be installed [thx @mmb]
101
- - preinstall net-ssh/net-scp/fog on inception VM before installing `bosh_deployer` to fix in ability to install `bosh_deployer` 1.4.1 due to latest fog 1.10.0 release (v0.8.2)
98
+ - SSH keys used to access inception VM are now generated and stored within the `~/.bosh_bootstrap/ssh` folder. This fixes many issues that many people were having (their keys had passphrases, their fog_default keypair was old). It also allows a manifest file to be shared between people as it contains the private key contents, and the private key file will be recreated if it is missing.
99
+ - existing inception VMs' manifest.yml will be upgraded automatically and a backup file created (just in case)
100
+ - tightening of net-ssh & net-scp gems to ensure the bosh-bootstrap gem can be installed [thx @mmb]
101
+ - preinstall net-ssh/net-scp/fog on inception VM before installing `bosh_deployer` to fix in ability to install `bosh_deployer` 1.4.1 due to latest fog 1.10.0 release (v0.8.2)
102
102
 
103
103
  v0.7
104
104
  ----
105
105
 
106
106
  Notable:
107
107
 
108
- - For existing users: please run "deploy --upgrade-deps" as new inception package (runit) added; and jazor/yaml_command CLIs installed
109
- - Forces use of microbosh stemcell 0.8.1 which work with public gems (latest public stemcell does not work with public gems)
108
+ - For existing users: please run "deploy --upgrade-deps" as new inception package (runit) added; and jazor/yaml_command CLIs installed
109
+ - Forces use of microbosh stemcell 0.8.1 which work with public gems (latest public stemcell does not work with public gems)
110
110
 
111
111
  Added:
112
112
 
113
- - `mosh` command - connect to Inception VM on trains over flaky internet connections (use instead of `ssh` or `tmux` command) [thx @mrdavidlang]
114
- - `upgrade-inception` command - to perform an upgrade of the Inception VM without triggering a re-deploy of microbosh.
113
+ - `mosh` command - connect to Inception VM on trains over flaky internet connections (use instead of `ssh` or `tmux` command) [thx @mrdavidlang]
114
+ - `upgrade-inception` command - to perform an upgrade of the Inception VM without triggering a re-deploy of microbosh.
115
115
 
116
116
  Changes:
117
117
 
118
- - Inception VM now installs rubygems 2.0.0 & bundler 1.3.0
119
- - Better idempotence for re-deploying microbosh - will delete&deploy after a failure; will deploy after a deletion.
120
- - Downloads ubuntu 10.04 ISO to speed up custom stemcell builds
121
- - Using redcard to ensure ruby 1.9 only
122
- - `manifest.yml` stores the name of the stemcell created from a custom stemcell build; no longer re-creates stemcell each time
123
- - git color is enabled on inception VM
118
+ - Inception VM now installs rubygems 2.0.0 & bundler 1.3.0
119
+ - Better idempotence for re-deploying microbosh - will delete&deploy after a failure; will deploy after a deletion.
120
+ - Downloads ubuntu 10.04 ISO to speed up custom stemcell builds
121
+ - Using redcard to ensure ruby 1.9 only
122
+ - `manifest.yml` stores the name of the stemcell created from a custom stemcell build; no longer re-creates stemcell each time
123
+ - git color is enabled on inception VM
124
124
 
125
125
  Work in progress:
126
126
 
127
- - AWS VPC support was begin by the core bosh team; though work has stopped sadly.
128
- - Growing number of specs mostly using Fog.mock! mode; tests being run on travis
127
+ - AWS VPC support was begin by the core bosh team; though work has stopped sadly.
128
+ - Growing number of specs mostly using Fog.mock! mode; tests being run on travis
129
129
 
130
130
  ### v0.7.1
131
131
 
132
- - Make "deploy --private-key" option work [thx @dpw]
133
- - Add hypervisor for OpenStack stemcells [thx @frodenas]
134
- - Don't fail if `settings.fog_credentials.openstack_region` doesn't exist
135
- - Fix README for changed location of bosh-release [thx @scottfrederick]
136
- - No need to show --latest-stemcell in README tutorial
132
+ - Make "deploy --private-key" option work [thx @dpw]
133
+ - Add hypervisor for OpenStack stemcells [thx @frodenas]
134
+ - Don't fail if `settings.fog_credentials.openstack_region` doesn't exist
135
+ - Fix README for changed location of bosh-release [thx @scottfrederick]
136
+ - No need to show --latest-stemcell in README tutorial
137
137
 
138
138
  v0.6
139
139
  ----
140
140
 
141
141
  Highlights:
142
142
 
143
- - Defaults to downloading latest stemcell (rather than stable, which are getting old now).
144
- - Installs the Cloud Foundry plugin for bosh https://github.com/StarkAndWayne/bosh-cloudfoundry
143
+ - Defaults to downloading latest stemcell (rather than stable, which are getting old now).
144
+ - Installs the Cloud Foundry plugin for bosh https://github.com/StarkAndWayne/bosh-cloudfoundry
145
145
 
146
146
  Additions:
147
147
 
148
- - `tmux` - if you have tmux installed, then you can SSH into inception VM with it (thx @mrdavidlang)
149
- - started a test suite; its small but growing! (thx @mrdavidlang for getting it started)
148
+ - `tmux` - if you have tmux installed, then you can SSH into inception VM with it (thx @mrdavidlang)
149
+ - started a test suite; its small but growing! (thx @mrdavidlang for getting it started)
150
150
 
151
151
  Bug fixes:
152
152
 
153
- - Fog::SSH uses explicit ssh key that was requested to access inception VM
153
+ - Fog::SSH uses explicit ssh key that was requested to access inception VM
154
154
 
155
155
  Future thoughts:
156
156
 
157
- - I hate Settingslogic for read-write settings. It's really only a read-only settings DSL. It puts Ruby classes into the YAML. Probably going to rip it out.
158
- - I am so sorry I took so long to start writing tests. It always seemed such a hard thing to write tests for. But bosh-cloudfoundry project has had good success with internal tests; so we're migrating those ideas into this project.
157
+ - I hate Settingslogic for read-write settings. It's really only a read-only settings DSL. It puts Ruby classes into the YAML. Probably going to rip it out.
158
+ - I am so sorry I took so long to start writing tests. It always seemed such a hard thing to write tests for. But bosh-cloudfoundry project has had good success with internal tests; so we're migrating those ideas into this project.
@@ -31,6 +31,6 @@ EOS
31
31
  gem.add_dependency "redcard"
32
32
  gem.add_dependency "rbvmomi"
33
33
  gem.add_development_dependency "rake"
34
- gem.add_development_dependency "rspec-fire"
34
+ gem.add_development_dependency "rspec"
35
35
  gem.add_development_dependency "fakeweb"
36
36
  end
@@ -52,7 +52,8 @@ class Bosh::Bootstrap::Cli::Commands::Deploy
52
52
  provider_name = settings.provider.name
53
53
  require "bosh-bootstrap/microbosh_providers/#{provider_name}"
54
54
  klass = Bosh::Bootstrap::MicroboshProviders.provider_class(provider_name)
55
- klass.new(File.join(settings_dir, "deployments/#{settings.bosh.name}/micro_bosh.yml"), settings)
55
+ fog_compute = cyoi_provider_client.fog_compute
56
+ klass.new(File.join(settings_dir, "deployments/#{settings.bosh.name}/micro_bosh.yml"), settings, fog_compute)
56
57
  end
57
58
  end
58
59
 
@@ -48,7 +48,7 @@ module Bosh::Bootstrap::MicroboshProviders
48
48
  end
49
49
 
50
50
  def resources_cloud_properties
51
- {"instance_type"=>"m3.medium"}
51
+ {"instance_type"=>"m1.medium"}
52
52
  end
53
53
 
54
54
  def cloud_properties
@@ -100,6 +100,48 @@ module Bosh::Bootstrap::MicroboshProviders
100
100
  def vpc_dns(ip_address)
101
101
  ip_address.gsub(/^(\d+)\.(\d+)\..*/, '\1.\2.0.2')
102
102
  end
103
+
104
+ # @return [Hash] description of each self-owned AMI
105
+ # {"blockDeviceMapping"=>
106
+ # [{"deviceName"=>"/dev/sda",
107
+ # "snapshotId"=>"snap-56c7089e",
108
+ # "volumeSize"=>2,
109
+ # "deleteOnTermination"=>"true"},
110
+ # {"deviceName"=>"/dev/sdb", "virtualName"=>"ephemeral0"}],
111
+ # "productCodes"=>[],
112
+ # "stateReason"=>{},
113
+ # "tagSet"=>{"Name"=>"bosh-aws-xen-ubuntu-trusty-go_agent 2732"},
114
+ # "imageId"=>"ami-c19ed3f1",
115
+ # "imageLocation"=>"357913607455/BOSH-64a71269-18a2-450b-9e61-713ed70fa62a",
116
+ # "imageState"=>"available",
117
+ # "imageOwnerId"=>"357913607455",
118
+ # "isPublic"=>false,
119
+ # "architecture"=>"x86_64",
120
+ # "imageType"=>"machine",
121
+ # "kernelId"=>"aki-94e26fa4",
122
+ # "name"=>"BOSH-64a71269-18a2-450b-9e61-713ed70fa62a",
123
+ # "description"=>"bosh-aws-xen-ubuntu-trusty-go_agent 2732",
124
+ # "rootDeviceType"=>"ebs",
125
+ # "rootDeviceName"=>"/dev/sda1",
126
+ # "virtualizationType"=>"paravirtual",
127
+ # "hypervisor"=>"xen"}
128
+ def owned_images
129
+ my_images_raw = fog_compute.describe_images('Owner' => 'self')
130
+ my_images_raw.body["imagesSet"]
131
+ end
132
+
133
+ # @return [String] Any AMI imageID, e.g. "ami-c19ed3f1" for given BOSH stemcell name/version
134
+ # Usage: find_ami_for_stemcell("bosh-aws-xen-ubuntu-trusty-go_agent", "2732")
135
+ def find_ami_for_stemcell(name, version)
136
+ image = owned_images.find do |image|
137
+ image["description"] == "#{name} #{version}"
138
+ end
139
+ image["imageId"] if image
140
+ end
141
+
142
+ def discover_if_stemcell_image_already_uploaded
143
+ find_ami_for_stemcell(latest_stemcell.stemcell_name, latest_stemcell.version)
144
+ end
103
145
  end
104
146
  end
105
147
  Bosh::Bootstrap::MicroboshProviders.register_provider("aws", Bosh::Bootstrap::MicroboshProviders::AWS)
@@ -10,9 +10,11 @@ class Bosh::Bootstrap::MicroboshProviders::Base
10
10
 
11
11
  attr_reader :manifest_path
12
12
  attr_reader :settings
13
+ attr_reader :fog_compute
13
14
 
14
- def initialize(manifest_path, settings)
15
+ def initialize(manifest_path, settings, fog_compute)
15
16
  @manifest_path = manifest_path
17
+ @fog_compute = fog_compute
16
18
  @settings = settings.is_a?(Hash) ? ReadWriteSettings.new(settings) : settings
17
19
  raise "@settings must be ReadWriteSettings (or Hash)" unless @settings.is_a?(ReadWriteSettings)
18
20
  end
@@ -59,6 +61,9 @@ class Bosh::Bootstrap::MicroboshProviders::Base
59
61
 
60
62
  def stemcell_path
61
63
  unless settings.exists?("bosh.stemcell_path")
64
+ if image = discover_if_stemcell_image_already_uploaded
65
+ return image
66
+ end
62
67
  download_stemcell
63
68
  end
64
69
  end
@@ -70,15 +75,21 @@ class Bosh::Bootstrap::MicroboshProviders::Base
70
75
  end
71
76
  end
72
77
 
78
+ # override if infrastructure has enough information to
79
+ # discover if stemcell already uploaded and can be used
80
+ # via its image ID/AMI
81
+ def discover_if_stemcell_image_already_uploaded
82
+ end
83
+
73
84
  # downloads latest stemcell & returns path
74
85
  def download_stemcell
75
86
  mkdir_p(stemcell_dir)
76
87
  chdir(stemcell_dir) do
77
- stemcell_path = File.expand_path(latest_stemcell.name)
78
- unless File.exists?(stemcell_path)
88
+ path = File.expand_path(latest_stemcell.name)
89
+ unless File.exists?(path)
79
90
  sh "curl -O '#{latest_stemcell.url}'"
80
91
  end
81
- return stemcell_path
92
+ return path
82
93
  end
83
94
  end
84
95
 
@@ -14,13 +14,22 @@ module Bosh::Bootstrap
14
14
  end
15
15
 
16
16
  def version
17
- @parsed_version.gsub('_', '.').to_f
17
+ @parsed_version.gsub('_', '.')
18
18
  end
19
19
 
20
20
  def variety
21
21
  name.gsub(/(.tgz)|(bosh-stemcell-)|(#{@parsed_version})/, '').split('-').reject { |c| c.empty? }.join('-')
22
22
  end
23
23
 
24
+ # @return [String] guesses ultimate stemcell name from file name
25
+ # light-bosh-stemcell-2719-aws-xen-ubuntu-trusty-go_agent.tgz into bosh-aws-xen-ubuntu-trusty-go_agent
26
+ def stemcell_name
27
+ name.
28
+ gsub(/(.tgz)|(#{@parsed_version})/, '').
29
+ gsub(/^.*bosh-stemcell-/, 'bosh-').
30
+ split('-').reject { |c| c.empty? }.join('-')
31
+ end
32
+
24
33
  def url
25
34
  "#{PublicStemcells::PUBLIC_STEMCELLS_BASE_URL}/#{@key}"
26
35
  end
@@ -50,7 +50,6 @@ module Bosh::Bootstrap
50
50
  stemcell_tags.map do |stemcell_tag|
51
51
  stemcell_key = stemcell_tag.get_text('Key').value
52
52
  stemcell_size = Integer(stemcell_tag.get_text('Size').value)
53
-
54
53
  PublicStemcell.new(stemcell_key, stemcell_size)
55
54
  end
56
55
  end
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Bootstrap
3
- VERSION = "0.14.1"
3
+ VERSION = "0.14.2"
4
4
  end
5
5
  end
@@ -8,7 +8,7 @@ network:
8
8
  resources:
9
9
  persistent_disk: 16384
10
10
  cloud_properties:
11
- instance_type: m3.medium
11
+ instance_type: m1.medium
12
12
  availability_zone: us-west-2a
13
13
  cloud:
14
14
  plugin: aws
@@ -8,7 +8,7 @@ network:
8
8
  resources:
9
9
  persistent_disk: 16384
10
10
  cloud_properties:
11
- instance_type: m3.medium
11
+ instance_type: m1.medium
12
12
  cloud:
13
13
  plugin: aws
14
14
  properties:
@@ -12,7 +12,7 @@ network:
12
12
  resources:
13
13
  persistent_disk: 16384
14
14
  cloud_properties:
15
- instance_type: m3.medium
15
+ instance_type: m1.medium
16
16
  cloud:
17
17
  plugin: aws
18
18
  properties:
@@ -8,6 +8,7 @@ describe Bosh::Bootstrap::MicroboshProviders::AWS do
8
8
  let(:microbosh_yml) { File.expand_path("~/.microbosh/deployments/micro_bosh.yml") }
9
9
  let(:artifacts_base) { "https://bosh-jenkins-artifacts.s3.amazonaws.com" }
10
10
  let(:http_client) { instance_double("HTTPClient") }
11
+ let(:fog_compute) { instance_double("Fog::Compute::AWS") }
11
12
 
12
13
  it "creates micro_bosh.yml manifest" do
13
14
  setting "provider.name", "aws"
@@ -20,7 +21,7 @@ describe Bosh::Bootstrap::MicroboshProviders::AWS do
20
21
  setting "bosh.salted_password", "salted_password"
21
22
  setting "bosh.persistent_disk", 16384
22
23
 
23
- subject = Bosh::Bootstrap::MicroboshProviders::AWS.new(microbosh_yml, settings)
24
+ subject = Bosh::Bootstrap::MicroboshProviders::AWS.new(microbosh_yml, settings, fog_compute)
24
25
 
25
26
  subject.create_microbosh_yml(settings)
26
27
  expect(File).to be_exists(microbosh_yml)
@@ -39,7 +40,7 @@ describe Bosh::Bootstrap::MicroboshProviders::AWS do
39
40
  setting "bosh.salted_password", "salted_password"
40
41
  setting "bosh.persistent_disk", 16384
41
42
 
42
- subject = Bosh::Bootstrap::MicroboshProviders::AWS.new(microbosh_yml, settings)
43
+ subject = Bosh::Bootstrap::MicroboshProviders::AWS.new(microbosh_yml, settings, fog_compute)
43
44
 
44
45
  subject.create_microbosh_yml(settings)
45
46
  expect(File).to be_exists(microbosh_yml)
@@ -59,7 +60,7 @@ describe Bosh::Bootstrap::MicroboshProviders::AWS do
59
60
  setting "bosh.salted_password", "salted_password"
60
61
  setting "bosh.persistent_disk", 16384
61
62
 
62
- subject = Bosh::Bootstrap::MicroboshProviders::AWS.new(microbosh_yml, settings)
63
+ subject = Bosh::Bootstrap::MicroboshProviders::AWS.new(microbosh_yml, settings, fog_compute)
63
64
 
64
65
  subject.create_microbosh_yml(settings)
65
66
  expect(File).to be_exists(microbosh_yml)
@@ -97,7 +98,7 @@ describe Bosh::Bootstrap::MicroboshProviders::AWS do
97
98
  <Contents>
98
99
  <Key>bosh-stemcell/aws/light-bosh-stemcell-2719-aws-xen-ubuntu-trusty-go_agent.tgz</Key>
99
100
  <LastModified>2014-09-22T04:59:16.000Z</LastModified>
100
- <ETag>"18cb27adc889e71c97e39b1c57f85027"</ETag>
101
+ <ETag>"28cb27adc889e71c97e39b1c57f85027"</ETag>
101
102
  <Size>467288141</Size>
102
103
  <StorageClass>STANDARD</StorageClass>
103
104
  </Contents>
@@ -112,28 +113,78 @@ describe Bosh::Bootstrap::MicroboshProviders::AWS do
112
113
  it "light stemcell if us-east-1 target region" do
113
114
  setting "provider.region", "us-east-1"
114
115
 
115
- subject = Bosh::Bootstrap::MicroboshProviders::AWS.new(microbosh_yml, settings)
116
+ subject = Bosh::Bootstrap::MicroboshProviders::AWS.new(microbosh_yml, settings, fog_compute)
116
117
 
117
- latest_stemcell_uri = "#{artifacts_base}/bosh-stemcell/aws/light-bosh-stemcell-2719-aws-xen-ubuntu-trusty-go_agent.tgz"
118
+ latest_stemcell_uri = "#{artifacts_base}/bosh-stemcell/aws/" +
119
+ "light-bosh-stemcell-2719-aws-xen-ubuntu-trusty-go_agent.tgz"
118
120
  expect(subject).to receive(:sh).with("curl -O '#{latest_stemcell_uri}'")
119
- expect(subject.stemcell_path).to match /light-bosh-stemcell-2719-aws-xen-ubuntu-trusty-go_agent.tgz$/
120
- end
121
+ expect(subject).to receive(:find_ami_for_stemcell).
122
+ with("bosh-aws-xen-ubuntu-trusty-go_agent", "2719").
123
+ and_return(nil)
121
124
 
122
- xit "errors if AMI not available and not running within target region" do
123
- setting "provider.region", "us-west-2"
125
+ stemcell_path = subject.stemcell_path
126
+ expect(stemcell_path).to match /light-bosh-stemcell-2719-aws-xen-ubuntu-trusty-go_agent.tgz$/
124
127
  end
125
128
 
126
129
  it "downloads latest stemcell and returns path if running in target AWS region" do
127
130
  setting "provider.region", "us-west-2"
128
131
 
129
- subject = Bosh::Bootstrap::MicroboshProviders::AWS.new(microbosh_yml, settings)
130
-
131
- latest_stemcell_uri = "#{artifacts_base}/bosh-stemcell/aws/bosh-stemcell-2719-aws-xen-ubuntu-trusty-go_agent.tgz"
132
+ subject = Bosh::Bootstrap::MicroboshProviders::AWS.new(microbosh_yml, settings, fog_compute)
132
133
 
134
+ latest_stemcell_uri = "#{artifacts_base}/bosh-stemcell/aws/" +
135
+ "bosh-stemcell-2719-aws-xen-ubuntu-trusty-go_agent.tgz"
133
136
  expect(subject).to receive(:sh).with("curl -O '#{latest_stemcell_uri}'")
137
+ expect(subject).to receive(:find_ami_for_stemcell).
138
+ with("bosh-aws-xen-ubuntu-trusty-go_agent", "2719").
139
+ and_return(nil)
140
+
134
141
  stemcell_path = subject.stemcell_path
135
142
  expect(stemcell_path).to match /bosh-stemcell-2719-aws-xen-ubuntu-trusty-go_agent.tgz$/
136
143
  expect(stemcell_path).to_not match /light-bosh-stemcell-2719-aws-xen-ubuntu-trusty-go_agent.tgz$/
137
144
  end
145
+
146
+ it "discovers pre-created AMI and uses it instead" do
147
+ setting "provider.region", "us-west-2"
148
+
149
+ subject = Bosh::Bootstrap::MicroboshProviders::AWS.new(microbosh_yml, settings, fog_compute)
150
+
151
+ expect(subject).to_not receive(:sh)
152
+ expect(subject).to receive(:find_ami_for_stemcell).
153
+ with("bosh-aws-xen-ubuntu-trusty-go_agent", "2719").and_return("ami-123456")
154
+
155
+ stemcell_path = subject.stemcell_path
156
+ expect(stemcell_path).to match /ami-123456$/
157
+ end
158
+ end
159
+
160
+ describe "existing stemcells as AMIs" do
161
+ before do
162
+ setting "provider.region", "us-west-2"
163
+ end
164
+
165
+ it "finds match" do
166
+ subject = Bosh::Bootstrap::MicroboshProviders::AWS.new(microbosh_yml, settings, fog_compute)
167
+ expect(subject).to receive(:owned_images).and_return([
168
+ {
169
+ "description" => "bosh-aws-xen-ubuntu-trusty-go_agent 2222",
170
+ "imageId" => "ami-wrong-one"
171
+ },
172
+ {
173
+ "description" => "bosh-aws-xen-ubuntu-trusty-go_agent 2732",
174
+ "imageId" => "ami-123456"
175
+ },
176
+ {
177
+ "description" => "bosh-aws-xen-ubuntu-trusty-go_agent 2732",
178
+ "imageId" => "ami-some-other"
179
+ }
180
+ ])
181
+ expect(subject.find_ami_for_stemcell("bosh-aws-xen-ubuntu-trusty-go_agent", "2732")).to eq "ami-123456"
182
+ end
183
+
184
+ it "doesn't find match" do
185
+ subject = Bosh::Bootstrap::MicroboshProviders::AWS.new(microbosh_yml, settings, fog_compute)
186
+ expect(subject).to receive(:owned_images).and_return([])
187
+ expect(subject.find_ami_for_stemcell("xxxx", "12345")).to be_nil
188
+ end
138
189
  end
139
190
  end
@@ -5,6 +5,7 @@ describe Bosh::Bootstrap::MicroboshProviders::OpenStack do
5
5
  include Bosh::Bootstrap::Cli::Helpers::Settings
6
6
 
7
7
  let(:microbosh_yml) { File.expand_path("~/.microbosh/deployments/micro_bosh.yml")}
8
+ let(:fog_compute) { instance_double("Fog::Compute::OpenStack") }
8
9
 
9
10
  context "creates micro_bosh.yml manifest" do
10
11
  it "on nova with floating IP" do
@@ -20,10 +21,10 @@ describe Bosh::Bootstrap::MicroboshProviders::OpenStack do
20
21
  setting "bosh.salted_password", "salted_password"
21
22
  setting "bosh.persistent_disk", 16384
22
23
 
23
- subject = Bosh::Bootstrap::MicroboshProviders::OpenStack.new(microbosh_yml, settings)
24
+ subject = Bosh::Bootstrap::MicroboshProviders::OpenStack.new(microbosh_yml, settings, fog_compute)
24
25
 
25
26
  subject.create_microbosh_yml(settings)
26
- File.should be_exists(microbosh_yml)
27
+ expect(File).to be_exists(microbosh_yml)
27
28
  yaml_files_match(microbosh_yml, spec_asset("microbosh_yml/micro_bosh.openstack.nova_vip.yml"))
28
29
  end
29
30
 
@@ -43,10 +44,10 @@ describe Bosh::Bootstrap::MicroboshProviders::OpenStack do
43
44
  setting "bosh.salted_password", "salted_password"
44
45
  setting "bosh.persistent_disk", 16384
45
46
 
46
- subject = Bosh::Bootstrap::MicroboshProviders::OpenStack.new(microbosh_yml, settings)
47
+ subject = Bosh::Bootstrap::MicroboshProviders::OpenStack.new(microbosh_yml, settings, fog_compute)
47
48
 
48
49
  subject.create_microbosh_yml(settings)
49
- File.should be_exists(microbosh_yml)
50
+ expect(File).to be_exists(microbosh_yml)
50
51
  yaml_files_match(microbosh_yml, spec_asset("microbosh_yml/micro_bosh.openstack.neutron_vip.yml"))
51
52
  end
52
53
 
@@ -64,10 +65,10 @@ describe Bosh::Bootstrap::MicroboshProviders::OpenStack do
64
65
  setting "bosh.salted_password", "salted_password"
65
66
  setting "bosh.persistent_disk", 16384
66
67
 
67
- subject = Bosh::Bootstrap::MicroboshProviders::OpenStack.new(microbosh_yml, settings)
68
+ subject = Bosh::Bootstrap::MicroboshProviders::OpenStack.new(microbosh_yml, settings, fog_compute)
68
69
 
69
70
  subject.create_microbosh_yml(settings)
70
- File.should be_exists(microbosh_yml)
71
+ expect(File).to be_exists(microbosh_yml)
71
72
  yaml_files_match(microbosh_yml, spec_asset("microbosh_yml/micro_bosh.openstack.neutron_manual.yml"))
72
73
  end
73
74
 
@@ -87,10 +88,10 @@ describe Bosh::Bootstrap::MicroboshProviders::OpenStack do
87
88
 
88
89
  setting "provider.options.boot_from_volume", true
89
90
 
90
- subject = Bosh::Bootstrap::MicroboshProviders::OpenStack.new(microbosh_yml, settings)
91
+ subject = Bosh::Bootstrap::MicroboshProviders::OpenStack.new(microbosh_yml, settings, fog_compute)
91
92
 
92
93
  subject.create_microbosh_yml(settings)
93
- File.should be_exists(microbosh_yml)
94
+ expect(File).to be_exists(microbosh_yml)
94
95
  yaml_files_match(microbosh_yml, spec_asset("microbosh_yml/micro_bosh.openstack.boot_from_volume.yml"))
95
96
  end
96
97
  end
@@ -5,6 +5,7 @@ describe Bosh::Bootstrap::MicroboshProviders::VSphere do
5
5
  include Bosh::Bootstrap::Cli::Helpers::Settings
6
6
 
7
7
  let(:microbosh_yml) { File.expand_path("~/.microbosh/deployments/micro_bosh.yml")}
8
+ let(:fog_compute) { instance_double("Fog::Compute::VSphere") }
8
9
 
9
10
  it "creates micro_bosh.yml manifest" do
10
11
  setting "provider.name", "vsphere"
@@ -38,10 +39,10 @@ describe Bosh::Bootstrap::MicroboshProviders::VSphere do
38
39
  setting "bosh.password", "password"
39
40
  setting "bosh.salted_password", "salted_password"
40
41
 
41
- subject = Bosh::Bootstrap::MicroboshProviders::VSphere.new(microbosh_yml, settings)
42
+ subject = Bosh::Bootstrap::MicroboshProviders::VSphere.new(microbosh_yml, settings, fog_compute)
42
43
 
43
44
  subject.create_microbosh_yml(settings)
44
- File.should be_exists(microbosh_yml)
45
+ expect(File).to be_exists(microbosh_yml)
45
46
  yaml_files_match(microbosh_yml, spec_asset("microbosh_yml/micro_bosh.vsphere.yml"))
46
47
  end
47
48
  end
@@ -9,7 +9,7 @@ describe Bosh::Bootstrap::NetworkProviders::OpenStack do
9
9
  subject { Bosh::Bootstrap::NetworkProviders::OpenStack.new(provider_client) }
10
10
 
11
11
  it "is registered" do
12
- Bosh::Bootstrap::NetworkProviders.provider_class("openstack").should == subject.class
12
+ expect(Bosh::Bootstrap::NetworkProviders.provider_class("openstack")).to eq subject.class
13
13
  end
14
14
 
15
15
  it "creates security groups it needs" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh-bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.1
4
+ version: 0.14.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dr Nic Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-08 00:00:00.000000000 Z
11
+ date: 2014-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cyoi
@@ -123,7 +123,7 @@ dependencies:
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: rspec-fire
126
+ name: rspec
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ">="
@@ -210,7 +210,6 @@ files:
210
210
  - spec/integration/aws/aws_helpers.rb
211
211
  - spec/spec_helper.rb
212
212
  - spec/support/capture_stdout.rb
213
- - spec/support/rspec-fire.rb
214
213
  - spec/unit/.gitkeep
215
214
  - spec/unit/cli/bootstrap_spec.rb
216
215
  - spec/unit/commands/delete_spec.rb
@@ -263,7 +262,6 @@ test_files:
263
262
  - spec/integration/aws/aws_helpers.rb
264
263
  - spec/spec_helper.rb
265
264
  - spec/support/capture_stdout.rb
266
- - spec/support/rspec-fire.rb
267
265
  - spec/unit/.gitkeep
268
266
  - spec/unit/cli/bootstrap_spec.rb
269
267
  - spec/unit/commands/delete_spec.rb
@@ -1,9 +0,0 @@
1
- require 'rspec/fire'
2
-
3
- RSpec.configure do |config|
4
- config.include(RSpec::Fire)
5
- end
6
-
7
- RSpec::Fire.configure do |config|
8
- config.verify_constant_names = true
9
- end