vmc 0.4.0.beta.14 → 0.4.0.beta.15
Sign up to get free protection for your applications and to get access to all the features.
- data/vmc-ng/lib/vmc/cli/app.rb +10 -31
- data/vmc-ng/lib/vmc/cli/service.rb +30 -29
- data/vmc-ng/lib/vmc/version.rb +1 -1
- metadata +6 -6
data/vmc-ng/lib/vmc/cli/app.rb
CHANGED
@@ -181,40 +181,19 @@ module VMC
|
|
181
181
|
|
182
182
|
bindings = []
|
183
183
|
if !v2? && input[:create_services] && !force?
|
184
|
-
services = client.
|
184
|
+
services = client.services
|
185
185
|
|
186
186
|
while true
|
187
|
-
|
188
|
-
meta = services[vendor]
|
187
|
+
instance = invoke :create_service
|
189
188
|
|
190
|
-
|
191
|
-
version = meta[:versions].first
|
192
|
-
else
|
193
|
-
version = ask "Which version?",
|
194
|
-
:choices => meta[:versions].sort.reverse
|
195
|
-
end
|
196
|
-
|
197
|
-
random = sprintf("%x", rand(1000000))
|
198
|
-
service_name = ask "Service name?", :default => "#{vendor}-#{random}"
|
199
|
-
|
200
|
-
service = client.service(service_name)
|
201
|
-
service.type = meta[:type]
|
202
|
-
service.vendor = meta[:vendor]
|
203
|
-
service.version = version
|
204
|
-
service.tier = "free"
|
205
|
-
|
206
|
-
with_progress("Creating service #{c(service_name, :name)}") do
|
207
|
-
service.create!
|
208
|
-
end
|
209
|
-
|
210
|
-
bindings << service_name
|
189
|
+
bindings << instance.name
|
211
190
|
|
212
191
|
break unless ask "Create another service?", :default => false
|
213
192
|
end
|
214
193
|
end
|
215
194
|
|
216
195
|
if !v2? && input[:bind_services] && !force?
|
217
|
-
services = client.
|
196
|
+
services = client.service_instances.collect(&:name)
|
218
197
|
|
219
198
|
while true
|
220
199
|
choices = services - bindings
|
@@ -844,8 +823,9 @@ module VMC
|
|
844
823
|
end
|
845
824
|
|
846
825
|
with_progress("Switching mode to #{c(mode, :name)}") do |s|
|
847
|
-
|
848
|
-
modes =
|
826
|
+
runtime = client.runtimes.find { |r| r.name == app.runtime.name }
|
827
|
+
modes = runtime.debug_modes
|
828
|
+
|
849
829
|
if modes.include?(mode)
|
850
830
|
app.debug_mode = mode
|
851
831
|
app.stop! if app.started?
|
@@ -945,10 +925,9 @@ module VMC
|
|
945
925
|
names.select { |s|
|
946
926
|
orphaned ||
|
947
927
|
ask("Delete orphaned service #{c(s, :name)}?", :default => false)
|
948
|
-
}.each do |
|
949
|
-
|
950
|
-
|
951
|
-
end
|
928
|
+
}.each do |name|
|
929
|
+
# TODO: splat
|
930
|
+
invoke :delete_service, :name => name, :really => true
|
952
931
|
end
|
953
932
|
end
|
954
933
|
|
@@ -11,8 +11,8 @@ module VMC
|
|
11
11
|
input :tier, :desc => "Filter by service tier regexp"
|
12
12
|
def services(input)
|
13
13
|
services =
|
14
|
-
with_progress("Getting
|
15
|
-
client.
|
14
|
+
with_progress("Getting service instances") do
|
15
|
+
client.service_instances
|
16
16
|
end
|
17
17
|
|
18
18
|
puts "" unless quiet?
|
@@ -36,14 +36,14 @@ module VMC
|
|
36
36
|
|
37
37
|
desc "Create a service"
|
38
38
|
group :services, :manage
|
39
|
-
input(:
|
39
|
+
input(:service, :argument => true,
|
40
40
|
:desc => "What kind of service (e.g. redis, mysql)") { |choices|
|
41
41
|
ask "What kind?", :choices => choices
|
42
42
|
}
|
43
43
|
input(:name, :argument => true,
|
44
|
-
:desc => "Local name for the service") { |
|
44
|
+
:desc => "Local name for the service") { |service|
|
45
45
|
random = sprintf("%x", rand(1000000))
|
46
|
-
ask "Name?", :default => "#{
|
46
|
+
ask "Name?", :default => "#{service.label}-#{random}"
|
47
47
|
}
|
48
48
|
input(:version, :desc => "Version of the service") { |choices|
|
49
49
|
ask "Which version?", :choices => choices
|
@@ -51,30 +51,34 @@ module VMC
|
|
51
51
|
input :bind, :alias => "--app",
|
52
52
|
:desc => "Application to immediately bind to"
|
53
53
|
def create_service(input)
|
54
|
-
services = client.
|
54
|
+
services = client.services
|
55
55
|
|
56
|
-
|
57
|
-
|
56
|
+
service_label = input[:service, services.collect(&:label).sort]
|
57
|
+
services = services.select { |s| s.label == service_label }
|
58
58
|
|
59
|
-
if
|
60
|
-
|
59
|
+
if services.size == 1
|
60
|
+
service = services.first
|
61
61
|
else
|
62
|
-
version = input[:version,
|
62
|
+
version = input[:version, services.collect(&:version).sort]
|
63
|
+
service = services.find { |s| s.version == version }
|
63
64
|
end
|
64
65
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
66
|
+
instance = client.service_instance
|
67
|
+
instance.name = input[:name, service]
|
68
|
+
instance.type = service.type
|
69
|
+
instance.vendor = service.label
|
70
|
+
instance.version = service.version
|
71
|
+
instance.tier = "free"
|
70
72
|
|
71
|
-
with_progress("Creating service #{c(
|
72
|
-
|
73
|
+
with_progress("Creating service #{c(instance.name, :name)}") do
|
74
|
+
instance.create!
|
73
75
|
end
|
74
76
|
|
75
77
|
if app = input[:bind]
|
76
|
-
invoke :bind_service, :name =>
|
78
|
+
invoke :bind_service, :name => instance.name, :app => app
|
77
79
|
end
|
80
|
+
|
81
|
+
instance
|
78
82
|
end
|
79
83
|
|
80
84
|
|
@@ -89,7 +93,7 @@ module VMC
|
|
89
93
|
ask "Which application?", :choices => choices
|
90
94
|
}
|
91
95
|
def bind_service(input)
|
92
|
-
name = input[:name, client.
|
96
|
+
name = input[:name, client.service_instances.collect(&:name)]
|
93
97
|
appname = input[:app, client.apps.collect(&:name)]
|
94
98
|
|
95
99
|
with_progress("Binding #{c(name, :name)} to #{c(appname, :name)}") do
|
@@ -135,25 +139,22 @@ module VMC
|
|
135
139
|
return unless input[:really, "ALL SERVICES", :bad]
|
136
140
|
|
137
141
|
with_progress("Deleting all services") do
|
138
|
-
client.
|
142
|
+
client.service_instances.collect(&:delete!)
|
139
143
|
end
|
140
144
|
|
141
145
|
return
|
142
146
|
end
|
143
147
|
|
144
|
-
|
145
|
-
|
146
|
-
else
|
147
|
-
services = client.services
|
148
|
-
fail "No services." if services.empty?
|
148
|
+
instances = client.service_instances
|
149
|
+
fail "No services." if instances.empty?
|
149
150
|
|
150
|
-
|
151
|
-
|
151
|
+
name = input[:name, instances.collect(&:name)]
|
152
|
+
service = instances.find { |i| i.name == name }
|
152
153
|
|
153
154
|
return unless input[:really, name, :name]
|
154
155
|
|
155
156
|
with_progress("Deleting #{c(name, :name)}") do
|
156
|
-
|
157
|
+
service.delete!
|
157
158
|
end
|
158
159
|
end
|
159
160
|
|
data/vmc-ng/lib/vmc/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vmc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 62196477
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
9
|
- 0
|
10
10
|
- beta
|
11
|
-
-
|
12
|
-
version: 0.4.0.beta.
|
11
|
+
- 15
|
12
|
+
version: 0.4.0.beta.15
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- VMware
|
@@ -281,12 +281,12 @@ dependencies:
|
|
281
281
|
requirements:
|
282
282
|
- - ~>
|
283
283
|
- !ruby/object:Gem::Version
|
284
|
-
hash:
|
284
|
+
hash: 17
|
285
285
|
segments:
|
286
286
|
- 0
|
287
287
|
- 3
|
288
|
-
-
|
289
|
-
version: 0.3.
|
288
|
+
- 1
|
289
|
+
version: 0.3.1
|
290
290
|
type: :runtime
|
291
291
|
version_requirements: *id016
|
292
292
|
description:
|