lxd-common 0.9.7 → 0.9.8
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/lib/nexussw/lxd/transport/mixins/local.rb +23 -12
- data/lib/nexussw/lxd/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0990d505df86f297bad664ba623f35589b27e284ecd3081bd7a480aecf0a6ef7
|
4
|
+
data.tar.gz: 76b72c2361a6a6b6df857b579167a26a3b409e4619544b5bc06057e0c3701792
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f33b89efc507c14f794d460fc36fbd0c62d1227257c36991d3279f9a51effa5311ec67a123a3eb37fa3e64899d05cebd1585d520b30e517b67df20581cb6507
|
7
|
+
data.tar.gz: 57f64e9e9c90402f8e682a5ee07d0545f537cddcfab049fb68b5a36de76110f9c75a5897dd73a30920221d0628bdc1a4d755b0d0b3e72adba5f026c76b4e4565
|
@@ -18,18 +18,29 @@ module NexusSW
|
|
18
18
|
def execute_chunked(command, options, &block)
|
19
19
|
NIO::WebSocket::Reactor.start
|
20
20
|
LXD.with_timeout_and_retries options do
|
21
|
-
|
22
|
-
if options[:
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
21
|
+
if options[:capture] == :interactive
|
22
|
+
if options[:tty] == false
|
23
|
+
Open3.popen2e(command) do |stdin, stdout, th|
|
24
|
+
# return immediately if interactive so that stdin may be used
|
25
|
+
return Helpers::ExecuteMixin::InteractiveResult.new(command, options, stdin, th).tap do |active|
|
26
|
+
chunk_callback(stdout) do |stdout_chunk|
|
27
|
+
active.send_output stdout_chunk if stdout_chunk
|
28
|
+
end
|
29
|
+
yield active
|
30
|
+
active.exitstatus = th.value.exitstatus
|
28
31
|
end
|
29
|
-
yield active
|
30
|
-
active.exitstatus = th.value.exitstatus
|
31
32
|
end
|
32
33
|
else
|
34
|
+
status = system command
|
35
|
+
status = case status
|
36
|
+
when nil then -1
|
37
|
+
when true then 0
|
38
|
+
when false then 1
|
39
|
+
end
|
40
|
+
return Helpers::ExecuteMixin::ExecuteResult.new(command, options, status)
|
41
|
+
end
|
42
|
+
else
|
43
|
+
Open3.popen3(command) do |_stdin, stdout, stderr, th|
|
33
44
|
chunk_callback(stdout, stderr, &block) if block_given?
|
34
45
|
th.join
|
35
46
|
loop do
|
@@ -65,21 +76,21 @@ module NexusSW
|
|
65
76
|
return nil
|
66
77
|
end
|
67
78
|
|
68
|
-
def chunk_callback(stdout, stderr)
|
79
|
+
def chunk_callback(stdout, stderr = nil)
|
69
80
|
NIO::WebSocket::Reactor.queue_task do
|
70
81
|
@mon_out = NIO::WebSocket::Reactor.selector.register(stdout, :r)
|
71
82
|
@mon_out.value = proc do
|
72
83
|
data = read(@mon_out) # read regardless of block_given? so that we don't spin out on :r availability
|
73
84
|
yield(data) if data
|
74
85
|
end
|
75
|
-
end
|
86
|
+
end if stdout
|
76
87
|
NIO::WebSocket::Reactor.queue_task do
|
77
88
|
@mon_err = NIO::WebSocket::Reactor.selector.register(stderr, :r)
|
78
89
|
@mon_err.value = proc do
|
79
90
|
data = read(@mon_err) # read regardless of block_given? so that we don't spin out on :r availability
|
80
91
|
yield(nil, data) if data
|
81
92
|
end
|
82
|
-
end
|
93
|
+
end if stderr
|
83
94
|
end
|
84
95
|
end
|
85
96
|
end
|
data/lib/nexussw/lxd/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lxd-common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Zachariasen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|