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.
- data/lib/bosh/cli/commands/micro.rb +73 -73
- data/lib/bosh/deployer/config.rb +5 -0
- data/lib/bosh/deployer/configuration.rb +149 -0
- data/lib/bosh/deployer/director_gateway_error.rb +3 -0
- data/lib/{deployer → bosh/deployer}/helpers.rb +6 -6
- data/lib/{deployer → bosh/deployer}/instance_manager/aws.rb +29 -29
- data/lib/{deployer → bosh/deployer}/instance_manager/openstack.rb +31 -31
- data/lib/{deployer → bosh/deployer}/instance_manager/vcloud.rb +4 -4
- data/lib/bosh/deployer/instance_manager/vsphere.rb +43 -0
- data/lib/{deployer → bosh/deployer}/instance_manager.rb +63 -89
- data/lib/bosh/deployer/logger_renderer.rb +20 -0
- data/lib/{deployer → bosh/deployer}/models/instance.rb +0 -0
- data/lib/{deployer → bosh/deployer}/specification.rb +12 -12
- data/lib/{deployer → bosh/deployer}/version.rb +1 -1
- data/lib/bosh/deployer.rb +23 -0
- metadata +30 -27
- data/lib/deployer/config.rb +0 -157
- data/lib/deployer/instance_manager/vsphere.rb +0 -46
- data/lib/deployer.rb +0 -23
@@ -0,0 +1,23 @@
|
|
1
|
+
# Copyright (c) 2009-2012 VMware, Inc.
|
2
|
+
|
3
|
+
module Bosh; module Deployer; end; end
|
4
|
+
|
5
|
+
require 'agent_client'
|
6
|
+
require 'fileutils'
|
7
|
+
require 'forwardable'
|
8
|
+
require 'sequel'
|
9
|
+
require 'sequel/adapters/sqlite'
|
10
|
+
require 'cloud'
|
11
|
+
require 'logger'
|
12
|
+
require 'tmpdir'
|
13
|
+
require 'securerandom'
|
14
|
+
require 'yaml'
|
15
|
+
require 'yajl'
|
16
|
+
require 'common/common'
|
17
|
+
require 'common/thread_formatter'
|
18
|
+
|
19
|
+
require 'bosh/deployer/version'
|
20
|
+
require 'bosh/deployer/helpers'
|
21
|
+
require 'bosh/deployer/config'
|
22
|
+
require 'bosh/deployer/specification'
|
23
|
+
require 'bosh/deployer/instance_manager'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bosh_cli_plugin_micro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.0.pre.
|
4
|
+
version: 1.5.0.pre.1114
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - ~>
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: 1.5.0.pre.
|
37
|
+
version: 1.5.0.pre.1114
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 1.5.0.pre.
|
45
|
+
version: 1.5.0.pre.1114
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: bosh-registry
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ~>
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 1.5.0.pre.
|
53
|
+
version: 1.5.0.pre.1114
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -58,7 +58,7 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.5.0.pre.
|
61
|
+
version: 1.5.0.pre.1114
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: agent_client
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
requirements:
|
67
67
|
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 1.5.0.pre.
|
69
|
+
version: 1.5.0.pre.1114
|
70
70
|
type: :runtime
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -74,7 +74,7 @@ dependencies:
|
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: 1.5.0.pre.
|
77
|
+
version: 1.5.0.pre.1114
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
79
|
name: bosh_cpi
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
@@ -82,7 +82,7 @@ dependencies:
|
|
82
82
|
requirements:
|
83
83
|
- - ~>
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version: 1.5.0.pre.
|
85
|
+
version: 1.5.0.pre.1114
|
86
86
|
type: :runtime
|
87
87
|
prerelease: false
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -90,7 +90,7 @@ dependencies:
|
|
90
90
|
requirements:
|
91
91
|
- - ~>
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: 1.5.0.pre.
|
93
|
+
version: 1.5.0.pre.1114
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
95
|
name: bosh_aws_cpi
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
requirements:
|
99
99
|
- - ~>
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version: 1.5.0.pre.
|
101
|
+
version: 1.5.0.pre.1114
|
102
102
|
type: :runtime
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -106,7 +106,7 @@ dependencies:
|
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 1.5.0.pre.
|
109
|
+
version: 1.5.0.pre.1114
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
111
|
name: bosh_openstack_cpi
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,7 +114,7 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - ~>
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 1.5.0.pre.
|
117
|
+
version: 1.5.0.pre.1114
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -122,7 +122,7 @@ dependencies:
|
|
122
122
|
requirements:
|
123
123
|
- - ~>
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version: 1.5.0.pre.
|
125
|
+
version: 1.5.0.pre.1114
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: bosh_vcloud_cpi
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|
@@ -146,7 +146,7 @@ dependencies:
|
|
146
146
|
requirements:
|
147
147
|
- - ~>
|
148
148
|
- !ruby/object:Gem::Version
|
149
|
-
version: 1.5.0.pre.
|
149
|
+
version: 1.5.0.pre.1114
|
150
150
|
type: :runtime
|
151
151
|
prerelease: false
|
152
152
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -154,7 +154,7 @@ dependencies:
|
|
154
154
|
requirements:
|
155
155
|
- - ~>
|
156
156
|
- !ruby/object:Gem::Version
|
157
|
-
version: 1.5.0.pre.
|
157
|
+
version: 1.5.0.pre.1114
|
158
158
|
- !ruby/object:Gem::Dependency
|
159
159
|
name: rspec-fire
|
160
160
|
requirement: !ruby/object:Gem::Requirement
|
@@ -173,7 +173,7 @@ dependencies:
|
|
173
173
|
version: '0'
|
174
174
|
description: ! 'BOSH CLI plugin for Micro BOSH deployment
|
175
175
|
|
176
|
-
|
176
|
+
e0c472'
|
177
177
|
email: support@cloudfoundry.com
|
178
178
|
executables: []
|
179
179
|
extensions: []
|
@@ -184,17 +184,20 @@ files:
|
|
184
184
|
- config/vcloud_defaults.yml
|
185
185
|
- config/vsphere_defaults.yml
|
186
186
|
- lib/bosh/cli/commands/micro.rb
|
187
|
-
- lib/deployer.rb
|
188
|
-
- lib/deployer/config.rb
|
189
|
-
- lib/deployer/
|
190
|
-
- lib/deployer/
|
191
|
-
- lib/deployer/
|
192
|
-
- lib/deployer/instance_manager
|
193
|
-
- lib/deployer/instance_manager/
|
194
|
-
- lib/deployer/instance_manager/
|
195
|
-
- lib/deployer/
|
196
|
-
- lib/deployer/
|
197
|
-
- lib/deployer/
|
187
|
+
- lib/bosh/deployer.rb
|
188
|
+
- lib/bosh/deployer/config.rb
|
189
|
+
- lib/bosh/deployer/configuration.rb
|
190
|
+
- lib/bosh/deployer/director_gateway_error.rb
|
191
|
+
- lib/bosh/deployer/helpers.rb
|
192
|
+
- lib/bosh/deployer/instance_manager.rb
|
193
|
+
- lib/bosh/deployer/instance_manager/aws.rb
|
194
|
+
- lib/bosh/deployer/instance_manager/openstack.rb
|
195
|
+
- lib/bosh/deployer/instance_manager/vcloud.rb
|
196
|
+
- lib/bosh/deployer/instance_manager/vsphere.rb
|
197
|
+
- lib/bosh/deployer/logger_renderer.rb
|
198
|
+
- lib/bosh/deployer/models/instance.rb
|
199
|
+
- lib/bosh/deployer/specification.rb
|
200
|
+
- lib/bosh/deployer/version.rb
|
198
201
|
- README.rdoc
|
199
202
|
homepage: https://github.com/cloudfoundry/bosh
|
200
203
|
licenses:
|
data/lib/deployer/config.rb
DELETED
@@ -1,157 +0,0 @@
|
|
1
|
-
# Copyright (c) 2009-2012 VMware, Inc.
|
2
|
-
|
3
|
-
module Bosh; end
|
4
|
-
|
5
|
-
module Bosh::Deployer
|
6
|
-
class Config
|
7
|
-
|
8
|
-
class << self
|
9
|
-
|
10
|
-
include Helpers
|
11
|
-
|
12
|
-
attr_accessor :logger, :db, :uuid, :resources, :cloud_options,
|
13
|
-
:spec_properties, :agent_properties, :bosh_ip, :env, :name, :net_conf
|
14
|
-
|
15
|
-
def configure(config)
|
16
|
-
plugin = cloud_plugin(config)
|
17
|
-
|
18
|
-
config = deep_merge(load_defaults(plugin), config)
|
19
|
-
|
20
|
-
@base_dir = config["dir"]
|
21
|
-
FileUtils.mkdir_p(@base_dir)
|
22
|
-
|
23
|
-
@name = config["name"]
|
24
|
-
@cloud_options = config["cloud"]
|
25
|
-
@net_conf = config["network"]
|
26
|
-
@bosh_ip = @net_conf["ip"]
|
27
|
-
@resources = config["resources"]
|
28
|
-
@env = config["env"]
|
29
|
-
|
30
|
-
@logger = Logger.new(config["logging"]["file"] || STDOUT)
|
31
|
-
@logger.level = Logger.const_get(config["logging"]["level"].upcase)
|
32
|
-
@logger.formatter = ThreadFormatter.new
|
33
|
-
|
34
|
-
apply_spec = config["apply_spec"]
|
35
|
-
@spec_properties = apply_spec["properties"]
|
36
|
-
@agent_properties = apply_spec["agent"]
|
37
|
-
|
38
|
-
@db = Sequel.sqlite
|
39
|
-
|
40
|
-
migrate_cpi
|
41
|
-
|
42
|
-
@db.create_table :instances do
|
43
|
-
primary_key :id
|
44
|
-
column :name, :text, :unique => true, :null => false
|
45
|
-
column :uuid, :text
|
46
|
-
column :stemcell_cid, :text
|
47
|
-
column :stemcell_name, :text
|
48
|
-
column :vm_cid, :text
|
49
|
-
column :disk_cid, :text
|
50
|
-
end
|
51
|
-
|
52
|
-
Sequel::Model.plugin :validation_helpers
|
53
|
-
|
54
|
-
Bosh::Clouds::Config.configure(self)
|
55
|
-
|
56
|
-
require "deployer/models/instance"
|
57
|
-
|
58
|
-
@cloud_options["properties"]["agent"]["mbus"] ||=
|
59
|
-
"https://vcap:b00tstrap@0.0.0.0:6868"
|
60
|
-
|
61
|
-
@disk_model = nil
|
62
|
-
@cloud = nil
|
63
|
-
@networks = nil
|
64
|
-
end
|
65
|
-
|
66
|
-
def cloud
|
67
|
-
if @cloud.nil?
|
68
|
-
@cloud = Bosh::Clouds::Provider.create(@cloud_options["plugin"],
|
69
|
-
@cloud_options["properties"])
|
70
|
-
end
|
71
|
-
@cloud
|
72
|
-
end
|
73
|
-
|
74
|
-
def agent
|
75
|
-
uri = URI.parse(agent_url)
|
76
|
-
user, password = uri.userinfo.split(":", 2)
|
77
|
-
uri.userinfo = nil
|
78
|
-
uri.host = bosh_ip
|
79
|
-
Bosh::Agent::HTTPClient.new(uri.to_s,
|
80
|
-
{ "user" => user,
|
81
|
-
"password" => password,
|
82
|
-
"reply_to" => uuid })
|
83
|
-
end
|
84
|
-
|
85
|
-
def agent_url
|
86
|
-
@cloud_options["properties"]["agent"]["mbus"]
|
87
|
-
end
|
88
|
-
|
89
|
-
def networks
|
90
|
-
return @networks if @networks
|
91
|
-
|
92
|
-
@networks = {
|
93
|
-
"bosh" => {
|
94
|
-
"cloud_properties" => @net_conf["cloud_properties"],
|
95
|
-
"netmask" => @net_conf["netmask"],
|
96
|
-
"gateway" => @net_conf["gateway"],
|
97
|
-
"ip" => @net_conf["ip"],
|
98
|
-
"dns" => @net_conf["dns"],
|
99
|
-
"type" => @net_conf["type"],
|
100
|
-
"default" => ["dns", "gateway"]
|
101
|
-
}
|
102
|
-
}
|
103
|
-
if @net_conf["vip"]
|
104
|
-
@networks["vip"] = {
|
105
|
-
"ip" => @net_conf["vip"],
|
106
|
-
"type" => "vip",
|
107
|
-
"cloud_properties" => {}
|
108
|
-
}
|
109
|
-
end
|
110
|
-
|
111
|
-
@networks
|
112
|
-
end
|
113
|
-
|
114
|
-
def task_checkpoint
|
115
|
-
# Bosh::Clouds::Config (bosh_cli >= 0.5.1) delegates task_checkpoint
|
116
|
-
# method to periodically check if director task is cancelled,
|
117
|
-
# so we need to define a void method in Bosh::Deployer::Config to avoid
|
118
|
-
# NoMethodError exceptions.
|
119
|
-
end
|
120
|
-
|
121
|
-
private
|
122
|
-
|
123
|
-
def migrate_cpi
|
124
|
-
cpi = @cloud_options["plugin"]
|
125
|
-
require_path = File.join("cloud", cpi)
|
126
|
-
cpi_path = $LOAD_PATH.find { |p| File.exist?(
|
127
|
-
File.join(p, require_path)) }
|
128
|
-
migrations = File.expand_path("../db/migrations", cpi_path)
|
129
|
-
|
130
|
-
if File.directory?(migrations)
|
131
|
-
Sequel.extension :migration
|
132
|
-
Sequel::TimestampMigrator.new(
|
133
|
-
@db, migrations, :table => "#{cpi}_cpi_schema").run
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
def deep_merge(src, dst)
|
138
|
-
src.merge(dst) do |key, old, new|
|
139
|
-
if new.respond_to?(:blank) && new.blank?
|
140
|
-
old
|
141
|
-
elsif old.kind_of?(Hash) and new.kind_of?(Hash)
|
142
|
-
deep_merge(old, new)
|
143
|
-
elsif old.kind_of?(Array) and new.kind_of?(Array)
|
144
|
-
old.concat(new).uniq
|
145
|
-
else
|
146
|
-
new
|
147
|
-
end
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
def load_defaults(provider)
|
152
|
-
file = File.join(File.dirname(File.expand_path(__FILE__)), "../../config/#{provider}_defaults.yml")
|
153
|
-
Psych.load_file(file)
|
154
|
-
end
|
155
|
-
end
|
156
|
-
end
|
157
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
# Copyright (c) 2009-2012 VMware, Inc.
|
2
|
-
|
3
|
-
module Bosh::Deployer
|
4
|
-
class InstanceManager
|
5
|
-
|
6
|
-
class Vsphere < InstanceManager
|
7
|
-
|
8
|
-
def remote_tunnel(port)
|
9
|
-
end
|
10
|
-
|
11
|
-
def disk_model
|
12
|
-
if @disk_model.nil?
|
13
|
-
require "cloud/vsphere"
|
14
|
-
@disk_model = VSphereCloud::Models::Disk
|
15
|
-
end
|
16
|
-
@disk_model
|
17
|
-
end
|
18
|
-
|
19
|
-
def update_spec(spec)
|
20
|
-
properties = spec.properties
|
21
|
-
|
22
|
-
properties["vcenter"] =
|
23
|
-
Config.spec_properties["vcenter"] ||
|
24
|
-
Config.cloud_options["properties"]["vcenters"].first.dup
|
25
|
-
|
26
|
-
properties["vcenter"]["address"] ||= properties["vcenter"]["host"]
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
# @return [Integer] size in MiB
|
31
|
-
def disk_size(cid)
|
32
|
-
disk_model.first(:uuid => cid).size
|
33
|
-
end
|
34
|
-
|
35
|
-
def persistent_disk_changed?
|
36
|
-
Config.resources["persistent_disk"] != disk_size(state.disk_cid)
|
37
|
-
end
|
38
|
-
|
39
|
-
def check_dependencies
|
40
|
-
if Bosh::Common.which(%w[genisoimage mkisofs]).nil?
|
41
|
-
err("either of 'genisoimage' or 'mkisofs' commands must be present")
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
46
|
-
end
|
data/lib/deployer.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# Copyright (c) 2009-2012 VMware, Inc.
|
2
|
-
|
3
|
-
module Bosh; module Deployer; end; end
|
4
|
-
|
5
|
-
require "agent_client"
|
6
|
-
require "fileutils"
|
7
|
-
require "forwardable"
|
8
|
-
require "sequel"
|
9
|
-
require "sequel/adapters/sqlite"
|
10
|
-
require "cloud"
|
11
|
-
require "logger"
|
12
|
-
require "tmpdir"
|
13
|
-
require "securerandom"
|
14
|
-
require "yaml"
|
15
|
-
require "yajl"
|
16
|
-
require "common/common"
|
17
|
-
require "common/thread_formatter"
|
18
|
-
|
19
|
-
require "deployer/version"
|
20
|
-
require "deployer/helpers"
|
21
|
-
require "deployer/config"
|
22
|
-
require "deployer/specification"
|
23
|
-
require "deployer/instance_manager"
|