symphony-ssh 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/symphony/tasks/ssh.rb +18 -10
- metadata +32 -36
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 051cdb537eac2fcc9d75f9f3c710a698e9aa719488cf70eb08754700bd76bb96
|
4
|
+
data.tar.gz: d3e9a47c6af77ac7b537f5ca3ef1927f786c1dc191e048716f641e78e546c8b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45fc21828ed7e87666a90ca5c8cbd43ef145b0fe4d213d130cf3f804da85029aff96677a588994f1c6966b6718e5e3b59a30af816d1b49a18516b25dcab56482
|
7
|
+
data.tar.gz: d8129926634371f20491d07b28e3ff8d426d60c1e89aeea7d5ddc991eb9ea6d5d435be1643254025ec6ed756414e224bd8089c53b0fc0a994b97c486513d1612
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
Binary file
|
data/lib/symphony/tasks/ssh.rb
CHANGED
@@ -19,6 +19,7 @@ require 'symphony/task' unless defined?( Symphony::Task )
|
|
19
19
|
### command: (required) The command to run on the remote host
|
20
20
|
### port: (optional) The port to connect to (defaults to 22)
|
21
21
|
### opts: (optional) Explicit SSH client options
|
22
|
+
### env: (optional) A hash of environment vars to set for the connection.
|
22
23
|
### user: (optional) The user to connect as (defaults to root)
|
23
24
|
### key: (optional) The path to an SSH private key
|
24
25
|
###
|
@@ -86,17 +87,16 @@ class Symphony::Task::SSH < Symphony::Task
|
|
86
87
|
end
|
87
88
|
|
88
89
|
|
89
|
-
### Perform the ssh connection
|
90
|
-
###
|
90
|
+
### Perform the ssh connection in 'exec' mode, and retrieve any
|
91
|
+
### output from the remote end.
|
91
92
|
###
|
92
93
|
def work( payload, metadata )
|
93
|
-
command
|
94
|
-
raise ArgumentError, "Missing required option 'command'" unless command
|
94
|
+
raise ArgumentError, "Missing required option 'command'" unless payload[ 'command' ]
|
95
95
|
raise ArgumentError, "Missing required option 'host'" unless payload[ 'host' ]
|
96
96
|
|
97
97
|
exitcode = self.open_connection( payload, metadata ) do |reader, writer|
|
98
|
-
self.log.debug "Writing command #{command}..."
|
99
|
-
writer.puts( command )
|
98
|
+
#self.log.debug "Writing command #{command}..."
|
99
|
+
#writer.puts( command )
|
100
100
|
self.log.debug " closing child's writer."
|
101
101
|
writer.close
|
102
102
|
self.log.debug " reading from child."
|
@@ -123,6 +123,7 @@ class Symphony::Task::SSH < Symphony::Task
|
|
123
123
|
opts = payload[ 'opts' ] || Symphony::Task::SSH.opts
|
124
124
|
user = payload[ 'user' ] || Symphony::Task::SSH.user
|
125
125
|
key = payload[ 'key' ] || Symphony::Task::SSH.key
|
126
|
+
env = payload[ 'env' ] || {}
|
126
127
|
|
127
128
|
cmd = []
|
128
129
|
cmd << Symphony::Task::SSH.path
|
@@ -132,23 +133,30 @@ class Symphony::Task::SSH < Symphony::Task
|
|
132
133
|
cmd << '-i' << key if key
|
133
134
|
cmd << '-l' << user
|
134
135
|
cmd << payload[ 'host' ]
|
136
|
+
cmd << payload[ 'command' ]
|
135
137
|
cmd.flatten!
|
136
138
|
self.log.debug "Running SSH command with: %p" % [ Shellwords.shelljoin(cmd) ]
|
137
139
|
|
138
140
|
parent_reader, child_writer = IO.pipe
|
139
141
|
child_reader, parent_writer = IO.pipe
|
140
142
|
|
141
|
-
pid = Process.spawn( *cmd,
|
143
|
+
pid = Process.spawn( env, *cmd,
|
144
|
+
out: child_writer,
|
145
|
+
in: child_reader,
|
146
|
+
close_others: true,
|
147
|
+
unsetenv_others: true
|
148
|
+
)
|
149
|
+
|
142
150
|
child_writer.close
|
143
151
|
child_reader.close
|
144
152
|
|
145
153
|
self.log.debug "Yielding back to the run block."
|
146
154
|
@output = yield( parent_reader, parent_writer )
|
147
|
-
@output = @output.split(
|
155
|
+
@output = @output.split( /\r?\n/ ).reject{|l| l =~ SSH_CLEANUP }.join
|
148
156
|
self.log.debug " run block done."
|
149
157
|
|
150
|
-
|
151
|
-
|
158
|
+
rescue => err
|
159
|
+
self.log.error( err.message )
|
152
160
|
ensure
|
153
161
|
if pid
|
154
162
|
active = Process.kill( 0, pid ) rescue false
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: symphony-ssh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mahlon E. Smith
|
@@ -11,31 +11,27 @@ bindir: bin
|
|
11
11
|
cert_chain:
|
12
12
|
- |
|
13
13
|
-----BEGIN CERTIFICATE-----
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
Bg0JmajxUaGYWnz+QFADT+HLPmekxF3mB4+0ymZCHKPC+04h6RDjvkEOji6Jm+VB
|
34
|
-
JHjnceUEejSXTkZAKAmiOAtnX4j1MM1DLiFMlZ5Wbt7hbiOiO5HoN9p9snZhYqSU
|
35
|
-
JyAQQloqY/KyzQqxPlKdMNmBxRU+Cdarp05lEI6Sfj9MdrndoIL6MT/f6PgoCWZQ
|
36
|
-
xEarK1Fn47yS4UZqRi6VgKc3JHscX9x4
|
14
|
+
MIIDbDCCAlSgAwIBAgIBATANBgkqhkiG9w0BAQUFADA+MQ8wDQYDVQQDDAZtYWhs
|
15
|
+
b24xFzAVBgoJkiaJk/IsZAEZFgdtYXJ0aW5pMRIwEAYKCZImiZ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rw1WPgAeMeDqWeIrRMpUhNZOwroaA1MAr60f9NIYxua/vx
|
31
|
+
n0YyneERGuHPSRZFgo72tGOqLpAlWnhPxRNqnayZmsg3hPPI87B6MTUI2UQ7VUdh
|
32
|
+
UrSf3b+cPoC8PNfjp8zsdw==
|
37
33
|
-----END CERTIFICATE-----
|
38
|
-
date: 2020-
|
34
|
+
date: 2020-07-09 00:00:00.000000000 Z
|
39
35
|
dependencies:
|
40
36
|
- !ruby/object:Gem::Dependency
|
41
37
|
name: configurability
|
@@ -77,70 +73,70 @@ dependencies:
|
|
77
73
|
requirements:
|
78
74
|
- - "~>"
|
79
75
|
- !ruby/object:Gem::Version
|
80
|
-
version: '1.
|
76
|
+
version: '1.3'
|
81
77
|
type: :runtime
|
82
78
|
prerelease: false
|
83
79
|
version_requirements: !ruby/object:Gem::Requirement
|
84
80
|
requirements:
|
85
81
|
- - "~>"
|
86
82
|
- !ruby/object:Gem::Version
|
87
|
-
version: '1.
|
83
|
+
version: '1.3'
|
88
84
|
- !ruby/object:Gem::Dependency
|
89
85
|
name: net-ssh
|
90
86
|
requirement: !ruby/object:Gem::Requirement
|
91
87
|
requirements:
|
92
88
|
- - "~>"
|
93
89
|
- !ruby/object:Gem::Version
|
94
|
-
version: '
|
90
|
+
version: '6.0'
|
95
91
|
type: :runtime
|
96
92
|
prerelease: false
|
97
93
|
version_requirements: !ruby/object:Gem::Requirement
|
98
94
|
requirements:
|
99
95
|
- - "~>"
|
100
96
|
- !ruby/object:Gem::Version
|
101
|
-
version: '
|
97
|
+
version: '6.0'
|
102
98
|
- !ruby/object:Gem::Dependency
|
103
99
|
name: net-sftp
|
104
100
|
requirement: !ruby/object:Gem::Requirement
|
105
101
|
requirements:
|
106
102
|
- - "~>"
|
107
103
|
- !ruby/object:Gem::Version
|
108
|
-
version: '
|
104
|
+
version: '3.0'
|
109
105
|
type: :runtime
|
110
106
|
prerelease: false
|
111
107
|
version_requirements: !ruby/object:Gem::Requirement
|
112
108
|
requirements:
|
113
109
|
- - "~>"
|
114
110
|
- !ruby/object:Gem::Version
|
115
|
-
version: '
|
111
|
+
version: '3.0'
|
116
112
|
- !ruby/object:Gem::Dependency
|
117
113
|
name: rspec
|
118
114
|
requirement: !ruby/object:Gem::Requirement
|
119
115
|
requirements:
|
120
116
|
- - "~>"
|
121
117
|
- !ruby/object:Gem::Version
|
122
|
-
version: '3.
|
118
|
+
version: '3.9'
|
123
119
|
type: :development
|
124
120
|
prerelease: false
|
125
121
|
version_requirements: !ruby/object:Gem::Requirement
|
126
122
|
requirements:
|
127
123
|
- - "~>"
|
128
124
|
- !ruby/object:Gem::Version
|
129
|
-
version: '3.
|
125
|
+
version: '3.9'
|
130
126
|
- !ruby/object:Gem::Dependency
|
131
127
|
name: simplecov
|
132
128
|
requirement: !ruby/object:Gem::Requirement
|
133
129
|
requirements:
|
134
130
|
- - "~>"
|
135
131
|
- !ruby/object:Gem::Version
|
136
|
-
version: '0.
|
132
|
+
version: '0.18'
|
137
133
|
type: :development
|
138
134
|
prerelease: false
|
139
135
|
version_requirements: !ruby/object:Gem::Requirement
|
140
136
|
requirements:
|
141
137
|
- - "~>"
|
142
138
|
- !ruby/object:Gem::Version
|
143
|
-
version: '0.
|
139
|
+
version: '0.18'
|
144
140
|
description: |
|
145
141
|
A small collection of base classes used for interacting with remote
|
146
142
|
machines over ssh. With them, you can use AMQP (via Symphony) to
|
@@ -175,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
171
|
- !ruby/object:Gem::Version
|
176
172
|
version: '0'
|
177
173
|
requirements: []
|
178
|
-
rubygems_version: 3.
|
174
|
+
rubygems_version: 3.1.2
|
179
175
|
signing_key:
|
180
176
|
specification_version: 4
|
181
177
|
summary: Base classes for using Symphony with ssh.
|
metadata.gz.sig
ADDED
Binary file
|