bosh_cli_plugin_micro 1.5.0.pre.1113 → 1.5.0.pre.1114

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,23 +1,23 @@
1
1
  require 'pp'
2
- require 'deployer'
2
+ require 'bosh/deployer'
3
3
 
4
4
  module Bosh::Cli::Command
5
5
  class Micro < Base
6
6
  include Bosh::Deployer::Helpers
7
7
 
8
8
  MICRO_DIRECTOR_PORT = 25555
9
- DEFAULT_CONFIG_PATH = File.expand_path("~/.bosh_deployer_config")
10
- MICRO_BOSH_YAML = "micro_bosh.yml"
9
+ DEFAULT_CONFIG_PATH = File.expand_path('~/.bosh_deployer_config')
10
+ MICRO_BOSH_YAML = 'micro_bosh.yml'
11
11
 
12
12
  def initialize(runner)
13
13
  super(runner)
14
14
  options[:config] ||= DEFAULT_CONFIG_PATH #hijack Cli::Config
15
15
  end
16
16
 
17
- usage "micro"
18
- desc "show micro bosh sub-commands"
17
+ usage 'micro'
18
+ desc 'show micro bosh sub-commands'
19
19
  def micro_help
20
- say("bosh micro sub-commands:")
20
+ say('bosh micro sub-commands:')
21
21
  nl
22
22
  cmds = Bosh::Cli::Config.commands.values.find_all {|c|
23
23
  c.usage =~ /^micro/
@@ -25,8 +25,8 @@ module Bosh::Cli::Command
25
25
  Bosh::Cli::Command::Help.list_commands(cmds)
26
26
  end
27
27
 
28
- usage "micro deployment"
29
- desc "Choose micro deployment to work with, or display current deployment"
28
+ usage 'micro deployment'
29
+ desc 'Choose micro deployment to work with, or display current deployment'
30
30
  def micro_deployment(name=nil)
31
31
  if name
32
32
  set_current(name)
@@ -45,11 +45,11 @@ module Bosh::Cli::Command
45
45
  manifest = load_yaml_file(manifest_filename)
46
46
 
47
47
  unless manifest.is_a?(Hash)
48
- err "Invalid manifest format"
48
+ err 'Invalid manifest format'
49
49
  end
50
50
 
51
- if manifest["network"].blank?
52
- err "network is not defined in deployment manifest"
51
+ if manifest['network'].blank?
52
+ err 'network is not defined in deployment manifest'
53
53
  end
54
54
  ip = deployer(manifest_filename).discover_bosh_ip || name
55
55
 
@@ -61,7 +61,7 @@ module Bosh::Cli::Command
61
61
 
62
62
  if old_director_ip != ip
63
63
  set_target(ip)
64
- say "#{"WARNING!".make_red} Your target has been changed to `#{target.make_red}'!"
64
+ say "#{'WARNING!'.make_red} Your target has been changed to `#{target.make_red}'!"
65
65
  end
66
66
 
67
67
  say "Deployment set to '#{manifest_filename.make_green}'"
@@ -70,51 +70,51 @@ module Bosh::Cli::Command
70
70
  end
71
71
 
72
72
  def show_current
73
- say(deployment ? "Current deployment is '#{deployment.make_green}'" : "Deployment not set")
73
+ say(deployment ? "Current deployment is '#{deployment.make_green}'" : 'Deployment not set')
74
74
  end
75
75
 
76
- usage "micro status"
77
- desc "Display micro BOSH deployment status"
76
+ usage 'micro status'
77
+ desc 'Display micro BOSH deployment status'
78
78
  def status
79
79
  stemcell_cid = deployer_state(:stemcell_cid)
80
80
  stemcell_name = deployer_state(:stemcell_name)
81
81
  vm_cid = deployer_state(:vm_cid)
82
82
  disk_cid = deployer_state(:disk_cid)
83
- deployment = config.deployment ? config.deployment.make_green : "not set".make_red
83
+ deployment = config.deployment ? config.deployment.make_green : 'not set'.make_red
84
84
 
85
- say("Stemcell CID".ljust(15) + stemcell_cid)
86
- say("Stemcell name".ljust(15) + stemcell_name)
87
- say("VM CID".ljust(15) + vm_cid)
88
- say("Disk CID".ljust(15) + disk_cid)
89
- say("Micro BOSH CID".ljust(15) + Bosh::Deployer::Config.uuid)
90
- say("Deployment".ljust(15) + deployment)
85
+ say('Stemcell CID'.ljust(15) + stemcell_cid)
86
+ say('Stemcell name'.ljust(15) + stemcell_name)
87
+ say('VM CID'.ljust(15) + vm_cid)
88
+ say('Disk CID'.ljust(15) + disk_cid)
89
+ say('Micro BOSH CID'.ljust(15) + Bosh::Deployer::Config.uuid)
90
+ say('Deployment'.ljust(15) + deployment)
91
91
 
92
92
  update_target
93
93
 
94
- target_name = target ? target.make_green : "not set".make_red
95
- say("Target".ljust(15) + target_name)
94
+ target_name = target ? target.make_green : 'not set'.make_red
95
+ say('Target'.ljust(15) + target_name)
96
96
  end
97
97
 
98
- usage "micro deploy"
99
- desc "Deploy a micro BOSH instance to the currently selected deployment"
100
- option "--update", "update existing instance"
101
- option "--update-if-exists", "create new or update existing instance"
98
+ usage 'micro deploy'
99
+ desc 'Deploy a micro BOSH instance to the currently selected deployment'
100
+ option '--update', 'update existing instance'
101
+ option '--update-if-exists', 'create new or update existing instance'
102
102
  def perform(stemcell=nil)
103
103
  update = !!options[:update]
104
104
 
105
- err "No deployment set" unless deployment
105
+ err 'No deployment set' unless deployment
106
106
 
107
107
  manifest = load_yaml_file(deployment)
108
108
 
109
109
  if stemcell.nil?
110
110
  unless manifest.is_a?(Hash)
111
- err("Invalid manifest format")
111
+ err('Invalid manifest format')
112
112
  end
113
113
 
114
- stemcell = dig_hash(manifest, "resources", "cloud_properties", "image_id")
114
+ stemcell = dig_hash(manifest, 'resources', 'cloud_properties', 'image_id')
115
115
 
116
116
  if stemcell.nil?
117
- err "No stemcell provided"
117
+ err 'No stemcell provided'
118
118
  end
119
119
  end
120
120
 
@@ -126,26 +126,26 @@ module Bosh::Cli::Command
126
126
 
127
127
  if deployer.exists?
128
128
  if !options[:update_if_exists] && !update
129
- err "Instance exists. Did you mean to --update?"
129
+ err 'Instance exists. Did you mean to --update?'
130
130
  end
131
- confirmation = "Updating"
131
+ confirmation = 'Updating'
132
132
  method = :update_deployment
133
133
  else
134
134
  prefered_dir = File.dirname(File.dirname(deployment))
135
135
 
136
136
  unless prefered_dir == Dir.pwd
137
137
  confirm_deployment("\n#{'No `bosh-deployments.yml` file found in current directory.'.make_red}\n\n" +
138
- "Conventionally, `bosh-deployments.yml` should be saved in " +
138
+ 'Conventionally, `bosh-deployments.yml` should be saved in ' +
139
139
  "#{prefered_dir.make_green}.\n" +
140
140
  "Is #{Dir.pwd.make_yellow} a directory where you can save state?")
141
141
  end
142
142
 
143
- err "No existing instance to update" if update
144
- confirmation = "Deploying new micro BOSH instance"
143
+ err 'No existing instance to update' if update
144
+ confirmation = 'Deploying new micro BOSH instance'
145
145
  method = :create_deployment
146
146
 
147
147
  # make sure the user knows a persistent disk is required
148
- unless dig_hash(manifest, "resources", "persistent_disk")
148
+ unless dig_hash(manifest, 'resources', 'persistent_disk')
149
149
  quit("No persistent disk configured in #{MICRO_BOSH_YAML}".make_red)
150
150
  end
151
151
  end
@@ -160,7 +160,7 @@ module Bosh::Cli::Command
160
160
  say("\n")
161
161
 
162
162
  unless stemcell_file.valid?
163
- err("Stemcell is invalid, please fix, verify and upload again")
163
+ err('Stemcell is invalid, please fix, verify and upload again')
164
164
  end
165
165
  end
166
166
 
@@ -172,7 +172,7 @@ module Bosh::Cli::Command
172
172
 
173
173
  deployer.send(method, stemcell)
174
174
 
175
- renderer.finish("done")
175
+ renderer.finish('done')
176
176
 
177
177
  duration = renderer.duration || (Time.now - start_time)
178
178
 
@@ -181,11 +181,11 @@ module Bosh::Cli::Command
181
181
  say("Deployed #{desc}, took #{format_time(duration).make_green} to complete")
182
182
  end
183
183
 
184
- usage "micro delete"
185
- desc "Delete micro BOSH instance (including persistent disk)"
184
+ usage 'micro delete'
185
+ desc 'Delete micro BOSH instance (including persistent disk)'
186
186
  def delete
187
187
  unless deployer.exists?
188
- err "No existing instance to delete"
188
+ err 'No existing instance to delete'
189
189
  end
190
190
 
191
191
  name = deployer.state.name
@@ -194,7 +194,7 @@ module Bosh::Cli::Command
194
194
  "THIS IS A VERY DESTRUCTIVE OPERATION AND IT CANNOT BE UNDONE!\n".make_red
195
195
 
196
196
  unless confirmed?
197
- say "Canceled deleting deployment".make_green
197
+ say 'Canceled deleting deployment'.make_green
198
198
  return
199
199
  end
200
200
 
@@ -206,29 +206,29 @@ module Bosh::Cli::Command
206
206
 
207
207
  deployer.delete_deployment
208
208
 
209
- renderer.finish("done")
209
+ renderer.finish('done')
210
210
 
211
211
  duration = renderer.duration || (Time.now - start_time)
212
212
 
213
213
  say("Deleted deployment '#{name}', took #{format_time(duration).make_green} to complete")
214
214
  end
215
215
 
216
- usage "micro deployments"
217
- desc "Show the list of deployments"
216
+ usage 'micro deployments'
217
+ desc 'Show the list of deployments'
218
218
  def list
219
219
  file = File.join(work_dir, DEPLOYMENTS_FILE)
220
220
  if File.exists?(file)
221
- deployments = load_yaml_file(file)["instances"]
221
+ deployments = load_yaml_file(file)['instances']
222
222
  else
223
223
  deployments = []
224
224
  end
225
225
 
226
- err("No deployments") if deployments.size == 0
226
+ err('No deployments') if deployments.size == 0
227
227
 
228
- na = "n/a"
228
+ na = 'n/a'
229
229
 
230
230
  deployments_table = table do |t|
231
- t.headings = [ "Name", "VM name", "Stemcell name" ]
231
+ t.headings = [ 'Name', 'VM name', 'Stemcell name']
232
232
  deployments.each do |r|
233
233
  t << [ r[:name], r[:vm_cid] || na, r[:stemcell_cid] || na ]
234
234
  end
@@ -237,10 +237,10 @@ module Bosh::Cli::Command
237
237
  say("\n")
238
238
  say(deployments_table)
239
239
  say("\n")
240
- say("Deployments total: %d" % deployments.size)
240
+ say('Deployments total: %d' % deployments.size)
241
241
  end
242
242
 
243
- usage "micro agent <args>"
243
+ usage 'micro agent <args>'
244
244
  desc <<-AGENT_HELP
245
245
  Send agent messages
246
246
 
@@ -285,8 +285,8 @@ AGENT_HELP
285
285
  say(deployer.agent.send(message.to_sym, *args).pretty_inspect)
286
286
  end
287
287
 
288
- usage "micro apply"
289
- desc "Apply spec"
288
+ usage 'micro apply'
289
+ desc 'Apply spec'
290
290
  def apply(spec)
291
291
  deployer.apply(Bosh::Deployer::Specification.new(load_yaml_file(spec)))
292
292
  end
@@ -305,12 +305,12 @@ AGENT_HELP
305
305
 
306
306
  manifest = load_yaml_file(manifest_filename)
307
307
 
308
- manifest["dir"] ||= work_dir
309
- manifest["logging"] ||= {}
310
- unless manifest["logging"]["file"]
308
+ manifest['dir'] ||= work_dir
309
+ manifest['logging'] ||= {}
310
+ unless manifest['logging']['file']
311
311
  log_file = File.join(File.dirname(manifest_filename),
312
- "bosh_micro_deploy.log")
313
- manifest["logging"]["file"] = log_file
312
+ 'bosh_micro_deploy.log')
313
+ manifest['logging']['file'] = log_file
314
314
  end
315
315
 
316
316
  @deployer = Bosh::Deployer::InstanceManager.create(manifest)
@@ -360,15 +360,15 @@ AGENT_HELP
360
360
  err("Cannot talk to director at '#{target}', please set correct target")
361
361
  end
362
362
  else
363
- status = { "name" => "Unknown Director", "version" => "n/a" }
363
+ status = { 'name' => 'Unknown Director', 'version' => 'n/a' }
364
364
  end
365
365
  else
366
366
  status = {}
367
367
  end
368
368
 
369
- config.target_name = status["name"]
370
- config.target_version = status["version"]
371
- config.target_uuid = status["uuid"]
369
+ config.target_name = status['name']
370
+ config.target_version = status['version']
371
+ config.target_uuid = status['uuid']
372
372
 
373
373
  config.save
374
374
  end
@@ -383,7 +383,7 @@ AGENT_HELP
383
383
  if value = deployer.state.send(column)
384
384
  value.make_green
385
385
  else
386
- "n/a".make_red
386
+ 'n/a'.make_red
387
387
  end
388
388
  end
389
389
 
@@ -422,14 +422,14 @@ AGENT_HELP
422
422
 
423
423
  def update(state, task)
424
424
  event = {
425
- "time" => Time.now,
426
- "stage" => @stage,
427
- "task" => task,
428
- "tags" => [],
429
- "index" => @index+1,
430
- "total" => @total,
431
- "state" => state.to_s,
432
- "progress" => state == :finished ? 100 : 0
425
+ 'time' => Time.now,
426
+ 'stage' => @stage,
427
+ 'task' => task,
428
+ 'tags' => [],
429
+ 'index' => @index+1,
430
+ 'total' => @total,
431
+ 'state' => state.to_s,
432
+ 'progress' => state == :finished ? 100 : 0
433
433
  }
434
434
 
435
435
  add_event(event)
@@ -0,0 +1,5 @@
1
+ require 'bosh/deployer/configuration'
2
+
3
+ module Bosh::Deployer
4
+ Config = Configuration.new
5
+ end
@@ -0,0 +1,149 @@
1
+ module Bosh::Deployer
2
+ class Configuration
3
+ include Helpers
4
+
5
+ attr_accessor :logger, :db, :uuid, :resources, :cloud_options,
6
+ :spec_properties, :agent_properties, :bosh_ip, :env, :name, :net_conf
7
+
8
+ def configure(config)
9
+ plugin = cloud_plugin(config)
10
+
11
+ config = deep_merge(load_defaults(plugin), config)
12
+
13
+ @base_dir = config['dir']
14
+ FileUtils.mkdir_p(@base_dir)
15
+
16
+ @name = config['name']
17
+ @cloud_options = config['cloud']
18
+ @net_conf = config['network']
19
+ @bosh_ip = @net_conf['ip']
20
+ @resources = config['resources']
21
+ @env = config['env']
22
+
23
+ @logger = Logger.new(config['logging']['file'] || STDOUT)
24
+ @logger.level = Logger.const_get(config['logging']['level'].upcase)
25
+ @logger.formatter = ThreadFormatter.new
26
+
27
+ apply_spec = config['apply_spec']
28
+ @spec_properties = apply_spec['properties']
29
+ @agent_properties = apply_spec['agent']
30
+
31
+ @db = Sequel.sqlite
32
+
33
+ migrate_cpi
34
+
35
+ @db.create_table :instances do
36
+ primary_key :id
37
+ column :name, :text, :unique => true, :null => false
38
+ column :uuid, :text
39
+ column :stemcell_cid, :text
40
+ column :stemcell_name, :text
41
+ column :vm_cid, :text
42
+ column :disk_cid, :text
43
+ end
44
+
45
+ Sequel::Model.plugin :validation_helpers
46
+
47
+ Bosh::Clouds::Config.configure(self)
48
+
49
+ require 'bosh/deployer/models/instance'
50
+
51
+ @cloud_options['properties']['agent']['mbus'] ||=
52
+ 'https://vcap:b00tstrap@0.0.0.0:6868'
53
+
54
+ @disk_model = nil
55
+ @cloud = nil
56
+ @networks = nil
57
+ end
58
+
59
+ def cloud
60
+ if @cloud.nil?
61
+ @cloud = Bosh::Clouds::Provider.create(@cloud_options['plugin'],
62
+ @cloud_options['properties'])
63
+ end
64
+ @cloud
65
+ end
66
+
67
+ def agent
68
+ uri = URI.parse(agent_url)
69
+ user, password = uri.userinfo.split(':', 2)
70
+ uri.userinfo = nil
71
+ uri.host = bosh_ip
72
+ Bosh::Agent::HTTPClient.new(uri.to_s,
73
+ { 'user' => user,
74
+ 'password' => password,
75
+ 'reply_to' => uuid })
76
+ end
77
+
78
+ def agent_url
79
+ @cloud_options['properties']['agent']['mbus']
80
+ end
81
+
82
+ def networks
83
+ return @networks if @networks
84
+
85
+ @networks = {
86
+ 'bosh' => {
87
+ 'cloud_properties' => @net_conf['cloud_properties'],
88
+ 'netmask' => @net_conf['netmask'],
89
+ 'gateway' => @net_conf['gateway'],
90
+ 'ip' => @net_conf['ip'],
91
+ 'dns' => @net_conf['dns'],
92
+ 'type' => @net_conf['type'],
93
+ 'default' => ['dns', 'gateway']
94
+ }
95
+ }
96
+ if @net_conf['vip']
97
+ @networks['vip'] = {
98
+ 'ip' => @net_conf['vip'],
99
+ 'type' => 'vip',
100
+ 'cloud_properties' => {}
101
+ }
102
+ end
103
+
104
+ @networks
105
+ end
106
+
107
+ def task_checkpoint
108
+ # Bosh::Clouds::Config (bosh_cli >= 0.5.1) delegates task_checkpoint
109
+ # method to periodically check if director task is cancelled,
110
+ # so we need to define a void method in Bosh::Deployer::Config to avoid
111
+ # NoMethodError exceptions.
112
+ end
113
+
114
+ private
115
+
116
+ def migrate_cpi
117
+ cpi = @cloud_options['plugin']
118
+ require_path = File.join('cloud', cpi)
119
+ cpi_path = $LOAD_PATH.find { |p| File.exist?(
120
+ File.join(p, require_path)) }
121
+ migrations = File.expand_path('../db/migrations', cpi_path)
122
+
123
+ if File.directory?(migrations)
124
+ Sequel.extension :migration
125
+ Sequel::TimestampMigrator.new(
126
+ @db, migrations, :table => "#{cpi}_cpi_schema").run
127
+ end
128
+ end
129
+
130
+ def deep_merge(src, dst)
131
+ src.merge(dst) do |key, old, new|
132
+ if new.respond_to?(:blank) && new.blank?
133
+ old
134
+ elsif old.kind_of?(Hash) and new.kind_of?(Hash)
135
+ deep_merge(old, new)
136
+ elsif old.kind_of?(Array) and new.kind_of?(Array)
137
+ old.concat(new).uniq
138
+ else
139
+ new
140
+ end
141
+ end
142
+ end
143
+
144
+ def load_defaults(provider)
145
+ file = File.join(File.dirname(File.expand_path(__FILE__)), "../../../config/#{provider}_defaults.yml")
146
+ Psych.load_file(file)
147
+ end
148
+ end
149
+ end
@@ -0,0 +1,3 @@
1
+ module Bosh::Deployer
2
+ class DirectorGatewayError < RuntimeError; end
3
+ end
@@ -6,17 +6,17 @@ module Bosh::Deployer
6
6
 
7
7
  module Helpers
8
8
 
9
- DEPLOYMENTS_FILE = "bosh-deployments.yml"
9
+ DEPLOYMENTS_FILE = 'bosh-deployments.yml'
10
10
 
11
11
  def is_tgz?(path)
12
- File.extname(path) == ".tgz"
12
+ File.extname(path) == '.tgz'
13
13
  end
14
14
 
15
15
  def cloud_plugin(config)
16
- err "No cloud properties defined" if config["cloud"].nil?
17
- err "No cloud plugin defined" if config["cloud"]["plugin"].nil?
16
+ err 'No cloud properties defined' if config['cloud'].nil?
17
+ err 'No cloud plugin defined' if config['cloud']['plugin'].nil?
18
18
 
19
- config["cloud"]["plugin"]
19
+ config['cloud']['plugin']
20
20
  end
21
21
 
22
22
  def dig_hash(hash, *path)
@@ -80,7 +80,7 @@ module Bosh::Deployer
80
80
  end
81
81
  end
82
82
 
83
- lo = "127.0.0.1"
83
+ lo = '127.0.0.1'
84
84
  @sessions[port].forward.remote(port, lo, port)
85
85
 
86
86
  logger.info("SSH forwarding for port #{port} started: OK")
@@ -10,32 +10,32 @@ module Bosh::Deployer
10
10
 
11
11
  # pick from micro_bosh.yml the aws settings in `apply_spec` section (apply_spec.properties.aws),
12
12
  # and if it doesn't exist, use the bosh deployer aws properties (cloud.properties.aws)
13
- properties["aws"] = Config.spec_properties["aws"] || Config.cloud_options["properties"]["aws"].dup
13
+ properties['aws'] = Config.spec_properties['aws'] || Config.cloud_options['properties']['aws'].dup
14
14
 
15
- properties["aws"]["registry"] = Config.cloud_options["properties"]["registry"]
16
- properties["aws"]["stemcell"] = Config.cloud_options["properties"]["stemcell"]
15
+ properties['aws']['registry'] = Config.cloud_options['properties']['registry']
16
+ properties['aws']['stemcell'] = Config.cloud_options['properties']['stemcell']
17
17
 
18
- spec.delete("networks")
18
+ spec.delete('networks')
19
19
  end
20
20
 
21
21
  def configure
22
- properties = Config.cloud_options["properties"]
23
- @ssh_user = properties["aws"]["ssh_user"]
24
- @ssh_port = properties["aws"]["ssh_port"] || 22
25
- @ssh_wait = properties["aws"]["ssh_wait"] || 60
22
+ properties = Config.cloud_options['properties']
23
+ @ssh_user = properties['aws']['ssh_user']
24
+ @ssh_port = properties['aws']['ssh_port'] || 22
25
+ @ssh_wait = properties['aws']['ssh_wait'] || 60
26
26
 
27
- key = properties["aws"]["ec2_private_key"]
28
- err "Missing properties.aws.ec2_private_key" unless key
27
+ key = properties['aws']['ec2_private_key']
28
+ err 'Missing properties.aws.ec2_private_key' unless key
29
29
  @ssh_key = File.expand_path(key)
30
30
  unless File.exists?(@ssh_key)
31
31
  err "properties.aws.ec2_private_key '#{key}' does not exist"
32
32
  end
33
33
 
34
- uri = URI.parse(properties["registry"]["endpoint"])
35
- user, password = uri.userinfo.split(":", 2)
34
+ uri = URI.parse(properties['registry']['endpoint'])
35
+ user, password = uri.userinfo.split(':', 2)
36
36
  @registry_port = uri.port
37
37
 
38
- @registry_db = Tempfile.new("bosh_registry_db")
38
+ @registry_db = Tempfile.new('bosh_registry_db')
39
39
 
40
40
  @registry_connection_settings = {
41
41
  'adapter' => 'sqlite',
@@ -43,20 +43,20 @@ module Bosh::Deployer
43
43
  }
44
44
 
45
45
  registry_config = {
46
- "logfile" => "./bosh-registry.log",
47
- "http" => {
48
- "port" => uri.port,
49
- "user" => user,
50
- "password" => password
46
+ 'logfile' => './bosh-registry.log',
47
+ 'http' => {
48
+ 'port' => uri.port,
49
+ 'user' => user,
50
+ 'password' => password
51
51
  },
52
- "db" => @registry_connection_settings,
53
- "cloud" => {
54
- "plugin" => "aws",
55
- "aws" => properties["aws"]
52
+ 'db' => @registry_connection_settings,
53
+ 'cloud' => {
54
+ 'plugin' => 'aws',
55
+ 'aws' => properties['aws']
56
56
  }
57
57
  }
58
58
 
59
- @registry_config = Tempfile.new("bosh_registry_yml")
59
+ @registry_config = Tempfile.new('bosh_registry_yml')
60
60
  @registry_config.write(Psych.dump(registry_config))
61
61
  @registry_config.close
62
62
  end
@@ -66,12 +66,12 @@ module Bosh::Deployer
66
66
 
67
67
  Sequel.connect(@registry_connection_settings) do |db|
68
68
  migrate(db)
69
- instances = @deployments["registry_instances"]
69
+ instances = @deployments['registry_instances']
70
70
  db[:registry_instances].insert_multiple(instances) if instances
71
71
  end
72
72
 
73
73
  unless has_bosh_registry?
74
- err "bosh-registry command not found - " +
74
+ err 'bosh-registry command not found - ' +
75
75
  "run 'gem install bosh-registry'"
76
76
  end
77
77
 
@@ -106,14 +106,14 @@ module Bosh::Deployer
106
106
 
107
107
  def stop
108
108
  if @registry_pid && process_exists?(@registry_pid)
109
- Process.kill("INT", @registry_pid)
109
+ Process.kill('INT', @registry_pid)
110
110
  Process.waitpid(@registry_pid)
111
111
  end
112
112
 
113
113
  return unless @registry_connection_settings
114
114
 
115
115
  Sequel.connect(@registry_connection_settings) do |db|
116
- @deployments["registry_instances"] = db[:registry_instances].map {|row| row}
116
+ @deployments['registry_instances'] = db[:registry_instances].map {|row| row}
117
117
  end
118
118
 
119
119
  save_state
@@ -162,8 +162,8 @@ module Bosh::Deployer
162
162
  private
163
163
 
164
164
  def has_bosh_registry?(path=ENV['PATH'])
165
- path.split(":").each do |dir|
166
- return true if File.exist?(File.join(dir, "bosh-registry"))
165
+ path.split(':').each do |dir|
166
+ return true if File.exist?(File.join(dir, 'bosh-registry'))
167
167
  end
168
168
  false
169
169
  end