bosh-bootstrap 0.14.2 → 0.14.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af248e749e33a61d0c03cc066b5200b093c3b835
4
- data.tar.gz: a6de1b93227da6d75030c2f38cf7e08dedf86c0a
3
+ metadata.gz: 107abb3ad26122e0fa2fb1e8b2eab29b753ab9e5
4
+ data.tar.gz: 25d5e7ef383295c216ba761477fdbab6d58a934d
5
5
  SHA512:
6
- metadata.gz: d5e5a743abb0cf0462e9f8f362dc7b874dd222ccb175bb3a5a7bcc3a276b7fe8e2f7f8bf6565e66b02538caef168376778dc80a9b1396e5f96a1a7c185943b49
7
- data.tar.gz: cda9ac07e4a1827cf3be8be1b30987c42f44930a999205cd8ba1a4f816efcc0ace9ddbf04c97da1bce8785684a4771fd855a75ee2fb6242500a9d8ecaa06d757
6
+ metadata.gz: 6909070081d3a519a4b270f8b637d8c03e5e42f6088836b1d6ba5bf9de0303b3a5fe1f4b4d593ebf3df6dc4fd66abcfa700445bf129021edd5995459cab0e7bb
7
+ data.tar.gz: 4fffaadec6c276db11f36501f46832002418a478ea51ddb56e4bedb9e5675b2a51b5780d59babd7df76867ef59331ddebcb74423e0bc42343ee7894829e6cfe5
data/ChangeLog.md CHANGED
@@ -9,12 +9,14 @@ bosh-bootstrap deploy
9
9
  ```
10
10
 
11
11
  v0.14
12
+ -----
12
13
 
13
14
  - default target directory is current director, rather than `~/.microbosh`
14
15
  - fixed to use new stemcells
15
16
  - [aws] VPC support - detects if VPCs available and allows selection, then select of subset, then creates security groups into the VPC
16
17
  - [aws vpc] network type: manual for vpc
17
18
  - [aws] reuse existing bosh stemcell AMIs - automatically detects if a stemcell has been uploaded/converted into an AMI [v0.14.2]
19
+ - [openstack] reuse existing bosh stemcell images - automatically detects if a stemcell has been uploaded/converted into an OpenStack image [v0.14.3]
18
20
 
19
21
  v0.13
20
22
  -----
@@ -68,6 +68,7 @@ class Bosh::Bootstrap::Cli::Commands::Deploy
68
68
  end
69
69
  settings.set("bosh.stemcell_path", stemcell_path)
70
70
  puts settings.bosh.stemcell_path
71
+ save_settings!
71
72
  end
72
73
 
73
74
  def perform_microbosh_deploy
@@ -60,7 +60,7 @@ class Bosh::Bootstrap::MicroboshProviders::Base
60
60
  end
61
61
 
62
62
  def stemcell_path
63
- unless settings.exists?("bosh.stemcell_path")
63
+ settings.exists?("bosh.stemcell_path") || begin
64
64
  if image = discover_if_stemcell_image_already_uploaded
65
65
  return image
66
66
  end
@@ -131,6 +131,26 @@ module Bosh::Bootstrap::MicroboshProviders
131
131
  end
132
132
  end
133
133
 
134
+ def owned_images
135
+ fog_compute.images
136
+ end
137
+
138
+ # @return [String] Any AMI imageID
139
+ # e.g. "BOSH-14c85f35-3dd3-4200-af85-ada65216b2de" for given BOSH stemcell name/version
140
+ # Usage: find_ami_for_stemcell("bosh-openstack-kvm-ubuntu-trusty-go_agent", "2732")
141
+ def find_image_for_stemcell(name, version)
142
+ image = owned_images.find do |image|
143
+ metadata = image.metadata
144
+ metadata_name = metadata.find { |m| m.key == "name" }
145
+ metadata_version = metadata.find { |m| m.key == "version" }
146
+ metadata_name && metadata_version && metadata_name.value == name && metadata_version.value == version
147
+ end
148
+ image.name if image
149
+ end
150
+
151
+ def discover_if_stemcell_image_already_uploaded
152
+ find_image_for_stemcell(latest_stemcell.stemcell_name, latest_stemcell.version)
153
+ end
134
154
  end
135
155
  end
136
156
  Bosh::Bootstrap::MicroboshProviders.register_provider("openstack", Bosh::Bootstrap::MicroboshProviders::OpenStack)
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Bootstrap
3
- VERSION = "0.14.2"
3
+ VERSION = "0.14.3"
4
4
  end
5
5
  end
@@ -95,4 +95,29 @@ describe Bosh::Bootstrap::MicroboshProviders::OpenStack do
95
95
  yaml_files_match(microbosh_yml, spec_asset("microbosh_yml/micro_bosh.openstack.boot_from_volume.yml"))
96
96
  end
97
97
  end
98
+
99
+ describe "existing stemcells as openstack images" do
100
+
101
+ it "finds match" do
102
+ subject = Bosh::Bootstrap::MicroboshProviders::OpenStack.new(microbosh_yml, settings, fog_compute)
103
+ expect(subject).to receive(:owned_images).and_return([
104
+ instance_double("Fog::Compute::OpenStack::Image",
105
+ name: "BOSH-14c85f35-3dd3-4200-af85-ada65216b2de",
106
+ metadata: [
107
+ instance_double("Fog::Compute::OpenStack::Metadata",
108
+ key: "name", value: "bosh-openstack-kvm-ubuntu-trusty-go_agent"),
109
+ instance_double("Fog::Compute::OpenStack::Metadata",
110
+ key: "version", value: "2732"),
111
+ ])
112
+ ])
113
+ expect(subject.find_image_for_stemcell("bosh-openstack-kvm-ubuntu-trusty-go_agent", "2732")).to eq("BOSH-14c85f35-3dd3-4200-af85-ada65216b2de")
114
+ end
115
+
116
+ it "doesn't find match" do
117
+ subject = Bosh::Bootstrap::MicroboshProviders::OpenStack.new(microbosh_yml, settings, fog_compute)
118
+ expect(subject).to receive(:owned_images).and_return([])
119
+ expect(subject.find_image_for_stemcell("xxxx", "12345")).to be_nil
120
+ end
121
+ end
122
+
98
123
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh-bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.2
4
+ version: 0.14.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dr Nic Williams