bosh-cloudfoundry 0.7.0.alpha.6 → 0.7.0.alpha.7

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.
data/README.md CHANGED
@@ -14,22 +14,71 @@ $ bosh delete cf
14
14
 
15
15
  The deployed Cloud Foundry does not include any data or messaging services for the user applications. These are available as add-ons coming soon.
16
16
 
17
- [![Build Status](https://travis-ci.org/StarkAndWayne/bosh-cloudfoundry.png?branch=v0.7)](https://travis-ci.org/StarkAndWayne/bosh-cloudfoundry)
17
+ [![Build Status](https://travis-ci.org/cloudfoundry-community/bosh-cloudfoundry.png?branch=v0.7)](https://travis-ci.org/StarkAndWayne/bosh-cloudfoundry) [![Stories in Ready](http://badge.waffle.io/cloudfoundry-community/bosh-cloudfoundry.png)](http://waffle.io/cloudfoundry-community/bosh-cloudfoundry)
18
+
19
+ ## What gets created?
20
+
21
+ The amount of resources used to run Cloud Foundry is determined by the `--deployment-size` you choose (defaults to medium) and the scale you grow it to over time.
22
+
23
+ Currently there are two deployment sizes supported: medium & large.
24
+
25
+ For a medium deployment the following VMs are created and have the following vitals after creation:
26
+
27
+ ```
28
+ $ bosh create cf ... --deployment-size medium
29
+ $ bosh vms --vitals
30
+ +-----------+---------+---------------+-------------------------------+-----------------------+------+------+------+----------------+------------+------------+------------+------------+
31
+ | Job/index | State | Resource Pool | IPs | Load | CPU | CPU | CPU | Memory Usage | Swap Usage | System | Ephemeral | Persistent |
32
+ | | | | | (avg01, avg05, avg15) | User | Sys | Wait | | | Disk Usage | Disk Usage | Disk Usage |
33
+ +-----------+---------+---------------+-------------------------------+-----------------------+------+------+------+----------------+------------+------------+------------+------------+
34
+ | api/0 | running | small | 10.159.35.150, 54.225.102.129 | 0.06%, 0.08%, 0.13% | 0.1% | 0.2% | 0.0% | 13.7% (227.8M) | 0.0% (0B) | 49% | 1% | n/a |
35
+ | core/0 | running | small | 10.118.153.76 | 1.25%, 0.87%, 0.35% | 0.0% | 0.0% | 0.1% | 23.6% (391.7M) | 0.0% (0B) | 49% | 1% | n/a |
36
+ | data/0 | running | small | 10.158.26.49 | 0.02%, 0.02%, 0.07% | 0.0% | 0.0% | 0.2% | 7.1% (118.9M) | 0.0% (0B) | 49% | 1% | 4% |
37
+ | dea/0 | running | small | 10.235.53.185 | 0.07%, 0.07%, 0.06% | 0.1% | 0.2% | 0.0% | 19.2% (319.8M) | 0.0% (0B) | 49% | 2% | n/a |
38
+ | uaa/0 | running | small | 10.29.186.245 | 0.09%, 0.10%, 0.08% | 0.1% | 0.0% | 0.1% | 28.3% (469.7M) | 0.0% (0B) | 49% | 1% | n/a |
39
+ +-----------+---------+---------------+-------------------------------+-----------------------+------+------+------+----------------+------------+------------+------------+------------+
40
+ ```
41
+
42
+ For a large deployment, all jobs (moving parts) of Cloud Foundry are isolated into their own VMs, and it includes a syslog aggregator:
43
+
44
+ ```
45
+ $ bosh create cf ... --deployment-size large
46
+ $ bosh vms --vitals
47
+ +---------------------+---------+---------------+------------------------------+-----------------------+------+------+-------+----------------+------------+------------+------------+------------+
48
+ | Job/index | State | Resource Pool | IPs | Load | CPU | CPU | CPU | Memory Usage | Swap Usage | System | Ephemeral | Persistent |
49
+ | | | | | (avg01, avg05, avg15) | User | Sys | Wait | | | Disk Usage | Disk Usage | Disk Usage |
50
+ +---------------------+---------+---------------+------------------------------+-----------------------+------+------+-------+----------------+------------+------------+------------+------------+
51
+ | cloud_controller/0 | running | small | 10.152.174.25 | 0.15%, 0.12%, 0.08% | 0.0% | 0.0% | 0.3% | 11.0% (183.2M) | 0.0% (0B) | 49% | 1% | n/a |
52
+ | dea/0 | running | large | 10.144.83.102 | 0.80%, 0.36%, 0.15% | 0.0% | 0.0% | 0.0% | 5.3% (400.5M) | 0.0% (0B) | 49% | 1% | n/a |
53
+ | health_manager/0 | running | small | 10.147.214.194 | 0.07%, 0.12%, 0.13% | 0.0% | 0.0% | 0.2% | 7.1% (118.4M) | 0.0% (0B) | 49% | 1% | n/a |
54
+ | login/0 | running | small | 10.144.157.79 | 0.06%, 0.27%, 0.17% | 0.0% | 0.0% | 0.2% | 18.9% (313.8M) | 0.0% (0B) | 49% | 1% | n/a |
55
+ | nats/0 | running | small | 10.152.188.72 | 0.04%, 0.14%, 0.13% | 0.0% | 0.0% | 0.0% | 5.9% (98.0M) | 0.0% (0B) | 49% | 1% | n/a |
56
+ | nfs_server/0 | running | small | 10.164.22.218 | 0.03%, 0.09%, 0.09% | 0.0% | 0.0% | 15.5% | 5.2% (87.8M) | 0.0% (0B) | 49% | 1% | 1% |
57
+ | postgres/0 | running | small | 10.154.152.54 | 0.25%, 0.17%, 0.12% | 0.0% | 0.1% | 0.1% | 6.7% (111.2M) | 0.0% (0B) | 49% | 1% | 1% |
58
+ | router/0 | running | small | 10.164.87.23, 54.225.102.129 | 0.04%, 0.09%, 0.07% | 0.0% | 0.0% | 0.7% | 5.6% (93.0M) | 0.0% (0B) | 49% | 1% | n/a |
59
+ | syslog_aggregator/0 | running | small | 10.165.35.246 | 0.00%, 0.14%, 0.14% | 0.0% | 0.0% | 0.8% | 6.3% (105.0M) | 0.0% (0B) | 49% | 1% | 1% |
60
+ | uaa/0 | running | small | 10.165.13.230 | 0.11%, 0.59%, 0.38% | 0.0% | 0.0% | 0.0% | 29.6% (491.4M) | 0.0% (0B) | 49% | 1% | n/a |
61
+ +---------------------+---------+---------------+------------------------------+-----------------------+------+------+-------+----------------+------------+------------+------------+------------+
62
+ ```
18
63
 
19
64
  ## Requirements
20
65
 
21
- You must use the same BOSH for deploying redis as you use to deploy Cloud Foundry (unless your DNS is configured to be shared across the two BOSH).
66
+ You will also need an IP address, and a wildcard DNS A record that points to the IP address.
22
67
 
23
- It is also required that you have login access to the same BOSH being used to deploy your Cloud Foundry.
68
+ It is also required that you have login access to a BOSH on AWS EC2 or OpenStack (please help with vSphere support).
24
69
 
25
70
  Confirm this by running:
26
71
 
27
72
  ```
28
73
  $ bosh status
29
- $ bosh deployments
30
74
  ```
31
75
 
32
- The former will confirm you are targeting a bosh. The latter will display the deployments. One of which should be your Cloud Foundry.
76
+ To create your own BOSH on AWS or OpenStack:
77
+
78
+ ```
79
+ $ gem install bosh-bootstrap
80
+ $ bosh-bootstrap deploy
81
+ ```
33
82
 
34
83
  ## Installation
35
84
 
@@ -67,14 +116,29 @@ NOTE: By default, the `default` security group is used.
67
116
  You will be prompted to confirm that your chosen/default security group has ports `22`, `80`, `443` and `4222` open. To chose a different security group, use the `--security-group` option:
68
117
 
69
118
  ```
70
- $ bosh create redis --security-group cf-core
119
+ $ bosh create cf --security-group cf-core
71
120
  ```
72
121
 
73
122
  * TODO - how to show available instance sizes
74
123
  * TODO - how to update Cloud Foundry servers to a different instance size/flavor
75
- * TODO - how to scale from a small deployment to a large deployment
76
124
  * TODO - how to update the persistent disks of the deployment
77
125
 
126
+ ## Initializing Cloud Foundry
127
+
128
+ Once Cloud Foundry is up and running, follow these steps to login (and discover your password) and create an initial organization and space:
129
+
130
+ ```
131
+ $ cf target api.mycloud.com
132
+ $ bosh show cf passwords
133
+ Common password: 6d7fe84f828b
134
+ $ cf login admin
135
+ Password> 6d7fe84f828b
136
+
137
+ $ cf create-org me
138
+ $ cf create-space production
139
+ $ cf switch-space production
140
+ ```
141
+
78
142
  ## Releasing new plugin gem versions
79
143
 
80
144
  There are two reasons to release new versions of this plugin.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "bosh-cloudfoundry"
5
- spec.version = "0.7.0.alpha.6"
5
+ spec.version = "0.7.0.alpha.7"
6
6
  spec.authors = ["Dr Nic Williams"]
7
7
  spec.email = ["drnicwilliams@gmail.com"]
8
8
  spec.description = %q{Create & manage Cloud Foundry deployments}
@@ -16,6 +16,7 @@ Gem::Specification.new do |spec|
16
16
  spec.require_paths = ["lib"]
17
17
 
18
18
  spec.add_runtime_dependency "bosh_cli", "~> 1.5.0.pre"
19
+ spec.add_dependency "net-dns"
19
20
 
20
21
  spec.add_development_dependency "rake"
21
22
  spec.add_development_dependency "bundler", "~> 1.3"
@@ -77,6 +77,8 @@ module Bosh::Cli::Command
77
77
  attrs.validate(:deployment_size)
78
78
  end
79
79
 
80
+ validate_dns_mapping
81
+
80
82
  unless confirmed?("Security group #{attrs.validated_color(:security_group)} exists with ports #{attrs.required_ports.join(", ")}")
81
83
  cancel_deployment
82
84
  end
@@ -97,13 +99,21 @@ module Bosh::Cli::Command
97
99
  end
98
100
  end
99
101
 
100
- usage "show cf passwords"
101
- desc "display the internal passwords for deployment"
102
- def show_cf_passwords
103
-
102
+ usage "show cf properties"
103
+ desc "display the deployment properties, indicate which are changable"
104
+ def show_cf_properties
104
105
  setup_deployment_attributes
105
106
  reconstruct_deployment_file
106
- say "Common password: #{attrs.validated_color(:common_password)}"
107
+ nl
108
+ say "Immutable properties:"
109
+ attrs.immutable_attributes.each do |attr_name|
110
+ say "#{attr_name}: #{attrs.validated_color(attr_name.to_sym)}"
111
+ end
112
+ nl
113
+ say "Mutable (changable) properties:"
114
+ attrs.mutable_attributes.each do |attr_name|
115
+ say "#{attr_name}: #{attrs.validated_color(attr_name.to_sym)}"
116
+ end
107
117
  end
108
118
 
109
119
  protected
@@ -182,5 +192,9 @@ module Bosh::Cli::Command
182
192
  end
183
193
  cmd
184
194
  end
195
+
196
+ def validate_dns_mapping
197
+ attrs.validate_dns_mapping
198
+ end
185
199
  end
186
200
  end
@@ -3,8 +3,12 @@ module Bosh; module Cloudfoundry; end; end
3
3
  require "cli/core_ext"
4
4
  require "cli/validation"
5
5
 
6
+ # For SecureRandom.hex
7
+ require "securerandom"
8
+
6
9
  require "bosh/cloudfoundry/release_version"
7
10
  require "bosh/cloudfoundry/release_version_cpi"
8
11
  require "bosh/cloudfoundry/release_version_cpi_size"
9
12
  require "bosh/cloudfoundry/deployment_attributes"
10
- require "bosh/cloudfoundry/deployment_file"
13
+ require "bosh/cloudfoundry/deployment_file"
14
+ require "bosh/cloudfoundry/validations"
@@ -6,12 +6,12 @@ module Bosh::Cloudfoundry
6
6
  include Bosh::Cli::Validation
7
7
 
8
8
  attr_reader :attributes
9
- attr_reader :released_version_cpi
9
+ attr_reader :release_version_cpi
10
10
 
11
- def initialize(director_client, bosh_status, released_version_cpi, attributes = {})
11
+ def initialize(director_client, bosh_status, release_version_cpi, attributes = {})
12
12
  @director_client = director_client
13
13
  @bosh_status = bosh_status
14
- @released_version_cpi = released_version_cpi
14
+ @release_version_cpi = release_version_cpi
15
15
  @attributes = attributes
16
16
  @attributes[:name] ||= default_name
17
17
  @attributes[:deployment_size] ||= default_deployment_size
@@ -36,6 +36,10 @@ module Bosh::Cloudfoundry
36
36
  @attributes[:security_group]
37
37
  end
38
38
 
39
+ def common_password
40
+ @attributes[:common_password]
41
+ end
42
+
39
43
  def ip_addresses
40
44
  @attributes[:ip_addresses]
41
45
  end
@@ -44,6 +48,20 @@ module Bosh::Cloudfoundry
44
48
  @attributes[:dns]
45
49
  end
46
50
 
51
+ def available_attributes
52
+ @attributes.keys
53
+ end
54
+
55
+ # Attributes & their values that can be changed via setters & deployment re-deployed successfully
56
+ def mutable_attributes
57
+ release_version_cpi.mutable_attributes
58
+ end
59
+
60
+ # Attributes & their values that are not to be changed over time
61
+ def immutable_attributes
62
+ release_version_cpi.immutable_attributes
63
+ end
64
+
47
65
  def set_unless_nil(attribute, value)
48
66
  attributes[attribute.to_sym] = value if value
49
67
  end
@@ -63,6 +81,25 @@ module Bosh::Cloudfoundry
63
81
  end
64
82
  end
65
83
 
84
+ # FIXME only supports a single ip_address
85
+ def validate_dns_mapping
86
+ validate_dns_a_record("api.#{dns}", ip_addresses.first)
87
+ validate_dns_a_record("demoapp.#{dns}", ip_addresses.first)
88
+ end
89
+
90
+ def validate_dns_a_record(domain, expected_ip_address)
91
+ dns_mapping = Bosh::Cloudfoundry::Validations::DnsIpMappingValidation.new(domain, expected_ip_address)
92
+ if dns_mapping.valid?
93
+ say "`#{dns_mapping.domain}' maps to #{dns_mapping.ip_address}".make_green
94
+ else
95
+ say "Validation errors:"
96
+ dns_mapping.errors.each do |error|
97
+ say "- %s" % [error]
98
+ end
99
+ err "`#{dns_mapping.domain}' does not map to #{dns_mapping.ip_address}"
100
+ end
101
+ end
102
+
66
103
  def format(attribute)
67
104
  value = attributes[attribute.to_sym].to_s
68
105
  end
@@ -76,18 +113,18 @@ module Bosh::Cloudfoundry
76
113
  # TODO move these validations into a "ValidatedSize" class or similar
77
114
  def available_resources
78
115
  @available_resources ||= begin
79
- resources = released_version_cpi.spec["resources"]
116
+ resources = release_version_cpi.spec["resources"]
80
117
  if resources && resources.is_a?(Array) && resources.first.is_a?(String)
81
118
  resources
82
119
  else
83
- err "template spec needs 'resources' key with list of resource pool names available; found #{released_version_cpi.spec.inspect}"
120
+ err "template spec needs 'resources' key with list of resource pool names available; found #{release_version_cpi.spec.inspect}"
84
121
  end
85
122
  end
86
123
  end
87
124
 
88
125
  def available_deployment_sizes
89
126
  @available_deployment_sizes ||= begin
90
- deployment_sizes = released_version_cpi.spec["deployment_sizes"]
127
+ deployment_sizes = release_version_cpi.spec["deployment_sizes"]
91
128
  if deployment_sizes && deployment_sizes.is_a?(Array) && deployment_sizes.first.is_a?(String)
92
129
  deployment_sizes
93
130
  else
@@ -46,6 +46,24 @@ module Bosh::Cloudfoundry
46
46
  @release_name = "cf-release" # TODO determine from release file
47
47
  end
48
48
 
49
+ # Attributes & their values that can be changed via setters & deployment re-deployed successfully
50
+ def mutable_attributes
51
+ spec["mutable_attributes"]
52
+ end
53
+
54
+ # Attributes & their values that are not to be changed over time
55
+ def immutable_attributes
56
+ spec["immutable_attributes"]
57
+ end
58
+
59
+ def available_cpi_names
60
+ spec["available_cpi"]
61
+ end
62
+
63
+ def valid_cpi?(cpi)
64
+ available_cpi_names.include?(cpi)
65
+ end
66
+
49
67
  def self.base_template_dir
50
68
  File.expand_path("../../../../templates", __FILE__)
51
69
  end
@@ -54,14 +72,13 @@ module Bosh::Cloudfoundry
54
72
  File.join(self.class.base_template_dir, "v#{version_number}")
55
73
  end
56
74
 
57
- def available_cpi_names
58
- @available_cpi_names ||= begin
59
- Dir[File.join(template_dir, "*")].map {|dir| File.basename(dir)}
60
- end
75
+ def spec_path
76
+ File.join(template_dir, "spec")
61
77
  end
62
78
 
63
- def valid_cpi?(cpi)
64
- available_cpi_names.include?(cpi)
79
+ def spec
80
+ @spec ||= YAML.load_file(spec_path)
65
81
  end
82
+
66
83
  end
67
84
  end
@@ -33,7 +33,7 @@ module Bosh::Cloudfoundry
33
33
  end
34
34
 
35
35
  def spec
36
- YAML.load_file(spec_path)
36
+ @spec ||= YAML.load_file(spec_path)
37
37
  end
38
38
 
39
39
  def available_deployment_sizes
@@ -51,5 +51,15 @@ module Bosh::Cloudfoundry
51
51
  def release_version_number
52
52
  release_version.version_number
53
53
  end
54
+
55
+ # Attributes & their values that can be changed via setters & deployment re-deployed successfully
56
+ def mutable_attributes
57
+ release_version.mutable_attributes
58
+ end
59
+
60
+ # Attributes & their values that are not to be changed over time
61
+ def immutable_attributes
62
+ release_version.immutable_attributes
63
+ end
54
64
  end
55
65
  end
@@ -0,0 +1 @@
1
+ require "bosh/cloudfoundry/validations/dns_ip_mapping_validation"
@@ -0,0 +1,53 @@
1
+ # for validating DNS -> IP setups
2
+ require 'net/dns'
3
+
4
+ module Bosh::Cloudfoundry::Validations
5
+ # Validates that +domain+ is an A record that resolves to +expected_ip_addresses+
6
+ # and no other IP addresses.
7
+ #
8
+ # Usage:
9
+ #
10
+ # dns_mapping = Bosh::Cloudfoundry::Validations::DnsIpMappingValidation.new("foobar.mycloud.com", "1.2.3.4")
11
+ # if dns_mapping.valid?
12
+ # puts "`#{dns_mapping.domain}' maps to #{dns_mapping.ip_address}"
13
+ # else
14
+ # puts "Validation errors:"
15
+ # dns_mapping.errors.each do |error|
16
+ # puts "- %s" % [error]
17
+ # end
18
+ # puts "`#{dns_mapping.domain}' does not map to #{dns_mapping.ip_address}"
19
+ # end
20
+ class DnsIpMappingValidation
21
+ include Bosh::Cli::Validation
22
+ include BoshExtensions
23
+
24
+ attr_reader :domain
25
+ attr_reader :ip_address
26
+
27
+ def initialize(domain, ip_address)
28
+ @domain = domain
29
+ @ip_address = ip_address
30
+ end
31
+
32
+ def perform_validation(options={})
33
+ resolved_a_records = nil
34
+ step("Resolve DNS",
35
+ "Cannot resolve DNS '#{domain}' to an IP address", :fatal) do
36
+ any_resolved_records, resolved_a_records = resolve_dns(domain)
37
+ any_resolved_records
38
+ end
39
+
40
+ step("Resolve DNS '#{domain}' to IP '#{ip_address}'",
41
+ "DNS '#{domain}' resolves to: #{resolved_a_records.join(', ')}") do
42
+ resolved_a_records == [ip_address]
43
+ end
44
+ end
45
+
46
+ protected
47
+ def resolve_dns(domain)
48
+ packet = Net::DNS::Resolver.start(domain, Net::DNS::A)
49
+ resolved_a_records = packet.answer.map(&:value)
50
+ [(packet.answer.size > 0), resolved_a_records]
51
+ end
52
+ end
53
+ end
@@ -33,7 +33,7 @@ compilation:
33
33
  resource_pools:
34
34
  - name: small
35
35
  network: default
36
- size: 4
36
+ size: 5
37
37
  stemcell:
38
38
  name: bosh-stemcell
39
39
  version: latest
@@ -42,7 +42,7 @@ resource_pools:
42
42
 
43
43
  - name: medium
44
44
  network: default
45
- size: 1
45
+ size: 0
46
46
  stemcell:
47
47
  name: bosh-stemcell
48
48
  version: latest
@@ -75,7 +75,7 @@ jobs:
75
75
  - collector
76
76
  - login
77
77
  instances: 1
78
- resource_pool: medium
78
+ resource_pool: small
79
79
  networks:
80
80
  - name: default
81
81
  default:
@@ -0,0 +1,51 @@
1
+ describe Bosh::Cloudfoundry::DeploymentAttributes do
2
+ let(:director) { instance_double("Bosh::Cli::Director") }
3
+ let(:bosh_status) { {"cpi" => "aws", "uuid" => "uuid"} }
4
+ let(:release_version_cpi) { instance_double("Bosh::Cloudfoundry::ReleaseVersionCpi")}
5
+
6
+ before { SecureRandom.stub(:hex).and_return("qwertyqwerty") }
7
+
8
+ context "default value" do
9
+ subject { Bosh::Cloudfoundry::DeploymentAttributes.new(director, bosh_status, release_version_cpi) }
10
+ it { subject.deployment_size.should == "medium" }
11
+ it { subject.persistent_disk.should == 4096 }
12
+ it { subject.security_group.should == "default" }
13
+ it { subject.common_password.should == "qwertyqwerty" }
14
+ end
15
+
16
+ context "attributes" do
17
+ it "returns default attributes" do
18
+ subject = Bosh::Cloudfoundry::DeploymentAttributes.new(director, bosh_status, release_version_cpi)
19
+ subject.available_attributes.sort.should ==
20
+ %w[common_password deployment_size name persistent_disk security_group].map(&:to_sym)
21
+ end
22
+
23
+ it "returns additional attributes" do
24
+ subject = Bosh::Cloudfoundry::DeploymentAttributes.new(director, bosh_status, release_version_cpi, {
25
+ dns: "mycloud.com", ip_addresses: ["1.2.3.4"]
26
+ })
27
+ subject.available_attributes.sort.should ==
28
+ %w[common_password deployment_size dns ip_addresses name persistent_disk security_group].map(&:to_sym)
29
+ end
30
+
31
+ # immutable_attributes ultimately determined by ReleaseVersion (from templates/vXYZ/spec)
32
+ it "immutable_attributes derived from release_version[_cpi]" do
33
+ immutable_attributes = %w[common_password deployment_size dns name].map(&:to_sym)
34
+ release_version_cpi.should_receive(:immutable_attributes).and_return(immutable_attributes)
35
+ subject = Bosh::Cloudfoundry::DeploymentAttributes.new(director, bosh_status, release_version_cpi, {
36
+ dns: "mycloud.com", ip_addresses: ["1.2.3.4"]
37
+ })
38
+ subject.immutable_attributes.should == immutable_attributes
39
+ end
40
+
41
+ # mutable_attributes ultimately determined by ReleaseVersion (from templates/vXYZ/spec)
42
+ it "mutable_attributes derived from release_version[_cpi]" do
43
+ mutable_attributes = %w[ip_addresses persistent_disk security_group].map(&:to_sym)
44
+ release_version_cpi.should_receive(:mutable_attributes).and_return(mutable_attributes)
45
+ subject = Bosh::Cloudfoundry::DeploymentAttributes.new(director, bosh_status, release_version_cpi, {
46
+ dns: "mycloud.com", ip_addresses: ["1.2.3.4"]
47
+ })
48
+ subject.mutable_attributes.should == mutable_attributes
49
+ end
50
+ end
51
+ end
data/spec/plugin_spec.rb CHANGED
@@ -78,6 +78,7 @@ describe Bosh::Cli::Command::CloudFoundry do
78
78
  command.add_option(:common_password, "qwertyasdfgh")
79
79
 
80
80
  command.should_receive(:auth_required)
81
+ command.should_receive(:validate_dns_mapping)
81
82
 
82
83
  director = instance_double("Bosh::Cli::Director")
83
84
  director.should_receive(:get_status).and_return({"uuid" => "UUID", "cpi" => "aws"})
@@ -97,11 +98,11 @@ describe Bosh::Cli::Command::CloudFoundry do
97
98
 
98
99
  end
99
100
 
100
- it "displays the list of internal passwords" do
101
+ it "displays the list of attributes/properties" do
101
102
  command.add_option(:config, home_file(".bosh_config"))
102
103
  command.add_option(:non_interactive, true)
103
104
 
104
- director = mock("director_client")
105
+ director = instance_double("Bosh::Cli::Director")
105
106
  director.should_receive(:get_status).and_return({"uuid" => "UUID", "cpi" => "aws"})
106
107
  command.stub(:director_client).and_return(director)
107
108
 
@@ -113,12 +114,20 @@ describe Bosh::Cli::Command::CloudFoundry do
113
114
  ],
114
115
  "properties" => {
115
116
  "cf" => {
116
- "common_passwords" => "qwerty"
117
+ # immutable attributes (determined via ReleaseVersion via templates/vXYZ/spec)
118
+ "name" => "demo",
119
+ "deployment_size" => "medium",
120
+ "dns" => "mycloud.com",
121
+ "common_password" => "qwerty",
122
+ # mutable attributes (determined via ReleaseVersion via templates/vXYZ/spec)
123
+ "ip_addresses" => ["1.2.3.4"],
124
+ "persistent_disk" => 4096,
125
+ "security_group" => "cf"
117
126
  }
118
127
  }
119
128
  }.to_yaml
120
129
  end
121
- command.show_cf_passwords
130
+ command.show_cf_properties
122
131
  end
123
132
  end
124
133
 
@@ -0,0 +1,24 @@
1
+ describe Bosh::Cloudfoundry::Validations::DnsIpMappingValidation do
2
+ subject { Bosh::Cloudfoundry::Validations::DnsIpMappingValidation.new("some.domain.com", "1.2.3.4") }
3
+
4
+ it "resolves valid DNS -> single IP mapping" do
5
+ subject.should_receive(:resolve_dns).with("some.domain.com").and_return([true, ["1.2.3.4"]])
6
+ subject.validate
7
+ subject.should be_valid
8
+ subject.errors.should == []
9
+ end
10
+
11
+ it "fails to resolve invalid DNS -> single IP mapping" do
12
+ subject.should_receive(:resolve_dns).with("some.domain.com").and_return([false, []])
13
+ subject.validate
14
+ subject.should_not be_valid
15
+ subject.errors.should == ["Cannot resolve DNS 'some.domain.com' to an IP address"]
16
+ end
17
+
18
+ it "resolves DNS to a different IP" do
19
+ subject.should_receive(:resolve_dns).with("some.domain.com").and_return([true, ["6.6.6.6"]])
20
+ subject.validate
21
+ subject.should_not be_valid
22
+ subject.errors.should == ["DNS 'some.domain.com' resolves to: 6.6.6.6"]
23
+ end
24
+ end
@@ -0,0 +1,14 @@
1
+ ---
2
+ available_cpi:
3
+ - aws
4
+ - openstack
5
+
6
+ mutable_attributes:
7
+ - ip_addresses
8
+ - persistent_disk
9
+ - security_group
10
+ immutable_attributes:
11
+ - common_password
12
+ - deployment_size
13
+ - dns
14
+ - name
@@ -68,7 +68,7 @@ compilation:
68
68
  resource_pools:
69
69
  - name: small
70
70
  network: default
71
- size: 4
71
+ size: 5
72
72
  stemcell:
73
73
  name: bosh-stemcell
74
74
  version: latest
@@ -77,7 +77,7 @@ resource_pools:
77
77
 
78
78
  - name: medium
79
79
  network: default
80
- size: 1
80
+ size: 0
81
81
  stemcell:
82
82
  name: bosh-stemcell
83
83
  version: latest
@@ -110,7 +110,7 @@ jobs:
110
110
  - collector
111
111
  - login
112
112
  instances: 1
113
- resource_pool: medium
113
+ resource_pool: small
114
114
  networks:
115
115
  - name: default
116
116
  default:
@@ -68,7 +68,7 @@ compilation:
68
68
  resource_pools:
69
69
  - name: small
70
70
  network: default
71
- size: 4
71
+ size: 5
72
72
  stemcell:
73
73
  name: bosh-stemcell
74
74
  version: latest
@@ -77,7 +77,7 @@ resource_pools:
77
77
 
78
78
  - name: medium
79
79
  network: default
80
- size: 1
80
+ size: 0
81
81
  stemcell:
82
82
  name: bosh-stemcell
83
83
  version: latest
@@ -110,7 +110,7 @@ jobs:
110
110
  - collector
111
111
  - login
112
112
  instances: 1
113
- resource_pool: medium
113
+ resource_pool: small
114
114
  networks:
115
115
  - name: default
116
116
  default:
@@ -0,0 +1,14 @@
1
+ ---
2
+ available_cpi:
3
+ - aws
4
+ - openstack
5
+
6
+ mutable_attributes:
7
+ - ip_addresses
8
+ - persistent_disk
9
+ - security_group
10
+ immutable_attributes:
11
+ - common_password
12
+ - deployment_size
13
+ - dns
14
+ - name
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh-cloudfoundry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0.alpha.6
4
+ version: 0.7.0.alpha.7
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-07-16 00:00:00.000000000 Z
12
+ date: 2013-07-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bosh_cli
@@ -27,6 +27,22 @@ dependencies:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  version: 1.5.0.pre
30
+ - !ruby/object:Gem::Dependency
31
+ name: net-dns
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
30
46
  - !ruby/object:Gem::Dependency
31
47
  name: rake
32
48
  requirement: !ruby/object:Gem::Requirement
@@ -424,16 +440,20 @@ files:
424
440
  - lib/bosh/cloudfoundry/release_version.rb
425
441
  - lib/bosh/cloudfoundry/release_version_cpi.rb
426
442
  - lib/bosh/cloudfoundry/release_version_cpi_size.rb
443
+ - lib/bosh/cloudfoundry/validations.rb
444
+ - lib/bosh/cloudfoundry/validations/dns_ip_mapping_validation.rb
427
445
  - spec/assets/v132/aws/large.yml
428
446
  - spec/assets/v132/aws/medium.yml
429
447
  - spec/assets/v133/aws/large.yml
430
448
  - spec/assets/v133/aws/medium.yml
449
+ - spec/deployment_attributes_spec.rb
431
450
  - spec/deployment_file_spec.rb
432
451
  - spec/plugin_spec.rb
433
452
  - spec/release_version_cpi_size_spec.rb
434
453
  - spec/release_version_cpi_spec.rb
435
454
  - spec/release_version_spec.rb
436
455
  - spec/spec_helper.rb
456
+ - spec/validations/dns_ip_mapping_validation_spec.rb
437
457
  - templates/README.md
438
458
  - templates/v132/aws/large/deployment_file.yml.erb
439
459
  - templates/v132/aws/large/spec
@@ -446,6 +466,7 @@ files:
446
466
  - templates/v132/openstack/medium/deployment_file.yml.erb
447
467
  - templates/v132/openstack/medium/spec
448
468
  - templates/v132/openstack/spec
469
+ - templates/v132/spec
449
470
  - templates/v133/aws/large/deployment_file.yml.erb
450
471
  - templates/v133/aws/large/spec
451
472
  - templates/v133/aws/medium/deployment_file.yml.erb
@@ -457,6 +478,7 @@ files:
457
478
  - templates/v133/openstack/medium/deployment_file.yml.erb
458
479
  - templates/v133/openstack/medium/spec
459
480
  - templates/v133/openstack/spec
481
+ - templates/v133/spec
460
482
  homepage: ''
461
483
  licenses:
462
484
  - MIT
@@ -472,7 +494,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
472
494
  version: '0'
473
495
  segments:
474
496
  - 0
475
- hash: 4430002613479451948
497
+ hash: -1355577384199561262
476
498
  required_rubygems_version: !ruby/object:Gem::Requirement
477
499
  none: false
478
500
  requirements:
@@ -490,9 +512,11 @@ test_files:
490
512
  - spec/assets/v132/aws/medium.yml
491
513
  - spec/assets/v133/aws/large.yml
492
514
  - spec/assets/v133/aws/medium.yml
515
+ - spec/deployment_attributes_spec.rb
493
516
  - spec/deployment_file_spec.rb
494
517
  - spec/plugin_spec.rb
495
518
  - spec/release_version_cpi_size_spec.rb
496
519
  - spec/release_version_cpi_spec.rb
497
520
  - spec/release_version_spec.rb
498
521
  - spec/spec_helper.rb
522
+ - spec/validations/dns_ip_mapping_validation_spec.rb