miasma-lxd 0.1.0 → 0.1.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/miasma/contrib/lxd/compute.rb +18 -8
- data/lib/miasma-lxd/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba646017086951faed7f23359b872ae84c1f8baf
|
4
|
+
data.tar.gz: 6ab50e243b95ca6f3ac766175ca239554a57b7c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39daf7fd1c6bd5e1d6f334de2aa4cc40595431ea25a53d46758bfd1972ce7530a18913c8a1b07dffd3214ca61b71b154a07ebe46bd48f268cfe7f9e4cedc24fd
|
7
|
+
data.tar.gz: c1607129c66022cbad4960c779b994a31d7210fc3295eb24bea8c49e8cc97caf558e31d7cec7d0a23948babc669919fbe9808f8b3f53ab85d816369678f4b728
|
data/CHANGELOG.md
CHANGED
@@ -1,2 +1,9 @@
|
|
1
|
+
# v0.1.2
|
2
|
+
* Allow timeout configuration on exec waiter
|
3
|
+
* Do not automatically close connection on EOF
|
4
|
+
* Stream uploads instead of full read then write
|
5
|
+
* Allow return of status code
|
6
|
+
* Support sending custom environment variables
|
7
|
+
|
1
8
|
# v0.1.0
|
2
9
|
* Initial release
|
@@ -16,6 +16,9 @@ module Miasma
|
|
16
16
|
'stopped' => :stopped
|
17
17
|
)
|
18
18
|
|
19
|
+
# @return [Integer]
|
20
|
+
DEFAULT_EXEC_TIMEOUT = 20
|
21
|
+
|
19
22
|
# Reload a server model's data
|
20
23
|
#
|
21
24
|
# @param server [Miasma::Models::Compute::Server]
|
@@ -161,7 +164,6 @@ module Miasma
|
|
161
164
|
# @param io [IO-ish]
|
162
165
|
# @param remote_path [String]
|
163
166
|
# @return [TrueClass]
|
164
|
-
# @todo update to write in chunks when over `n` size
|
165
167
|
def server_put_file(server, io, remote_path, options={})
|
166
168
|
request(
|
167
169
|
:method => :post,
|
@@ -169,8 +171,9 @@ module Miasma
|
|
169
171
|
:params => {
|
170
172
|
:path => remote_path
|
171
173
|
},
|
172
|
-
:body => io
|
174
|
+
:body => io,
|
173
175
|
:headers => {
|
176
|
+
'Transfer-Encoding' => 'chunked',
|
174
177
|
'X-LXD-uid' => options.fetch(:uid, 0),
|
175
178
|
'X-LXD-gid' => options.fetch(:gid, 0),
|
176
179
|
'X-LXD-mode' => options.fetch(:mode, 0700)
|
@@ -185,7 +188,9 @@ module Miasma
|
|
185
188
|
# @param command [String]
|
186
189
|
# @param options [Hash]
|
187
190
|
# @option options [IO] :stream write command output
|
188
|
-
# @
|
191
|
+
# @option options [Integer] :return_exit_code
|
192
|
+
# @option options [Integer] :timeout
|
193
|
+
# @return [TrueClass, FalseClass, Integer] command was successful
|
189
194
|
def server_execute(server, command, options={})
|
190
195
|
result = request(
|
191
196
|
:method => :post,
|
@@ -194,7 +199,8 @@ module Miasma
|
|
194
199
|
:json => Smash.new(
|
195
200
|
:command => Shellwords.shellwords(command),
|
196
201
|
:interactive => true,
|
197
|
-
'wait-for-websocket' => true
|
202
|
+
'wait-for-websocket' => true,
|
203
|
+
:environment => options.fetch(:environment, {})
|
198
204
|
)
|
199
205
|
)
|
200
206
|
dest = URI.parse(api_endpoint)
|
@@ -225,12 +231,16 @@ module Miasma
|
|
225
231
|
]
|
226
232
|
end
|
227
233
|
]
|
228
|
-
wait_for_operation(operation, options.fetch(:timeout,
|
234
|
+
wait_for_operation(operation, options.fetch(:timeout, DEFAULT_EXEC_TIMEOUT))
|
229
235
|
websockets.map(&:last).map(&:close)
|
230
236
|
result = request(
|
231
237
|
:path => "operations/#{operation}"
|
232
238
|
)
|
233
|
-
|
239
|
+
if(options[:return_exit_code])
|
240
|
+
result.get(:body, :metadata, :metadata, :return)
|
241
|
+
else
|
242
|
+
result.get(:body, :metadata, :metadata, :return) == 0
|
243
|
+
end
|
234
244
|
end
|
235
245
|
|
236
246
|
protected
|
@@ -240,13 +250,13 @@ module Miasma
|
|
240
250
|
# @param op_uuid [String]
|
241
251
|
# @param timeout [Integer]
|
242
252
|
# @return [TrueClass]
|
243
|
-
def wait_for_operation(op_uuid, timeout=
|
253
|
+
def wait_for_operation(op_uuid, timeout=DEFAULT_EXEC_TIMEOUT)
|
244
254
|
op_uuid = op_uuid.sub("/#{version}/operations/", '')
|
245
255
|
request(
|
246
256
|
:path => "operations/#{op_uuid}/wait",
|
247
257
|
:params => {
|
248
258
|
:status_code => 200,
|
249
|
-
:timeout =>
|
259
|
+
:timeout => timeout
|
250
260
|
}
|
251
261
|
)
|
252
262
|
true
|
data/lib/miasma-lxd/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: miasma-lxd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Roberts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bogo-websocket
|