kumogata 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- Njc2ZGUyZjQzOTBmN2Q2NmM1ZjczMjc0MWMyMWM5MWFhZGMwYzE2OQ==
5
- data.tar.gz: !binary |-
6
- ODY3ODA4NDcxYTgyYmMwOWUyYzI2ZGI0ZjEzODZkMTdiZGE3N2U1MA==
2
+ SHA1:
3
+ metadata.gz: 9f8f5c3adbd22698119c42ffcb9864f11d284ca8
4
+ data.tar.gz: 170ec529a9b83979bed211fa9c56e7dfc640022c
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NGY5OTBmNjU2NDYxNzkyMTc0NDNmZmI4NGE5ZjIxYTVmMGI1MGVlMTk5OTBl
10
- NWVhYjVhYWIxZWJkNzllMDg2MmJhZTRlZmY5ODIxNzNmNGEwZDA0YWMxYTA0
11
- OGU0MTM1MDVkMTBjYzIzZGRkODIyM2U5MTk0MjdmZWQzMDQ0ZjM=
12
- data.tar.gz: !binary |-
13
- NWM3MTE3ZjhiYjE2MzEyZTcxZjZiNzIxNDI1YWRiNDU3MzI1NDUwMTJiZWJl
14
- Zjk4Y2I3MTlkNDU0ZTRiYzJiODBlNWJkOGVhOThlYzkzYjUxMzJjMjdlYjky
15
- NDkyZGEwZTdjODM4NGUwODExZDk1YTVjZjJkZjk3OTExNjQ2MzA=
6
+ metadata.gz: aa6a1443184c5f44b79b54213828a97b78f32d5a668337d1c0282e4bd18490b21b5a54d2843f93768a07840ec9506913dd2f9621a14ab4cfbb8fb2f171377515
7
+ data.tar.gz: ecbfb98d07bd4b716fe1cba9b5697f0188c299c4233987bf9c033c01ebeb978258aff415e932dc2a9eea04b5314b19627d036cace2498c266c642b8a115c1e65
data/README.md CHANGED
@@ -5,8 +5,8 @@
5
5
 
6
6
  Kumogata is a tool for [AWS CloudFormation](https://aws.amazon.com/cloudformation/).
7
7
 
8
- [![Gem Version](https://badge.fury.io/rb/kumogata.png?201403121452)](http://badge.fury.io/rb/kumogata)
9
- [![Build Status](https://drone.io/github.com/winebarrel/kumogata/status.png?201403121452)](https://drone.io/github.com/winebarrel/kumogata/latest)
8
+ [![Gem Version](https://badge.fury.io/rb/kumogata.png?201403122152)](http://badge.fury.io/rb/kumogata)
9
+ [![Build Status](https://drone.io/github.com/winebarrel/kumogata/status.png?201403122152)](https://drone.io/github.com/winebarrel/kumogata/latest)
10
10
 
11
11
  It can define a template in Ruby DSL, such as:
12
12
 
@@ -307,8 +307,9 @@ _post do
307
307
  user "ec2-user"
308
308
  # see http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start
309
309
  #options :timeout => 300
310
- #connect_tries 10
310
+ #connect_tries 36
311
311
  #retry_interval 5
312
+ #request_pty true
312
313
  end
313
314
  command <<-EOS
314
315
  hostname
@@ -322,12 +323,10 @@ end
322
323
  ...
323
324
  Command: my_shell_command
324
325
  Status: 0
325
- ---
326
326
  1> 54.199.251.30
327
327
 
328
328
  Command: my_ssh_command
329
329
  Status: 0
330
- ---
331
330
  1> ip-10-0-129-20
332
331
 
333
332
  (Save to `/foo/bar/command_result.json`)
@@ -111,6 +111,8 @@ class Kumogata::PostProcessing
111
111
  if options and not options.kind_of?(Hash)
112
112
  raise "Invalid post processing ssh options: #{name} => #{options.inspect}"
113
113
  end
114
+
115
+ ssh['request_pty'] = !!((ssh['request_pty'] || true).to_s =~ /\Atrue\Z/)
114
116
  end
115
117
 
116
118
  def run_command(attrs, outputs)
@@ -136,6 +138,7 @@ class Kumogata::PostProcessing
136
138
  retry_interval = (ssh['retry_interval'] || 5).to_i
137
139
 
138
140
  stderr_orig = nil
141
+ ssh_exec_opts = {:request_pty => ssh['request_pty']}
139
142
 
140
143
  begin
141
144
  stderr_orig = STDERR.dup
@@ -143,7 +146,7 @@ class Kumogata::PostProcessing
143
146
 
144
147
  begin
145
148
  retryable(:tries => connect_tries, :on => Net::SSH::Disconnect, :sleep => retry_interval) do
146
- Net::SSH.start(*args) {|ssh| ssh_exec!(ssh, command) }
149
+ Net::SSH.start(*args) {|ssh| ssh_exec!(ssh, command, ssh_exec_opts) }
147
150
  end
148
151
  rescue Net::SSH::HostKeyMismatch => e
149
152
  e.remember_host!
@@ -154,7 +157,7 @@ class Kumogata::PostProcessing
154
157
  end
155
158
  end
156
159
 
157
- def ssh_exec!(ssh, command)
160
+ def ssh_exec!(ssh, command, options)
158
161
  stdout_data = ''
159
162
  stderr_data = ''
160
163
  exit_code = nil
@@ -164,6 +167,14 @@ class Kumogata::PostProcessing
164
167
  stderr_stream = create_stderr_stream
165
168
 
166
169
  ssh.open_channel do |channel|
170
+ if options[:request_pty]
171
+ channel.request_pty do |ch, success|
172
+ unless success
173
+ raise "Couldn't obtain pty (ssh.channel.request_pty)"
174
+ end
175
+ end
176
+ end
177
+
167
178
  channel.exec(command) do |ch, success|
168
179
  unless success
169
180
  raise "Couldn't execute command #{command.inspect} (ssh.channel.exec)"
@@ -1,3 +1,3 @@
1
1
  module Kumogata
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'
3
3
  end
@@ -246,7 +246,7 @@ end
246
246
 
247
247
  client.instance_variable_get(:@post_processing)
248
248
  .should_receive(:run_ssh_command)
249
- .with({"host"=>"<%= Key \"PublicIp\" %>", "user"=>"ec2-user"}, " ls\n", {"PublicIp"=>"127.0.0.1"})
249
+ .with({"host"=>"<%= Key \"PublicIp\" %>", "user"=>"ec2-user", "request_pty"=>true}, " ls\n", {"PublicIp"=>"127.0.0.1"})
250
250
  .and_return(["file1\nfile2\n", "", 0])
251
251
 
252
252
  client.instance_variable_get(:@post_processing)
@@ -238,7 +238,7 @@ end
238
238
 
239
239
  client.instance_variable_get(:@post_processing)
240
240
  .should_receive(:run_ssh_command)
241
- .with({"host"=>"<%= Key \"PublicIp\" %>", "user"=>"ec2-user"}, " ls\n", {"PublicIp"=>"127.0.0.1"})
241
+ .with({"host"=>"<%= Key \"PublicIp\" %>", "user"=>"ec2-user", "request_pty"=>true}, " ls\n", {"PublicIp"=>"127.0.0.1"})
242
242
  .and_return(["file1\nfile2\n", "", 0])
243
243
 
244
244
  client.instance_variable_get(:@post_processing)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kumogata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
@@ -14,196 +14,196 @@ dependencies:
14
14
  name: aws-sdk
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: coderay
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: diffy
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: dslh
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: 0.2.5
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.2.5
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: hashie
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: highline
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ! '>='
87
+ - - '>='
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ! '>='
94
+ - - '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: json
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ! '>='
101
+ - - '>='
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ! '>='
108
+ - - '>='
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: net-ssh
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ! '>='
115
+ - - '>='
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ! '>='
122
+ - - '>='
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: retryable
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ! '>='
129
+ - - '>='
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ! '>='
136
+ - - '>='
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: term-ansicolor
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ! '>='
143
+ - - '>='
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ! '>='
150
+ - - '>='
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: uuidtools
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ! '>='
157
+ - - '>='
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0'
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ! '>='
164
+ - - '>='
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: bundler
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - ! '>='
171
+ - - '>='
172
172
  - !ruby/object:Gem::Version
173
173
  version: '0'
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - ! '>='
178
+ - - '>='
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: rake
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
- - - ! '>='
185
+ - - '>='
186
186
  - !ruby/object:Gem::Version
187
187
  version: '0'
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
- - - ! '>='
192
+ - - '>='
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: rspec
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
- - - ! '>='
199
+ - - '>='
200
200
  - !ruby/object:Gem::Version
201
201
  version: 2.11.0
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
- - - ! '>='
206
+ - - '>='
207
207
  - !ruby/object:Gem::Version
208
208
  version: 2.11.0
209
209
  description: A tool for AWS CloudFormation. It can define a template in Ruby DSL.
@@ -262,17 +262,17 @@ require_paths:
262
262
  - lib
263
263
  required_ruby_version: !ruby/object:Gem::Requirement
264
264
  requirements:
265
- - - ! '>='
265
+ - - '>='
266
266
  - !ruby/object:Gem::Version
267
267
  version: '0'
268
268
  required_rubygems_version: !ruby/object:Gem::Requirement
269
269
  requirements:
270
- - - ! '>='
270
+ - - '>='
271
271
  - !ruby/object:Gem::Version
272
272
  version: '0'
273
273
  requirements: []
274
274
  rubyforge_project:
275
- rubygems_version: 2.1.11
275
+ rubygems_version: 2.0.14
276
276
  signing_key:
277
277
  specification_version: 4
278
278
  summary: A tool for AWS CloudFormation.
@@ -293,3 +293,4 @@ test_files:
293
293
  - spec/kumogata_validate_spec.rb
294
294
  - spec/spec_helper.rb
295
295
  - spec/string_stream_spec.rb
296
+ has_rdoc: