af 0.3.18.3 → 0.3.18.4
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 +3 -0
- data/lib/cli.rb +0 -1
- data/lib/cli/commands/apps.rb +10 -7
- data/lib/cli/commands/base.rb +1 -1
- data/lib/cli/commands/misc.rb +3 -1
- data/lib/cli/commands/services.rb +3 -3
- data/lib/cli/config.rb +0 -4
- data/lib/cli/manifest_helper.rb +3 -3
- data/lib/cli/runner.rb +1 -1
- data/lib/cli/tunnel_helper.rb +2 -2
- data/lib/cli/usage.rb +3 -3
- data/lib/cli/version.rb +1 -1
- data/lib/vmc/client.rb +39 -7
- data/lib/vmc/const.rb +1 -0
- metadata +27 -26
- data/lib/cli/infra_helper.rb +0 -42
data/README.md
CHANGED
|
@@ -29,6 +29,9 @@ MIT license, please see the LICENSE file. All rights reserved._
|
|
|
29
29
|
push [appname] --mem M Set the memory reservation for the application
|
|
30
30
|
push [appname] --no-start Do not auto-start the application
|
|
31
31
|
|
|
32
|
+
Application Download
|
|
33
|
+
pull <appname> [path] Downloads last pushed source to <appname> or [path]
|
|
34
|
+
|
|
32
35
|
Application Operations
|
|
33
36
|
start <appname> Start the application
|
|
34
37
|
stop <appname> Stop the application
|
data/lib/cli.rb
CHANGED
|
@@ -27,7 +27,6 @@ module VMC
|
|
|
27
27
|
autoload :TunnelHelper, "#{ROOT}/cli/tunnel_helper"
|
|
28
28
|
autoload :ManifestHelper, "#{ROOT}/cli/manifest_helper"
|
|
29
29
|
autoload :ConsoleHelper, "#{ROOT}/cli/console_helper"
|
|
30
|
-
autoload :InfraHelper, "#{ROOT}/cli/infra_helper"
|
|
31
30
|
|
|
32
31
|
module Command
|
|
33
32
|
autoload :Base, "#{ROOT}/cli/commands/base"
|
data/lib/cli/commands/apps.rb
CHANGED
|
@@ -291,14 +291,16 @@ module VMC::Cli::Command
|
|
|
291
291
|
if @options[:canary]
|
|
292
292
|
display "[--canary] is deprecated and will be removed in a future version".yellow
|
|
293
293
|
end
|
|
294
|
-
|
|
294
|
+
infra = app[:infra] ? app[:infra][:provider] : nil
|
|
295
|
+
upload_app_bits(appname, @path, infra)
|
|
295
296
|
restart appname if app[:state] == 'STARTED'
|
|
296
297
|
else
|
|
297
298
|
each_app do |name|
|
|
298
299
|
display "Updating application '#{name}'..."
|
|
299
300
|
|
|
300
301
|
app = client.app_info(name)
|
|
301
|
-
|
|
302
|
+
infra = app[:infra] ? app[:infra][:provider] : nil
|
|
303
|
+
upload_app_bits(name, @application, infra)
|
|
302
304
|
restart name if app[:state] == 'STARTED'
|
|
303
305
|
end
|
|
304
306
|
end
|
|
@@ -420,7 +422,7 @@ module VMC::Cli::Command
|
|
|
420
422
|
files && files.select { |f| File.socket? f }
|
|
421
423
|
end
|
|
422
424
|
|
|
423
|
-
def upload_app_bits(appname, path)
|
|
425
|
+
def upload_app_bits(appname, path, infra)
|
|
424
426
|
display 'Uploading Application:'
|
|
425
427
|
|
|
426
428
|
upload_file, file = "#{Dir.tmpdir}/#{appname}.zip", nil
|
|
@@ -480,7 +482,8 @@ module VMC::Cli::Command
|
|
|
480
482
|
# Check to see if the resource check is worth the round trip
|
|
481
483
|
if (total_size > (64*1024)) # 64k for now
|
|
482
484
|
# Send resource fingerprints to the cloud controller
|
|
483
|
-
|
|
485
|
+
# FIXME where do I get infra?
|
|
486
|
+
appcloud_resources = client.check_resources(fingerprints,infra)
|
|
484
487
|
end
|
|
485
488
|
display 'OK'.green
|
|
486
489
|
|
|
@@ -944,7 +947,7 @@ module VMC::Cli::Command
|
|
|
944
947
|
infra = info(:infra)
|
|
945
948
|
|
|
946
949
|
if infra
|
|
947
|
-
err "Infra '#{infra}' is not valid" unless
|
|
950
|
+
err "Infra '#{infra}' is not valid" unless client.infra_valid?(infra)
|
|
948
951
|
end
|
|
949
952
|
|
|
950
953
|
# Check app existing upfront if we have appname
|
|
@@ -992,7 +995,7 @@ module VMC::Cli::Command
|
|
|
992
995
|
command = ask("Start Command") if !command && framework.require_start_command?
|
|
993
996
|
|
|
994
997
|
default_url = "None"
|
|
995
|
-
default_url = "#{appname}.#{
|
|
998
|
+
default_url = "#{appname}.#{client.suggest_url(infra)}" if framework.require_url?
|
|
996
999
|
|
|
997
1000
|
unless no_prompt || url || !framework.require_url?
|
|
998
1001
|
url = ask(
|
|
@@ -1060,7 +1063,7 @@ module VMC::Cli::Command
|
|
|
1060
1063
|
end
|
|
1061
1064
|
|
|
1062
1065
|
# Stage and upload the app bits.
|
|
1063
|
-
upload_app_bits(appname, @application)
|
|
1066
|
+
upload_app_bits(appname, @application, infra)
|
|
1064
1067
|
|
|
1065
1068
|
start(appname, true) unless no_start
|
|
1066
1069
|
end
|
data/lib/cli/commands/base.rb
CHANGED
|
@@ -178,7 +178,7 @@ module VMC::Cli
|
|
|
178
178
|
end
|
|
179
179
|
|
|
180
180
|
def target_base(ctx = [])
|
|
181
|
-
VMC::Cli::Config.base_of(find_symbol("target", ctx) || "api.#{
|
|
181
|
+
VMC::Cli::Config.base_of(find_symbol("target", ctx) || "api.#{client.suggest_url}")
|
|
182
182
|
end
|
|
183
183
|
|
|
184
184
|
# Inject a client to help in testing.
|
data/lib/cli/commands/misc.rb
CHANGED
|
@@ -81,9 +81,11 @@ module VMC::Cli::Command
|
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
def infras
|
|
84
|
+
infras_info = client.infras
|
|
85
|
+
return display "Multiple infras not supported" if infras_info.empty?
|
|
84
86
|
itable = table do |t|
|
|
85
87
|
t.headings = [ 'Name','Description' ]
|
|
86
|
-
|
|
88
|
+
infras_info.each { |i| t << [i[:infra], i[:description]] }
|
|
87
89
|
end
|
|
88
90
|
display "\n"
|
|
89
91
|
display itable
|
|
@@ -42,9 +42,9 @@ module VMC::Cli::Command
|
|
|
42
42
|
|
|
43
43
|
if client.infra_supported?
|
|
44
44
|
unless no_prompt || @options[:infra]
|
|
45
|
-
@options[:infra] =
|
|
45
|
+
@options[:infra] = client.infra_name_for_description(
|
|
46
46
|
ask("Select Infrastructure",
|
|
47
|
-
:indexed => true, :choices =>
|
|
47
|
+
:indexed => true, :choices => client.infra_descriptions))
|
|
48
48
|
end
|
|
49
49
|
end
|
|
50
50
|
|
|
@@ -131,7 +131,7 @@ module VMC::Cli::Command
|
|
|
131
131
|
infra_name = info[:infra] ? info[:infra][:name] : default_infra
|
|
132
132
|
|
|
133
133
|
if infra_name
|
|
134
|
-
err "Infra '#{infra_name}' is not valid" unless
|
|
134
|
+
err "Infra '#{infra_name}' is not valid" unless client.infra_valid?(infra_name)
|
|
135
135
|
end
|
|
136
136
|
|
|
137
137
|
|
data/lib/cli/config.rb
CHANGED
|
@@ -42,10 +42,6 @@ module VMC::Cli
|
|
|
42
42
|
url.sub(/^[^\.]+\./, "")
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
def suggest_url
|
|
46
|
-
@suggest_url ||= VMC::Cli::InfraHelper.base_for_infra(@infra)
|
|
47
|
-
end
|
|
48
|
-
|
|
49
45
|
def store_target(target_host)
|
|
50
46
|
target_file = File.expand_path(TARGET_FILE)
|
|
51
47
|
lock_and_write(target_file, target_host)
|
data/lib/cli/manifest_helper.rb
CHANGED
|
@@ -107,10 +107,10 @@ module VMC::Cli::ManifestHelper
|
|
|
107
107
|
|
|
108
108
|
if client.infra_supported?
|
|
109
109
|
infra = @options[:infra] || manifest("infra") ||
|
|
110
|
-
|
|
111
|
-
ask("Select Infrastructure",:indexed => true, :choices =>
|
|
110
|
+
client.infra_name_for_description(
|
|
111
|
+
ask("Select Infrastructure",:indexed => true, :choices => client.infra_descriptions))
|
|
112
112
|
set infra.dup, "infra"
|
|
113
|
-
|
|
113
|
+
client.infra = infra
|
|
114
114
|
end
|
|
115
115
|
|
|
116
116
|
url_template = manifest("url") || DEFAULTS["url"]
|
data/lib/cli/runner.rb
CHANGED
data/lib/cli/tunnel_helper.rb
CHANGED
|
@@ -292,7 +292,7 @@ module VMC::Cli
|
|
|
292
292
|
manifest = {
|
|
293
293
|
:name => tunnel_appname(infra),
|
|
294
294
|
:staging => {:framework => "sinatra", :runtime => "ruby18" },
|
|
295
|
-
:uris => ["#{tunnel_uniquename(infra)}.#{
|
|
295
|
+
:uris => ["#{tunnel_uniquename(infra)}.#{client.base_for_infra(infra)}"],
|
|
296
296
|
:instances => 1,
|
|
297
297
|
:resources => {:memory => 64},
|
|
298
298
|
:env => ["CALDECOTT_AUTH=#{token}"]
|
|
@@ -304,7 +304,7 @@ module VMC::Cli
|
|
|
304
304
|
manifest
|
|
305
305
|
)
|
|
306
306
|
|
|
307
|
-
apps_cmd.send(:upload_app_bits, tunnel_appname(infra), HELPER_APP)
|
|
307
|
+
apps_cmd.send(:upload_app_bits, tunnel_appname(infra), HELPER_APP, infra)
|
|
308
308
|
|
|
309
309
|
invalidate_tunnel_app_info(infra)
|
|
310
310
|
end
|
data/lib/cli/usage.rb
CHANGED
|
@@ -43,9 +43,6 @@ Currently available af commands are:
|
|
|
43
43
|
push [appname] --debug [MODE] Push application and start in a debug mode
|
|
44
44
|
push [appname] --no-start Do not auto-start the application
|
|
45
45
|
|
|
46
|
-
Application Download
|
|
47
|
-
pull <appname> [path] Downloads last pushed source to <appname> or [path]
|
|
48
|
-
|
|
49
46
|
Application Operations
|
|
50
47
|
start <appname> [--debug [MODE]] Start the application
|
|
51
48
|
stop <appname> Stop the application
|
|
@@ -67,6 +64,9 @@ Currently available af commands are:
|
|
|
67
64
|
stats <appname> Display resource usage for the application
|
|
68
65
|
instances <appname> List application instances
|
|
69
66
|
|
|
67
|
+
Application Download
|
|
68
|
+
pull <appname> [path] Downloads last pushed source to <appname> or [path]
|
|
69
|
+
|
|
70
70
|
Application Environment
|
|
71
71
|
env <appname> List application environment variables
|
|
72
72
|
env-add <appname> <variable[=]value> Add an environment variable to an application
|
data/lib/cli/version.rb
CHANGED
data/lib/vmc/client.rb
CHANGED
|
@@ -22,7 +22,7 @@ class VMC::Client
|
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
attr_reader :target, :host, :user, :proxy, :auth_token
|
|
25
|
-
attr_accessor :trace
|
|
25
|
+
attr_accessor :trace, :infra
|
|
26
26
|
|
|
27
27
|
# Error codes
|
|
28
28
|
VMC_HTTP_ERROR_CODES = [ 400, 500 ]
|
|
@@ -247,9 +247,13 @@ class VMC::Client
|
|
|
247
247
|
# indicating what is needed. This returned manifest should be
|
|
248
248
|
# sent in with the upload if resources were removed.
|
|
249
249
|
# E.g. [{:sha1 => xxx, :size => xxx, :fn => filename}]
|
|
250
|
-
def check_resources(resources)
|
|
250
|
+
def check_resources(resources,infra=nil)
|
|
251
251
|
check_login_status
|
|
252
|
-
|
|
252
|
+
url = VMC::RESOURCES_PATH
|
|
253
|
+
unless infra.nil?
|
|
254
|
+
url += "?infra=#{infra}"
|
|
255
|
+
end
|
|
256
|
+
status, body, headers = json_post(url, resources)
|
|
253
257
|
json_parse(body)
|
|
254
258
|
end
|
|
255
259
|
|
|
@@ -341,12 +345,40 @@ class VMC::Client
|
|
|
341
345
|
end
|
|
342
346
|
|
|
343
347
|
######################################################
|
|
344
|
-
|
|
348
|
+
# Infrastructure
|
|
349
|
+
######################################################
|
|
350
|
+
|
|
351
|
+
def infras
|
|
352
|
+
json_get(path(VMC::GLOBAL_INFRAS_PATH))
|
|
353
|
+
rescue
|
|
354
|
+
[]
|
|
355
|
+
end
|
|
356
|
+
|
|
345
357
|
def infra_supported?
|
|
346
|
-
|
|
347
|
-
|
|
358
|
+
!infras.empty?
|
|
359
|
+
end
|
|
360
|
+
|
|
361
|
+
def base_for_infra(name)
|
|
362
|
+
info = infras.detect { |i| i[:infra] == name }
|
|
363
|
+
info ? info[:base] : "aws.af.cm"
|
|
364
|
+
end
|
|
365
|
+
|
|
366
|
+
def infra_valid?(name)
|
|
367
|
+
infras.detect { |i| i[:infra] == name }
|
|
368
|
+
end
|
|
369
|
+
|
|
370
|
+
def infra_descriptions
|
|
371
|
+
infras.map { |i| i[:description] }
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
def infra_name_for_description(desc)
|
|
375
|
+
info = infras.detect { |i| i[:description] == desc }
|
|
376
|
+
info ? info[:infra] : ""
|
|
377
|
+
end
|
|
378
|
+
|
|
379
|
+
def suggest_url(infra=nil)
|
|
380
|
+
@suggest_url ||= base_for_infra(infra || @infra)
|
|
348
381
|
end
|
|
349
|
-
|
|
350
382
|
|
|
351
383
|
|
|
352
384
|
private
|
data/lib/vmc/const.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: af
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.18.
|
|
4
|
+
version: 0.3.18.4
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,11 +9,12 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2012-08-
|
|
12
|
+
date: 2012-08-17 00:00:00.000000000 -07:00
|
|
13
|
+
default_executable:
|
|
13
14
|
dependencies:
|
|
14
15
|
- !ruby/object:Gem::Dependency
|
|
15
16
|
name: json_pure
|
|
16
|
-
requirement: &
|
|
17
|
+
requirement: &2153196420 !ruby/object:Gem::Requirement
|
|
17
18
|
none: false
|
|
18
19
|
requirements:
|
|
19
20
|
- - ! '>='
|
|
@@ -24,10 +25,10 @@ dependencies:
|
|
|
24
25
|
version: 1.7.0
|
|
25
26
|
type: :runtime
|
|
26
27
|
prerelease: false
|
|
27
|
-
version_requirements: *
|
|
28
|
+
version_requirements: *2153196420
|
|
28
29
|
- !ruby/object:Gem::Dependency
|
|
29
30
|
name: rubyzip
|
|
30
|
-
requirement: &
|
|
31
|
+
requirement: &2153195620 !ruby/object:Gem::Requirement
|
|
31
32
|
none: false
|
|
32
33
|
requirements:
|
|
33
34
|
- - ~>
|
|
@@ -35,10 +36,10 @@ dependencies:
|
|
|
35
36
|
version: 0.9.4
|
|
36
37
|
type: :runtime
|
|
37
38
|
prerelease: false
|
|
38
|
-
version_requirements: *
|
|
39
|
+
version_requirements: *2153195620
|
|
39
40
|
- !ruby/object:Gem::Dependency
|
|
40
41
|
name: rest-client
|
|
41
|
-
requirement: &
|
|
42
|
+
requirement: &2153195120 !ruby/object:Gem::Requirement
|
|
42
43
|
none: false
|
|
43
44
|
requirements:
|
|
44
45
|
- - ! '>='
|
|
@@ -49,10 +50,10 @@ dependencies:
|
|
|
49
50
|
version: 1.7.0
|
|
50
51
|
type: :runtime
|
|
51
52
|
prerelease: false
|
|
52
|
-
version_requirements: *
|
|
53
|
+
version_requirements: *2153195120
|
|
53
54
|
- !ruby/object:Gem::Dependency
|
|
54
55
|
name: terminal-table
|
|
55
|
-
requirement: &
|
|
56
|
+
requirement: &2153194380 !ruby/object:Gem::Requirement
|
|
56
57
|
none: false
|
|
57
58
|
requirements:
|
|
58
59
|
- - ~>
|
|
@@ -60,10 +61,10 @@ dependencies:
|
|
|
60
61
|
version: 1.4.2
|
|
61
62
|
type: :runtime
|
|
62
63
|
prerelease: false
|
|
63
|
-
version_requirements: *
|
|
64
|
+
version_requirements: *2153194380
|
|
64
65
|
- !ruby/object:Gem::Dependency
|
|
65
66
|
name: interact
|
|
66
|
-
requirement: &
|
|
67
|
+
requirement: &2153193920 !ruby/object:Gem::Requirement
|
|
67
68
|
none: false
|
|
68
69
|
requirements:
|
|
69
70
|
- - ~>
|
|
@@ -71,10 +72,10 @@ dependencies:
|
|
|
71
72
|
version: 0.4.0
|
|
72
73
|
type: :runtime
|
|
73
74
|
prerelease: false
|
|
74
|
-
version_requirements: *
|
|
75
|
+
version_requirements: *2153193920
|
|
75
76
|
- !ruby/object:Gem::Dependency
|
|
76
77
|
name: addressable
|
|
77
|
-
requirement: &
|
|
78
|
+
requirement: &2153193440 !ruby/object:Gem::Requirement
|
|
78
79
|
none: false
|
|
79
80
|
requirements:
|
|
80
81
|
- - ~>
|
|
@@ -82,10 +83,10 @@ dependencies:
|
|
|
82
83
|
version: 2.2.6
|
|
83
84
|
type: :runtime
|
|
84
85
|
prerelease: false
|
|
85
|
-
version_requirements: *
|
|
86
|
+
version_requirements: *2153193440
|
|
86
87
|
- !ruby/object:Gem::Dependency
|
|
87
88
|
name: uuidtools
|
|
88
|
-
requirement: &
|
|
89
|
+
requirement: &2153192940 !ruby/object:Gem::Requirement
|
|
89
90
|
none: false
|
|
90
91
|
requirements:
|
|
91
92
|
- - ~>
|
|
@@ -93,10 +94,10 @@ dependencies:
|
|
|
93
94
|
version: 2.1.0
|
|
94
95
|
type: :runtime
|
|
95
96
|
prerelease: false
|
|
96
|
-
version_requirements: *
|
|
97
|
+
version_requirements: *2153192940
|
|
97
98
|
- !ruby/object:Gem::Dependency
|
|
98
99
|
name: rb-readline
|
|
99
|
-
requirement: &
|
|
100
|
+
requirement: &2153192340 !ruby/object:Gem::Requirement
|
|
100
101
|
none: false
|
|
101
102
|
requirements:
|
|
102
103
|
- - ~>
|
|
@@ -104,10 +105,10 @@ dependencies:
|
|
|
104
105
|
version: 0.4.2
|
|
105
106
|
type: :runtime
|
|
106
107
|
prerelease: false
|
|
107
|
-
version_requirements: *
|
|
108
|
+
version_requirements: *2153192340
|
|
108
109
|
- !ruby/object:Gem::Dependency
|
|
109
110
|
name: rake
|
|
110
|
-
requirement: &
|
|
111
|
+
requirement: &2153191840 !ruby/object:Gem::Requirement
|
|
111
112
|
none: false
|
|
112
113
|
requirements:
|
|
113
114
|
- - ! '>='
|
|
@@ -115,10 +116,10 @@ dependencies:
|
|
|
115
116
|
version: '0'
|
|
116
117
|
type: :development
|
|
117
118
|
prerelease: false
|
|
118
|
-
version_requirements: *
|
|
119
|
+
version_requirements: *2153191840
|
|
119
120
|
- !ruby/object:Gem::Dependency
|
|
120
121
|
name: rspec
|
|
121
|
-
requirement: &
|
|
122
|
+
requirement: &2153191200 !ruby/object:Gem::Requirement
|
|
122
123
|
none: false
|
|
123
124
|
requirements:
|
|
124
125
|
- - ~>
|
|
@@ -126,10 +127,10 @@ dependencies:
|
|
|
126
127
|
version: 1.3.0
|
|
127
128
|
type: :development
|
|
128
129
|
prerelease: false
|
|
129
|
-
version_requirements: *
|
|
130
|
+
version_requirements: *2153191200
|
|
130
131
|
- !ruby/object:Gem::Dependency
|
|
131
132
|
name: webmock
|
|
132
|
-
requirement: &
|
|
133
|
+
requirement: &2153190580 !ruby/object:Gem::Requirement
|
|
133
134
|
none: false
|
|
134
135
|
requirements:
|
|
135
136
|
- - ~>
|
|
@@ -137,7 +138,7 @@ dependencies:
|
|
|
137
138
|
version: 1.5.0
|
|
138
139
|
type: :development
|
|
139
140
|
prerelease: false
|
|
140
|
-
version_requirements: *
|
|
141
|
+
version_requirements: *2153190580
|
|
141
142
|
description: AppFog.com CLI
|
|
142
143
|
email: support@appfog.com
|
|
143
144
|
executables:
|
|
@@ -167,7 +168,6 @@ files:
|
|
|
167
168
|
- lib/cli/core_ext.rb
|
|
168
169
|
- lib/cli/errors.rb
|
|
169
170
|
- lib/cli/frameworks.rb
|
|
170
|
-
- lib/cli/infra_helper.rb
|
|
171
171
|
- lib/cli/manifest_helper.rb
|
|
172
172
|
- lib/cli/runner.rb
|
|
173
173
|
- lib/cli/services_helper.rb
|
|
@@ -190,6 +190,7 @@ files:
|
|
|
190
190
|
- caldecott_helper/Gemfile.lock
|
|
191
191
|
- caldecott_helper/server.rb
|
|
192
192
|
- bin/af
|
|
193
|
+
has_rdoc: true
|
|
193
194
|
homepage: http://appfog.com
|
|
194
195
|
licenses: []
|
|
195
196
|
post_install_message:
|
|
@@ -210,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
210
211
|
version: '0'
|
|
211
212
|
requirements: []
|
|
212
213
|
rubyforge_project:
|
|
213
|
-
rubygems_version: 1.
|
|
214
|
+
rubygems_version: 1.6.2
|
|
214
215
|
signing_key:
|
|
215
216
|
specification_version: 3
|
|
216
217
|
summary: AppFog.com CLI
|
data/lib/cli/infra_helper.rb
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
module VMC::Cli
|
|
4
|
-
module InfraHelper
|
|
5
|
-
|
|
6
|
-
class << self
|
|
7
|
-
|
|
8
|
-
def list
|
|
9
|
-
infras.values
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def base_for_infra(infra)
|
|
13
|
-
infras.has_key?(infra) ? infras[infra][:base] : "aws.af.cm"
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def valid?(infra)
|
|
17
|
-
infra && infras.has_key?(infra)
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def infra_descriptions
|
|
21
|
-
infras.map { |k,v| v[:description] }
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def name_for_description(desc)
|
|
25
|
-
name, info = infras.detect { |k,v| v[:description] == desc }
|
|
26
|
-
name
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
private
|
|
30
|
-
def infras
|
|
31
|
-
{
|
|
32
|
-
"ap-aws" => { :name => "ap-aws", :base => "ap01.aws.af.cm", :description => "AWS Asia SE - Singapore" },
|
|
33
|
-
"eu-aws" => { :name => "eu-aws", :base => "eu01.aws.af.cm", :description => "AWS EU West - Ireland" },
|
|
34
|
-
"rs" => { :name => "rs", :base => "rs.af.cm", :description => "Rackspace AZ 1 - Dallas" },
|
|
35
|
-
"aws" => { :name => "aws", :base => "aws.af.cm", :description => "AWS US East - Virginia" }
|
|
36
|
-
}
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
end
|
|
42
|
-
end
|