train-core 2.0.2 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/train/platforms/detect/helpers/os_common.rb +1 -2
- data/lib/train/platforms/detect/helpers/os_linux.rb +1 -0
- data/lib/train/plugins/base_connection.rb +13 -4
- data/lib/train/transports/local.rb +1 -1
- data/lib/train/transports/mock.rb +1 -1
- data/lib/train/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84c1a550a64252e1bc30666a40359220d3afdc76403ee8bd580c4fb49cd54c49
|
4
|
+
data.tar.gz: 545681f44366939e9fa22e92b5bd8397fae14b0e5407ab92cdfc456679d5dd66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25c0429f61b1b911e4d32952e53815f689ea9e76eee8fc1d1a1bb8f04f1be82b6f442d9ee11cb1ac91cd162c98606ad9961290fc177625af32dd6ab72a90e258
|
7
|
+
data.tar.gz: 0d1e3a0368830194f669f6623b253679d847a0018137c8a37610d1648d94d91e28497d8e34bd4f50a20515662f8dee890b70908121e81acf96b98b1788e2ccbd
|
@@ -14,8 +14,7 @@ module Train::Platforms::Detect::Helpers
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def winrm?
|
17
|
-
|
18
|
-
@backend.class == Train::Transports::WinRM::Connection
|
17
|
+
@backend.class.to_s == 'Train::Transports::WinRM::Connection'
|
19
18
|
end
|
20
19
|
|
21
20
|
def unix_file_contents(path)
|
@@ -114,10 +114,14 @@ class Train::Plugins::Transport
|
|
114
114
|
|
115
115
|
# This is the main command call for all connections. This will call the private
|
116
116
|
# run_command_via_connection on the connection with optional caching
|
117
|
-
|
118
|
-
|
117
|
+
#
|
118
|
+
# This command accepts an optional data handler block. When provided,
|
119
|
+
# inbound data will be published vi `data_handler.call(data)`. This can allow
|
120
|
+
# callers to receive and render updates from remote command execution.
|
121
|
+
def run_command(cmd, &data_handler)
|
122
|
+
return run_command_via_connection(cmd, &data_handler) unless cache_enabled?(:command)
|
119
123
|
|
120
|
-
@cache[:command][cmd] ||= run_command_via_connection(cmd)
|
124
|
+
@cache[:command][cmd] ||= run_command_via_connection(cmd, &data_handler)
|
121
125
|
end
|
122
126
|
|
123
127
|
# This is the main file call for all connections. This will call the private
|
@@ -150,8 +154,13 @@ class Train::Plugins::Transport
|
|
150
154
|
# Execute a command using this connection.
|
151
155
|
#
|
152
156
|
# @param command [String] command string to execute
|
157
|
+
# @param &data_handler(data) [Proc] proc that is called when data arrives from
|
158
|
+
# the connection. This block is optional. Individual transports will need
|
159
|
+
# to explicitly invoke the block in their implementation of run_command_via_connection;
|
160
|
+
# if they do not, the block is ignored and will not be used to report data back to the caller.
|
161
|
+
#
|
153
162
|
# @return [CommandResult] contains the result of running the command
|
154
|
-
def run_command_via_connection(_command)
|
163
|
+
def run_command_via_connection(_command, &_data_handler)
|
155
164
|
fail NotImplementedError, "#{self.class} does not implement #run_command_via_connection()"
|
156
165
|
end
|
157
166
|
|
data/lib/train/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: train-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dominik Richter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-shellout
|
@@ -113,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
113
|
- !ruby/object:Gem::Version
|
114
114
|
version: '0'
|
115
115
|
requirements: []
|
116
|
-
rubygems_version: 3.0.
|
116
|
+
rubygems_version: 3.0.3
|
117
117
|
signing_key:
|
118
118
|
specification_version: 4
|
119
119
|
summary: Transport interface to talk to a selected set of backends.
|