test-kitchen 2.3.0 → 2.3.1
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/kitchen/instance.rb +1 -1
- data/lib/kitchen/lifecycle_hooks.rb +12 -3
- data/lib/kitchen/transport/ssh.rb +2 -0
- data/lib/kitchen/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9edd0eb56ff04d6f333344674cbc81289a4d5e02e4fc824d80f38c05fc08dde5
|
4
|
+
data.tar.gz: 500f102fd47c3708bc14e35e7e48069f012286b30bab206231b0841d4a50d8e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b471175533c12991c1053b0007d63007b6c2d246ad0bacba89badc7038f0bbe404f2c375db5d50f71d1e9ca93ca3e909dff63bb5f0bd93756b03600538ec6231
|
7
|
+
data.tar.gz: e1ecc75fb49ff9742bb349a97e3e0f6ea7745562c7d576ad096419be697fe3f5eb66ec2e41c24b26f62adfb49ea0676bfc3dff9720d4a16237606d6f2bb1d9f7
|
data/lib/kitchen/instance.rb
CHANGED
@@ -253,7 +253,7 @@ module Kitchen
|
|
253
253
|
def diagnose
|
254
254
|
result = {}
|
255
255
|
%i{
|
256
|
-
platform state_file driver provisioner transport verifier
|
256
|
+
platform state_file driver provisioner transport verifier lifecycle_hooks
|
257
257
|
}.each do |sym|
|
258
258
|
obj = send(sym)
|
259
259
|
result[sym] = obj.respond_to?(:diagnose) ? obj.diagnose : :unknown
|
@@ -85,8 +85,10 @@ module Kitchen
|
|
85
85
|
# @param hook [Hash] Hook configration to use.
|
86
86
|
# @return [void]
|
87
87
|
def run_local_hook(instance, state_file, hook)
|
88
|
-
cmd = hook.
|
88
|
+
cmd = hook.fetch(:local)
|
89
89
|
state = state_file.read
|
90
|
+
# set up empty user variable
|
91
|
+
user = {}
|
90
92
|
# Set up some environment variables with instance info.
|
91
93
|
environment = {
|
92
94
|
"KITCHEN_INSTANCE_NAME" => instance.name,
|
@@ -101,6 +103,12 @@ module Kitchen
|
|
101
103
|
environment[k.to_s] = v.to_s
|
102
104
|
end
|
103
105
|
end
|
106
|
+
|
107
|
+
# add user to user hash for later merging
|
108
|
+
if hook[:user]
|
109
|
+
user[:user] = hook[:user]
|
110
|
+
end
|
111
|
+
|
104
112
|
# Default the cwd to the kitchen root and resolve a relative input cwd against that.
|
105
113
|
cwd = if hook[:cwd]
|
106
114
|
File.expand_path(hook[:cwd], config[:kitchen_root])
|
@@ -108,7 +116,7 @@ module Kitchen
|
|
108
116
|
config[:kitchen_root]
|
109
117
|
end
|
110
118
|
# Build the options for mixlib-shellout.
|
111
|
-
opts = {}.merge(
|
119
|
+
opts = {}.merge(user).merge(cwd: cwd, environment: environment)
|
112
120
|
run_command(cmd, opts)
|
113
121
|
end
|
114
122
|
|
@@ -128,7 +136,8 @@ module Kitchen
|
|
128
136
|
raise UserError, "Cannot use remote lifecycle hooks during phases when the instance is not available"
|
129
137
|
end
|
130
138
|
end
|
131
|
-
|
139
|
+
|
140
|
+
cmd = hook.fetch(:remote)
|
132
141
|
conn = instance.transport.connection(state_file.read)
|
133
142
|
conn.execute(cmd)
|
134
143
|
end
|
@@ -46,6 +46,7 @@ module Kitchen
|
|
46
46
|
default_config :username, "root"
|
47
47
|
default_config :keepalive, true
|
48
48
|
default_config :keepalive_interval, 60
|
49
|
+
default_config :keepalive_maxcount, 3
|
49
50
|
# needs to be one less than the configured sshd_config MaxSessions
|
50
51
|
default_config :max_ssh_sessions, 9
|
51
52
|
default_config :connection_timeout, 15
|
@@ -468,6 +469,7 @@ module Kitchen
|
|
468
469
|
compression_level: data[:compression_level],
|
469
470
|
keepalive: data[:keepalive],
|
470
471
|
keepalive_interval: data[:keepalive_interval],
|
472
|
+
keepalive_maxcount: data[:keepalive_maxcount],
|
471
473
|
timeout: data[:connection_timeout],
|
472
474
|
connection_retries: data[:connection_retries],
|
473
475
|
connection_retry_sleep: data[:connection_retry_sleep],
|
data/lib/kitchen/version.rb
CHANGED