bosh_deployer 1.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -271,8 +271,6 @@ module Bosh::Cli::Command
271
271
  end
272
272
 
273
273
  @deployer = Bosh::Deployer::InstanceManager.create(manifest)
274
-
275
- $stderr.reopen("/dev/null") #silence ssl warnings
276
274
  end
277
275
 
278
276
  @deployer
data/lib/deployer.rb CHANGED
@@ -17,7 +17,6 @@ require "common/common"
17
17
  require "common/thread_formatter"
18
18
 
19
19
  require "deployer/version"
20
- require "deployer/errors"
21
20
  require "deployer/helpers"
22
21
  require "deployer/config"
23
22
  require "deployer/instance_manager"
@@ -11,12 +11,8 @@ module Bosh::Deployer
11
11
  end
12
12
 
13
13
  def cloud_plugin(config)
14
- if config["cloud"].nil?
15
- raise ConfigError, "No cloud properties defined"
16
- end
17
- if config["cloud"]["plugin"].nil?
18
- raise ConfigError, "No cloud plugin defined"
19
- end
14
+ err "No cloud properties defined" if config["cloud"].nil?
15
+ err "No cloud plugin defined" if config["cloud"]["plugin"].nil?
20
16
 
21
17
  config["cloud"]["plugin"]
22
18
  end
@@ -37,7 +37,7 @@ module Bosh::Deployer
37
37
  begin
38
38
  require "deployer/instance_manager/#{plugin}"
39
39
  rescue LoadError
40
- raise Error, "Could not find Provider Plugin: #{plugin}"
40
+ err "Could not find Provider Plugin: #{plugin}"
41
41
  end
42
42
  Bosh::Deployer::InstanceManager.const_get(plugin.capitalize).new(config)
43
43
  end
@@ -118,11 +118,9 @@ module Bosh::Deployer
118
118
  end
119
119
 
120
120
  def create(stemcell_tgz)
121
- if state.vm_cid
122
- raise ConfigError, "VM #{state.vm_cid} already exists"
123
- end
121
+ err "VM #{state.vm_cid} already exists" if state.vm_cid
124
122
  if state.stemcell_cid && state.stemcell_cid != state.stemcell_name
125
- raise ConfigError, "stemcell #{state.stemcell_cid} already exists"
123
+ err "stemcell #{state.stemcell_cid} already exists"
126
124
  end
127
125
 
128
126
  renderer.enter_stage("Deploy Micro BOSH", 11)
@@ -289,7 +287,7 @@ module Bosh::Deployer
289
287
 
290
288
  def detach_disk(disk_cid)
291
289
  unless disk_cid
292
- raise "Error while detaching disk: unknown disk attached to instance"
290
+ err "Error while detaching disk: unknown disk attached to instance"
293
291
  end
294
292
 
295
293
  unmount_disk(disk_cid)
@@ -308,7 +306,9 @@ module Bosh::Deployer
308
306
  return if state.disk_cid.nil?
309
307
  agent_disk_cid = disk_info.first
310
308
  if agent_disk_cid != state.disk_cid
311
- raise "instance #{state.vm_cid} has invalid disk: Agent reports #{agent_disk_cid} while deployer's record shows #{state.disk_cid}"
309
+ err "instance #{state.vm_cid} has invalid disk: " +
310
+ "Agent reports #{agent_disk_cid} while " +
311
+ "deployer's record shows #{state.disk_cid}"
312
312
  end
313
313
  end
314
314
 
@@ -465,9 +465,7 @@ module Bosh::Deployer
465
465
  end
466
466
 
467
467
  def delete_stemcell
468
- unless state.stemcell_cid
469
- raise ConfigError, "Cannot find existing stemcell"
470
- end
468
+ err "Cannot find existing stemcell" unless state.stemcell_cid
471
469
 
472
470
  if state.stemcell_cid == state.stemcell_name
473
471
  step "Preserving stemcell" do
@@ -484,9 +482,8 @@ module Bosh::Deployer
484
482
  end
485
483
 
486
484
  def delete_vm
487
- unless state.vm_cid
488
- raise ConfigError, "Cannot find existing VM"
489
- end
485
+ err "Cannot find existing VM" unless state.vm_cid
486
+
490
487
  step "Delete VM" do
491
488
  cloud.delete_vm(state.vm_cid)
492
489
  end
@@ -506,13 +503,13 @@ module Bosh::Deployer
506
503
 
507
504
  def load_apply_spec(dir)
508
505
  load_spec("#{dir}/apply_spec.yml") do
509
- raise "this isn't a micro bosh stemcell - apply_spec.yml missing"
506
+ err "this isn't a micro bosh stemcell - apply_spec.yml missing"
510
507
  end
511
508
  end
512
509
 
513
510
  def load_stemcell_manifest(dir)
514
511
  load_spec("#{dir}/stemcell.MF") do
515
- raise "this isn't a stemcell - stemcell.MF missing"
512
+ err "this isn't a stemcell - stemcell.MF missing"
516
513
  end
517
514
  end
518
515
 
@@ -557,7 +554,7 @@ module Bosh::Deployer
557
554
  output = `#{command} 2>&1`
558
555
  if $?.exitstatus != 0
559
556
  $stderr.puts output
560
- raise "'#{command}' failed with exit status=#{$?.exitstatus} [#{output}]"
557
+ err "'#{command}' failed with exit status=#{$?.exitstatus} [#{output}]"
561
558
  end
562
559
  end
563
560
 
@@ -30,12 +30,10 @@ module Bosh::Deployer
30
30
  @ssh_wait = properties["aws"]["ssh_wait"] || 60
31
31
 
32
32
  key = properties["aws"]["ec2_private_key"]
33
- unless key
34
- raise ConfigError, "Missing properties.aws.ec2_private_key"
35
- end
33
+ err "Missing properties.aws.ec2_private_key" unless key
36
34
  @ssh_key = File.expand_path(key)
37
35
  unless File.exists?(@ssh_key)
38
- raise ConfigError, "properties.aws.ec2_private_key '#{key}' does not exist"
36
+ err "properties.aws.ec2_private_key '#{key}' does not exist"
39
37
  end
40
38
 
41
39
  uri = URI.parse(properties["registry"]["endpoint"])
@@ -73,7 +71,7 @@ module Bosh::Deployer
73
71
  end
74
72
 
75
73
  unless has_aws_registry?
76
- raise "aws_registry command not found - " +
74
+ err "aws_registry command not found - " +
77
75
  "run 'gem install bosh_aws_registry'"
78
76
  end
79
77
 
@@ -84,7 +82,7 @@ module Bosh::Deployer
84
82
  5.times do
85
83
  sleep 0.5
86
84
  if Process.waitpid(@registry_pid, Process::WNOHANG)
87
- raise Error, "`#{cmd}` failed, exit status=#{$?.exitstatus}"
85
+ err "`#{cmd}` failed, exit status=#{$?.exitstatus}"
88
86
  end
89
87
  end
90
88
 
@@ -97,7 +95,7 @@ module Bosh::Deployer
97
95
  if timeout_time - Time.now.to_f > 0
98
96
  retry
99
97
  else
100
- raise "Cannot access aws_registry: #{e.message}"
98
+ err "Cannot access aws_registry: #{e.message}"
101
99
  end
102
100
  end
103
101
  logger.info("aws_registry is ready on port #{@registry_port}")
@@ -30,12 +30,10 @@ module Bosh::Deployer
30
30
  @ssh_wait = properties["openstack"]["ssh_wait"] || 60
31
31
 
32
32
  key = properties["openstack"]["private_key"]
33
- unless key
34
- raise ConfigError, "Missing properties.openstack.private_key"
35
- end
33
+ err "Missing properties.openstack.private_key" unless key
36
34
  @ssh_key = File.expand_path(key)
37
35
  unless File.exists?(@ssh_key)
38
- raise ConfigError, "properties.openstack.private_key '#{key}' does not exist"
36
+ err "properties.openstack.private_key '#{key}' does not exist"
39
37
  end
40
38
 
41
39
  uri = URI.parse(properties["registry"]["endpoint"])
@@ -73,7 +71,7 @@ module Bosh::Deployer
73
71
  end
74
72
 
75
73
  unless has_openstack_registry?
76
- raise "openstack_registry command not found - " +
74
+ err "openstack_registry command not found - " +
77
75
  "run 'gem install bosh_openstack_registry'"
78
76
  end
79
77
 
@@ -84,7 +82,7 @@ module Bosh::Deployer
84
82
  5.times do
85
83
  sleep 0.5
86
84
  if Process.waitpid(@registry_pid, Process::WNOHANG)
87
- raise Error, "`#{cmd}` failed, exit status=#{$?.exitstatus}"
85
+ err "`#{cmd}` failed, exit status=#{$?.exitstatus}"
88
86
  end
89
87
  end
90
88
 
@@ -97,7 +95,7 @@ module Bosh::Deployer
97
95
  if timeout_time - Time.now.to_f > 0
98
96
  retry
99
97
  else
100
- raise "Cannot access openstack_registry: #{e.message}"
98
+ err "Cannot access openstack_registry: #{e.message}"
101
99
  end
102
100
  end
103
101
  logger.info("openstack_registry is ready on port #{@registry_port}")
@@ -138,7 +136,7 @@ module Bosh::Deployer
138
136
  |addr| addr.instance_id == server.id
139
137
  }
140
138
  ip = floating_ip.nil? ? service_ip : floating_ip.ip
141
- raise "Unable to discover bosh ip" if ip.nil?
139
+ err "Unable to discover bosh ip" if ip.nil?
142
140
 
143
141
  if ip != Config.bosh_ip
144
142
  Config.bosh_ip = ip
@@ -163,7 +161,7 @@ module Bosh::Deployer
163
161
  address = ip_addresses.select { |ip| ip["version"] == 4 }.first
164
162
  ip = address ? address["addr"] : nil
165
163
  end
166
- raise "Unable to discover service ip" if ip.nil?
164
+ err "Unable to discover service ip" if ip.nil?
167
165
  ip
168
166
  end
169
167
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Bosh
4
4
  module Deployer
5
- VERSION = "1.0"
5
+ VERSION = "1.0.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh_deployer
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.0'
4
+ version: 1.0.1
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: 2012-10-23 00:00:00.000000000 Z
12
+ date: 2012-10-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bosh_cli
@@ -167,7 +167,6 @@ files:
167
167
  - lib/bosh/cli/commands/micro.rb
168
168
  - lib/deployer.rb
169
169
  - lib/deployer/config.rb
170
- - lib/deployer/errors.rb
171
170
  - lib/deployer/helpers.rb
172
171
  - lib/deployer/instance_manager.rb
173
172
  - lib/deployer/instance_manager/aws.rb
@@ -193,7 +192,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
193
192
  version: '0'
194
193
  segments:
195
194
  - 0
196
- hash: -4201748784491997897
195
+ hash: -1034060200626431
197
196
  required_rubygems_version: !ruby/object:Gem::Requirement
198
197
  none: false
199
198
  requirements:
@@ -202,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
201
  version: '0'
203
202
  segments:
204
203
  - 0
205
- hash: -4201748784491997897
204
+ hash: -1034060200626431
206
205
  requirements: []
207
206
  rubyforge_project:
208
207
  rubygems_version: 1.8.24
@@ -1,11 +0,0 @@
1
- # Copyright (c) 2009-2012 VMware, Inc.
2
-
3
- module Bosh
4
- module Deployer
5
-
6
- class Error < StandardError; end
7
-
8
- class ConfigError < StandardError; end
9
-
10
- end
11
- end