kitchen-lxd_sling 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/lxc-shell +21 -14
- data/lib/kitchen/driver/lxd/host_locator.rb +1 -1
- data/lib/kitchen/driver/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: 2092e1ad91f7772e18e432a0003511e51e2e453dbe5d29eea414d3f022a4b63e
|
4
|
+
data.tar.gz: 20194530a2e8ca27a4fee5be42db55ebb92602f301d3f7376b06a733134657f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc130261a4f70af5d873eb7da7f15b7080cd73be947d5cb519db1d2d3d4c761a9aff8f771d93c6ca5e7ad185c41392e70dc5406d7f3d0e5c59b227574820e30c
|
7
|
+
data.tar.gz: 91cde3d57650a1d328b71eca65d623feb3d9ef0edf5d5a9acbc3c43d12fee35eb05b1ac938b13bab77c9ebd4a5d217933b6985a85eac2278a220dea8a126d42a
|
data/bin/lxc-shell
CHANGED
@@ -16,6 +16,8 @@ require 'kitchen'
|
|
16
16
|
require 'kitchen/driver/lxd/host_locator'
|
17
17
|
require 'tty/reader'
|
18
18
|
require 'tty/screen'
|
19
|
+
require 'io/wait'
|
20
|
+
require 'io/console'
|
19
21
|
|
20
22
|
class NxHost
|
21
23
|
include Kitchen::Driver::Lxd::HostLocator
|
@@ -27,18 +29,15 @@ end
|
|
27
29
|
|
28
30
|
driver = NxHost.new state[:config]
|
29
31
|
transport = driver.nx_transport state
|
30
|
-
tty = TTY::Reader.new
|
32
|
+
tty = TTY::Reader.new interrupt: :signal
|
31
33
|
win_keymap = {}
|
32
34
|
if Gem.win_platform?
|
33
35
|
win_keymap = TTY::Reader::Keys.keys.invert
|
34
36
|
win_keymap[:clear] = win_keymap[:delete]
|
35
37
|
end
|
36
38
|
|
37
|
-
# ruby bin/lxc-shell .kitchen/kitchen-lxd-
|
39
|
+
# ruby bin/lxc-shell .kitchen/kitchen-lxd-native-ubuntu-1604.yml
|
38
40
|
|
39
|
-
# TODO: (someday - if found useful) the TTY subsystem doesn't capture stdin, so you can't pipe commands to this script
|
40
|
-
# we'd have to interleave the code for both input types (ignoring tty if stdin is not a tty)
|
41
|
-
# TTY gems must stay due to them handling windows input for us
|
42
41
|
term = ENV['TERM'] || 'dumb'
|
43
42
|
user = transport.username
|
44
43
|
if user
|
@@ -47,7 +46,9 @@ if user
|
|
47
46
|
end
|
48
47
|
transport.execute "env TERM=#{term} su#{user}", capture: :interactive do |active|
|
49
48
|
active.capture_output do |stdout|
|
50
|
-
|
49
|
+
$stdout.cooked do
|
50
|
+
print stdout
|
51
|
+
end
|
51
52
|
end
|
52
53
|
tty.on :keypress do |event|
|
53
54
|
active.stdin.write win_keymap[event.key.name] || event.value
|
@@ -59,14 +60,20 @@ transport.execute "env TERM=#{term} su#{user}", capture: :interactive do |active
|
|
59
60
|
# tty-reader doesn't have its own thread - it's pumped by a 'read_xxxx' call
|
60
61
|
# and its inner wait loop blocks VERY HARD unless you nonblock (even a main Thread.kill won't unblock it - windows issue?)
|
61
62
|
# yes windows issue... test code can kill read_keypress when running on linux
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
63
|
+
kp_opts = { nonblock: true }
|
64
|
+
kp_opts = { echo: true, raw: false } unless Gem.win_platform? # counter-options designed to stop io/console calls
|
65
|
+
$stdin.noecho do
|
66
|
+
$stdin.raw do
|
67
|
+
begin
|
68
|
+
loop do
|
69
|
+
break unless active.thread.alive?
|
70
|
+
sleep 0.01 unless (Gem.win_platform? || $stdin.ready?) && tty.read_keypress(kp_opts)
|
71
|
+
end
|
72
|
+
rescue Interrupt
|
73
|
+
# active.thread.signal 2
|
74
|
+
active.stdin.write "\x3"
|
75
|
+
retry
|
76
|
+
end
|
66
77
|
end
|
67
|
-
rescue Interrupt
|
68
|
-
# active.thread.signal 2
|
69
|
-
active.stdin.write "\x3"
|
70
|
-
retry
|
71
78
|
end
|
72
79
|
end.error!
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-lxd_sling
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
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-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lxd-common
|