7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/cli/console_helper.rb', line 7
def console_connection_info(appname)
app = client.app_info(appname)
fw = VMC::Cli::Framework.lookup_by_framework(app[:staging][:model])
if !fw.console
err "'#{appname}' is a #{fw.name} application. " +
"Console access is not supported for #{fw.name} applications."
end
instances_info_envelope = client.app_instances(appname)
instances_info_envelope = {} if instances_info_envelope.is_a?(Array)
instances_info = instances_info_envelope[:instances] || []
err "No running instances for [#{appname}]" if instances_info.empty?
entry = instances_info[0]
if !entry[:console_port]
begin
client.app_files(appname, '/app/cf-rails-console')
err "Console port not provided for [#{appname}]. Try restarting the app."
rescue VMC::Client::TargetError, VMC::Client::NotFound
err "Console access not supported for [#{appname}]. " +
"Please redeploy your app to enable support."
end
end
conn_info = {
'hostname' => entry[:console_ip],
'port' => entry[:console_port]
}
end
|