vmcu 0.3.18.beta.2 → 0.3.18
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cli/commands/misc.rb +2 -2
- data/lib/cli/console_helper.rb +21 -24
- data/lib/cli/frameworks.rb +2 -23
- data/lib/cli/version.rb +1 -1
- data/lib/vmc/client.rb +0 -6
- metadata +5 -21
data/lib/cli/commands/misc.rb
CHANGED
@@ -152,10 +152,10 @@ module VMC::Cli::Command
|
|
152
152
|
require 'win32/registry'
|
153
153
|
reg_targets = load_registry_targets
|
154
154
|
rescue LoadError
|
155
|
-
err "Unable
|
155
|
+
err "Unable not import data from Windows Registry"
|
156
156
|
exit 1
|
157
157
|
rescue
|
158
|
-
err "Unable
|
158
|
+
err "Unable not import data from Windows Registry"
|
159
159
|
exit 1
|
160
160
|
end
|
161
161
|
|
data/lib/cli/console_helper.rb
CHANGED
@@ -50,14 +50,13 @@ module VMC::Cli
|
|
50
50
|
5.times do
|
51
51
|
begin
|
52
52
|
results = @telnet_client.login("Name"=>auth_info["username"],
|
53
|
-
"Password"=>auth_info["password"])
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
end
|
53
|
+
"Password"=>auth_info["password"]) {|line|
|
54
|
+
if line =~ /[$%#>] \z/n
|
55
|
+
prompt = line
|
56
|
+
elsif line =~ /Login failed/
|
57
|
+
err_msg = line
|
58
|
+
end
|
59
|
+
}
|
61
60
|
break
|
62
61
|
rescue TimeoutError
|
63
62
|
sleep 1
|
@@ -105,31 +104,29 @@ module VMC::Cli
|
|
105
104
|
end
|
106
105
|
|
107
106
|
def readline_with_history(prompt)
|
108
|
-
line = Readline
|
109
|
-
return
|
110
|
-
|
107
|
+
line = Readline.readline(prompt, true)
|
108
|
+
return '' if line.nil?
|
109
|
+
#Don't keep blank or repeat commands in history
|
110
|
+
if line =~ /^\s*$/ or Readline::HISTORY.to_a[-2] == line
|
111
|
+
Readline::HISTORY.pop
|
112
|
+
end
|
111
113
|
line
|
112
114
|
end
|
113
115
|
|
114
116
|
def run_console(prompt)
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
exit_console
|
117
|
+
while(cmd = readline_with_history(prompt))
|
118
|
+
if(cmd == "exit" || cmd == "quit")
|
119
|
+
#TimeoutError expected, as exit doesn't return anything
|
120
|
+
@telnet_client.cmd("String"=>cmd,"Timeout"=>1) rescue TimeoutError
|
121
|
+
close_console
|
121
122
|
break
|
122
123
|
end
|
123
|
-
|
124
|
+
if !cmd.empty?
|
125
|
+
prompt = send_console_command_display_results(cmd, prompt)
|
126
|
+
end
|
124
127
|
end
|
125
128
|
end
|
126
129
|
|
127
|
-
def exit_console
|
128
|
-
#TimeoutError expected, as exit doesn't return anything
|
129
|
-
@telnet_client.cmd("String"=>"exit","Timeout"=>1) rescue TimeoutError
|
130
|
-
close_console
|
131
|
-
end
|
132
|
-
|
133
130
|
def send_console_command_display_results(cmd, prompt)
|
134
131
|
begin
|
135
132
|
lines = send_console_command cmd
|
data/lib/cli/frameworks.rb
CHANGED
@@ -19,8 +19,7 @@ module VMC::Cli
|
|
19
19
|
'WSGI' => ['wsgi', { :mem => '64M', :description => 'Python WSGI Application'}],
|
20
20
|
'Django' => ['django', { :mem => '128M', :description => 'Python Django Application'}],
|
21
21
|
'dotNet' => ['dotNet', { :mem => '128M', :description => '.Net Web Application'}],
|
22
|
-
'Rack' => ['rack', { :mem => '128M', :description => 'Rack Application'}]
|
23
|
-
'Play' => ['play', { :mem => '256M', :description => 'Play Framework Application'}]
|
22
|
+
'Rack' => ['rack', { :mem => '128M', :description => 'Rack Application'}]
|
24
23
|
}
|
25
24
|
|
26
25
|
class << self
|
@@ -55,8 +54,6 @@ module VMC::Cli
|
|
55
54
|
if !File.directory? path
|
56
55
|
if path.end_with?('.war')
|
57
56
|
return detect_framework_from_war path
|
58
|
-
elsif path.end_with?('.zip')
|
59
|
-
return detect_framework_from_zip path, available_frameworks
|
60
57
|
elsif available_frameworks.include?(["standalone"])
|
61
58
|
return Framework.lookup('Standalone')
|
62
59
|
else
|
@@ -112,7 +109,6 @@ module VMC::Cli
|
|
112
109
|
# Python
|
113
110
|
elsif !Dir.glob('wsgi.py').empty?
|
114
111
|
return Framework.lookup('WSGI')
|
115
|
-
|
116
112
|
# .Net
|
117
113
|
elsif !Dir.glob('web.config').empty?
|
118
114
|
return Framework.lookup('dotNet')
|
@@ -122,11 +118,6 @@ module VMC::Cli
|
|
122
118
|
if File.exist?('server.js') || File.exist?('app.js') || File.exist?('index.js') || File.exist?('main.js')
|
123
119
|
return Framework.lookup('Node')
|
124
120
|
end
|
125
|
-
|
126
|
-
# Play or Standalone Apps
|
127
|
-
elsif Dir.glob('*.zip').first
|
128
|
-
zip_file = Dir.glob('*.zip').first
|
129
|
-
return detect_framework_from_zip zip_file, available_frameworks
|
130
121
|
end
|
131
122
|
|
132
123
|
# Default to Standalone if no other match was made
|
@@ -134,6 +125,7 @@ module VMC::Cli
|
|
134
125
|
end
|
135
126
|
end
|
136
127
|
|
128
|
+
private
|
137
129
|
def detect_framework_from_war(war_file=nil)
|
138
130
|
if war_file
|
139
131
|
contents = ZipUtil.entry_lines(war_file)
|
@@ -157,19 +149,6 @@ module VMC::Cli
|
|
157
149
|
return Framework.lookup('JavaWeb')
|
158
150
|
end
|
159
151
|
end
|
160
|
-
|
161
|
-
def detect_framework_from_zip(zip_file, available_frameworks)
|
162
|
-
contents = ZipUtil.entry_lines(zip_file)
|
163
|
-
detect_framework_from_zip_contents(contents, available_frameworks)
|
164
|
-
end
|
165
|
-
|
166
|
-
def detect_framework_from_zip_contents(contents, available_frameworks)
|
167
|
-
if available_frameworks.include?(["play"]) && contents =~ /lib\/play\..*\.jar/
|
168
|
-
return Framework.lookup('Play')
|
169
|
-
elsif available_frameworks.include?(["standalone"])
|
170
|
-
return Framework.lookup('Standalone')
|
171
|
-
end
|
172
|
-
end
|
173
152
|
end
|
174
153
|
|
175
154
|
attr_reader :name, :description, :console
|
data/lib/cli/version.rb
CHANGED
data/lib/vmc/client.rb
CHANGED
@@ -492,11 +492,6 @@ class VMC::Client
|
|
492
492
|
headers['PROXY-USER'] = @proxy if @proxy
|
493
493
|
headers['CloudTeam'] = @cloud_team if @cloud_team
|
494
494
|
headers['ProxyRealm'] = @proxy_realm if @proxy_realm
|
495
|
-
|
496
|
-
if @via_uhuru_cloud && path.index("..") != 0 && @cloud_team == nil
|
497
|
-
raise TargetError, "Cloud team is not set. Use `vmcu cloud-team` to set the cloud team."
|
498
|
-
end
|
499
|
-
|
500
495
|
path = "cf/" + path if @via_uhuru_cloud
|
501
496
|
|
502
497
|
if content_type
|
@@ -513,7 +508,6 @@ class VMC::Client
|
|
513
508
|
if request_failed?(status)
|
514
509
|
# FIXME, old cc returned 400 on not found for file access
|
515
510
|
err = (status == 404 || status == 400) ? NotFound : TargetError
|
516
|
-
err = AuthError if @via_uhuru_cloud && status == 401
|
517
511
|
raise err, parse_error_message(status, body)
|
518
512
|
else
|
519
513
|
return status, body, response_headers
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vmcu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.18
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.18
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- VMware; Uhurusoftware
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json_pure
|
@@ -135,22 +135,6 @@ dependencies:
|
|
135
135
|
- - ~>
|
136
136
|
- !ruby/object:Gem::Version
|
137
137
|
version: 2.1.0
|
138
|
-
- !ruby/object:Gem::Dependency
|
139
|
-
name: rb-readline
|
140
|
-
requirement: !ruby/object:Gem::Requirement
|
141
|
-
none: false
|
142
|
-
requirements:
|
143
|
-
- - ~>
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: 0.4.2
|
146
|
-
type: :runtime
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
none: false
|
150
|
-
requirements:
|
151
|
-
- - ~>
|
152
|
-
- !ruby/object:Gem::Version
|
153
|
-
version: 0.4.2
|
154
138
|
- !ruby/object:Gem::Dependency
|
155
139
|
name: rake
|
156
140
|
requirement: !ruby/object:Gem::Requirement
|
@@ -266,9 +250,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
266
250
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
267
251
|
none: false
|
268
252
|
requirements:
|
269
|
-
- - ! '
|
253
|
+
- - ! '>='
|
270
254
|
- !ruby/object:Gem::Version
|
271
|
-
version:
|
255
|
+
version: '0'
|
272
256
|
requirements: []
|
273
257
|
rubyforge_project:
|
274
258
|
rubygems_version: 1.8.24
|