ubalo 0.28 → 0.29
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/ubalo +10 -0
- data/lib/ubalo/container_process.rb +10 -1
- data/lib/ubalo/pod.rb +13 -6
- data/lib/ubalo/task.rb +13 -6
- data/lib/ubalo/version.rb +1 -1
- metadata +16 -45
data/bin/ubalo
CHANGED
@@ -199,6 +199,16 @@ command :run do |c|
|
|
199
199
|
end
|
200
200
|
end
|
201
201
|
|
202
|
+
desc 'SSH into as a task'
|
203
|
+
command :ssh do |c|
|
204
|
+
c.action do |global_options,options,args|
|
205
|
+
task = pod.run(nil, nil)
|
206
|
+
task.wait_for_process
|
207
|
+
task.container_process.ssh
|
208
|
+
task.stop!
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
202
212
|
desc 'Show information about a pod'
|
203
213
|
command :pod do |c|
|
204
214
|
c.action do |global_options,options,args|
|
@@ -8,7 +8,7 @@ module Ubalo
|
|
8
8
|
container_process
|
9
9
|
end
|
10
10
|
|
11
|
-
attr_reader :state, :exit_type, :exit_result, :output
|
11
|
+
attr_reader :state, :exit_type, :exit_result, :output, :ssh_uri
|
12
12
|
|
13
13
|
def initialize(account)
|
14
14
|
@account = account
|
@@ -22,6 +22,15 @@ module Ubalo
|
|
22
22
|
@exit_type = attributes.fetch('exit_type')
|
23
23
|
@exit_result = attributes.fetch('exit_result')
|
24
24
|
@output = attributes.fetch('output')
|
25
|
+
@ssh_uri = attributes.fetch('ssh_uri')
|
26
|
+
end
|
27
|
+
|
28
|
+
def ssh
|
29
|
+
unless @ssh_uri
|
30
|
+
raise Ubalo::Error, "Unable to ssh: no connection information available"
|
31
|
+
end
|
32
|
+
uri = URI.parse(@ssh_uri)
|
33
|
+
system("ssh", "-o", "StrictHostKeyChecking=no", "-o", "CheckHostIp=no", "-p", uri.port.to_s, "#{uri.user}@#{uri.host}")
|
25
34
|
end
|
26
35
|
|
27
36
|
def tail(tailer, message)
|
data/lib/ubalo/pod.rb
CHANGED
@@ -38,15 +38,22 @@ module Ubalo
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def run(argv, arg)
|
41
|
-
if argv.empty?
|
41
|
+
if argv && argv.empty?
|
42
42
|
raise Ubalo::Error, "Specify the command to run"
|
43
43
|
end
|
44
44
|
|
45
|
-
params = {
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
params = {}
|
46
|
+
|
47
|
+
if arg
|
48
|
+
params.merge!(
|
49
|
+
:arg_content_type => UbaloJSON.content_type,
|
50
|
+
:arg => UbaloJSON.dump(arg),
|
51
|
+
)
|
52
|
+
end
|
53
|
+
|
54
|
+
if argv
|
55
|
+
params.merge!(:argv => argv)
|
56
|
+
end
|
50
57
|
task = @account.task_from_json(request(:post, "/tasks", :params => params))
|
51
58
|
|
52
59
|
task
|
data/lib/ubalo/task.rb
CHANGED
@@ -29,11 +29,7 @@ module Ubalo
|
|
29
29
|
def tail_process
|
30
30
|
tailer = Ubalo::TimedTailer.new(logger)
|
31
31
|
|
32
|
-
|
33
|
-
tailer.update("Starting...")
|
34
|
-
refresh!
|
35
|
-
container_process
|
36
|
-
end
|
32
|
+
wait_for_process(tailer)
|
37
33
|
|
38
34
|
container_process.tail(tailer, "Running #{label}...") do
|
39
35
|
refresh!
|
@@ -43,11 +39,20 @@ module Ubalo
|
|
43
39
|
tailer.update("Completed #{label}. Exit code: #{container_process.exit_result}.\n")
|
44
40
|
end
|
45
41
|
|
42
|
+
def wait_for_process(tailer = nil)
|
43
|
+
logger.poll do
|
44
|
+
tailer.update("Starting...") if tailer
|
45
|
+
refresh!
|
46
|
+
container_process
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
46
50
|
def stop!
|
47
51
|
tailer = Ubalo::TimedTailer.new(logger)
|
48
52
|
|
49
53
|
tailer.update("Stopping #{label}...")
|
50
54
|
request(:put, "/stop")
|
55
|
+
refresh!
|
51
56
|
|
52
57
|
logger.poll do
|
53
58
|
tailer.update("Stopping #{label}...")
|
@@ -70,7 +75,9 @@ module Ubalo
|
|
70
75
|
s = ""
|
71
76
|
s << " label: #{label}\n"
|
72
77
|
s << " pod: #{pod_name}\n"
|
73
|
-
|
78
|
+
if argv
|
79
|
+
s << " argv: #{pretty_argv}\n"
|
80
|
+
end
|
74
81
|
if arg?
|
75
82
|
if @arg_error
|
76
83
|
s << "! Parse error in arg: #{@arg_error.message}"
|
data/lib/ubalo/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ubalo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.29'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gli
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70223958033980 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,15 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ! '>='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0'
|
24
|
+
version_requirements: *70223958033980
|
30
25
|
- !ruby/object:Gem::Dependency
|
31
26
|
name: highline
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
27
|
+
requirement: &70223958033560 !ruby/object:Gem::Requirement
|
33
28
|
none: false
|
34
29
|
requirements:
|
35
30
|
- - ! '>='
|
@@ -37,15 +32,10 @@ dependencies:
|
|
37
32
|
version: '0'
|
38
33
|
type: :runtime
|
39
34
|
prerelease: false
|
40
|
-
version_requirements:
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ! '>='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '0'
|
35
|
+
version_requirements: *70223958033560
|
46
36
|
- !ruby/object:Gem::Dependency
|
47
37
|
name: json
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
38
|
+
requirement: &70223958033140 !ruby/object:Gem::Requirement
|
49
39
|
none: false
|
50
40
|
requirements:
|
51
41
|
- - ! '>='
|
@@ -53,15 +43,10 @@ dependencies:
|
|
53
43
|
version: '0'
|
54
44
|
type: :runtime
|
55
45
|
prerelease: false
|
56
|
-
version_requirements:
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
46
|
+
version_requirements: *70223958033140
|
62
47
|
- !ruby/object:Gem::Dependency
|
63
48
|
name: rest-client
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
+
requirement: &70223958027240 !ruby/object:Gem::Requirement
|
65
50
|
none: false
|
66
51
|
requirements:
|
67
52
|
- - ~>
|
@@ -69,15 +54,10 @@ dependencies:
|
|
69
54
|
version: 1.6.3
|
70
55
|
type: :runtime
|
71
56
|
prerelease: false
|
72
|
-
version_requirements:
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- - ~>
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: 1.6.3
|
57
|
+
version_requirements: *70223958027240
|
78
58
|
- !ruby/object:Gem::Dependency
|
79
59
|
name: archive-tar-minitar
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirement: &70223958026680 !ruby/object:Gem::Requirement
|
81
61
|
none: false
|
82
62
|
requirements:
|
83
63
|
- - ! '>='
|
@@ -85,15 +65,10 @@ dependencies:
|
|
85
65
|
version: '0'
|
86
66
|
type: :runtime
|
87
67
|
prerelease: false
|
88
|
-
version_requirements:
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ! '>='
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: '0'
|
68
|
+
version_requirements: *70223958026680
|
94
69
|
- !ruby/object:Gem::Dependency
|
95
70
|
name: launchy
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
71
|
+
requirement: &70223958026100 !ruby/object:Gem::Requirement
|
97
72
|
none: false
|
98
73
|
requirements:
|
99
74
|
- - ! '>='
|
@@ -101,12 +76,7 @@ dependencies:
|
|
101
76
|
version: '0'
|
102
77
|
type: :runtime
|
103
78
|
prerelease: false
|
104
|
-
version_requirements:
|
105
|
-
none: false
|
106
|
-
requirements:
|
107
|
-
- - ! '>='
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '0'
|
79
|
+
version_requirements: *70223958026100
|
110
80
|
description: CLI and API client for Ubalo
|
111
81
|
email: dev@ubalo.com
|
112
82
|
executables:
|
@@ -147,8 +117,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
117
|
version: '0'
|
148
118
|
requirements: []
|
149
119
|
rubyforge_project:
|
150
|
-
rubygems_version: 1.8.
|
120
|
+
rubygems_version: 1.8.11
|
151
121
|
signing_key:
|
152
122
|
specification_version: 3
|
153
123
|
summary: CLI and API client for Ubalo
|
154
124
|
test_files: []
|
125
|
+
has_rdoc:
|