rcmd 1.5.6 → 1.5.7
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/.rspec_status +7 -7
- data/Gemfile.lock +1 -1
- data/doc/rdocs/Rcmd.html +16 -2
- data/doc/rdocs/created.rid +4 -4
- data/exe/rcmd +3 -1
- data/lib/rcmd.rb +5 -1
- data/lib/rcmd/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bb34dd7c7663c40fe295bfc853479d86117bfa0
|
4
|
+
data.tar.gz: dc70389983d3396f48b06cb716624c56d3edf71f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b16f91d267942649db6d7f6eb8469bbc7f4ef05569b5343f5acd69cdb0bdd313019bec92a3449d0ac5c42b71773e9f326e19edafe6534e0f4ddce04d2303541
|
7
|
+
data.tar.gz: 02ef6994b956732e0aae1930d2d11f07c48001eb7a30cec7ece6c21279279f90ab359562340e20c80b2280002d228eb48882c3e932622cf7100e577c0e45c70a
|
data/.rspec_status
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
example_id | status | run_time |
|
2
2
|
------------------------ | ------ | --------------- |
|
3
|
-
./spec/rcmd_spec.rb[1:1] | passed | 0.
|
4
|
-
./spec/rcmd_spec.rb[1:2] | passed | 0.
|
5
|
-
./spec/rcmd_spec.rb[1:3] | passed | 0.
|
6
|
-
./spec/rcmd_spec.rb[1:4] | passed | 0.
|
7
|
-
./spec/rcmd_spec.rb[1:5] | passed | 0.
|
8
|
-
./spec/rcmd_spec.rb[1:6] | passed | 0.
|
9
|
-
./spec/rcmd_spec.rb[1:7] | passed | 0.
|
3
|
+
./spec/rcmd_spec.rb[1:1] | passed | 0.00039 seconds |
|
4
|
+
./spec/rcmd_spec.rb[1:2] | passed | 0.00062 seconds |
|
5
|
+
./spec/rcmd_spec.rb[1:3] | passed | 0.00046 seconds |
|
6
|
+
./spec/rcmd_spec.rb[1:4] | passed | 0.00007 seconds |
|
7
|
+
./spec/rcmd_spec.rb[1:5] | passed | 0.00006 seconds |
|
8
|
+
./spec/rcmd_spec.rb[1:6] | passed | 0.00067 seconds |
|
9
|
+
./spec/rcmd_spec.rb[1:7] | passed | 0.00008 seconds |
|
data/Gemfile.lock
CHANGED
data/doc/rdocs/Rcmd.html
CHANGED
@@ -155,6 +155,19 @@ required arguments are set as variables through the use of accessors.</p>
|
|
155
155
|
</div>
|
156
156
|
</div>
|
157
157
|
|
158
|
+
<div id="attribute-c-debug" class="method-detail">
|
159
|
+
<div class="method-heading attribute-method-heading">
|
160
|
+
<span class="method-name">debug</span><span
|
161
|
+
class="attribute-access-type">[RW]</span>
|
162
|
+
</div>
|
163
|
+
|
164
|
+
<div class="method-description">
|
165
|
+
|
166
|
+
<p>Boolean for debug output</p>
|
167
|
+
|
168
|
+
</div>
|
169
|
+
</div>
|
170
|
+
|
158
171
|
<div id="attribute-c-host_list" class="method-detail">
|
159
172
|
<div class="method-heading attribute-method-heading">
|
160
173
|
<span class="method-name">host_list</span><span
|
@@ -288,7 +301,7 @@ the thread count. This prevents spawning of unneeded threads.</p>
|
|
288
301
|
|
289
302
|
|
290
303
|
<div class="method-source-code" id="run_command-source">
|
291
|
-
<pre><span class="ruby-comment"># File lib/rcmd.rb, line
|
304
|
+
<pre><span class="ruby-comment"># File lib/rcmd.rb, line 77</span>
|
292
305
|
<span class="ruby-keyword">def</span> <span class="ruby-constant">Rcmd</span>.<span class="ruby-identifier">run_command</span>()
|
293
306
|
<span class="ruby-keyword">if</span> <span class="ruby-keyword">not</span> <span class="ruby-ivar">@command</span>
|
294
307
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">"No command set for execution"</span>)
|
@@ -307,7 +320,8 @@ the thread count. This prevents spawning of unneeded threads.</p>
|
|
307
320
|
<span class="ruby-identifier">num_threads</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
308
321
|
<span class="ruby-ivar">@threads</span>[<span class="ruby-identifier">i</span>] = <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> {
|
309
322
|
<span class="ruby-keyword">begin</span>
|
310
|
-
<span class="ruby-identifier">conn_options</span> = { <span class="ruby-value">:user</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@user</span>, <span class="ruby-value">:host</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@queue</span>.<span class="ruby-identifier">pop</span>, <span class="ruby-value">:password</span> =<span class="ruby-operator">></span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">:quiet</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@quiet</span>}
|
323
|
+
<span class="ruby-identifier">conn_options</span> = { <span class="ruby-value">:user</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@user</span>, <span class="ruby-value">:host</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@queue</span>.<span class="ruby-identifier">pop</span>, <span class="ruby-value">:password</span> =<span class="ruby-operator">></span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">:quiet</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@quiet</span>, <span class="ruby-value">:debug</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@debug</span> }
|
324
|
+
<span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">print</span> <span class="ruby-node">"DEBUG :: Connecting to #{conn_options[:host]}\n"</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">conn_options</span>[<span class="ruby-value">:debug</span>]
|
311
325
|
<span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">SSH</span>.<span class="ruby-identifier">start</span>(<span class="ruby-identifier">conn_options</span>[<span class="ruby-value">:host</span>], <span class="ruby-identifier">conn_options</span>[<span class="ruby-value">:user</span>], <span class="ruby-value">:password</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">conn_options</span>[<span class="ruby-value">:passwd</span>]) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">session</span><span class="ruby-operator">|</span>
|
312
326
|
<span class="ruby-comment"># Open channel for input/output control</span>
|
313
327
|
<span class="ruby-identifier">session</span>.<span class="ruby-identifier">open_channel</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">channel</span><span class="ruby-operator">|</span>
|
data/doc/rdocs/created.rid
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
|
1
|
+
Sat, 19 Aug 2017 10:26:57 +0200
|
2
2
|
README.md Tue, 20 Jun 2017 22:55:03 +0200
|
3
|
-
lib/rcmd.rb
|
4
|
-
lib/rcmd/version.rb
|
5
|
-
exe/rcmd
|
3
|
+
lib/rcmd.rb Sat, 19 Aug 2017 10:26:43 +0200
|
4
|
+
lib/rcmd/version.rb Sat, 19 Aug 2017 10:23:14 +0200
|
5
|
+
exe/rcmd Sat, 19 Aug 2017 10:13:47 +0200
|
data/exe/rcmd
CHANGED
@@ -14,7 +14,7 @@ require 'rcmd'
|
|
14
14
|
|
15
15
|
|
16
16
|
# Set default options
|
17
|
-
options = { :threads => 4, :nodes => nil, :environment => nil, :host_file => nil, :user => 'root', :password => false, :command => nil, :quiet => false, :version => false }
|
17
|
+
options = { :threads => 4, :nodes => nil, :environment => nil, :host_file => nil, :user => 'root', :password => false, :command => nil, :quiet => false, :version => false, :debug => false }
|
18
18
|
|
19
19
|
host_list = []
|
20
20
|
|
@@ -29,6 +29,7 @@ opts.on('-t threads', '--threads threads', Integer, "Number of threads to run")
|
|
29
29
|
opts.on('-c <command>', '--command <command>', String, "Quoted string containing the command to be run") { |v| options[:command] = v }
|
30
30
|
opts.on('-q', '--quiet', "Suppress stdout of commands. stderr will still be displayed") { |v| options[:quiet] = v }
|
31
31
|
opts.on('-v', '--version', "Print what version of the command is in use") { |v| options[:version] = v}
|
32
|
+
opts.on('-D', '--debug', "Print debug information") { |v| options[:debug] = v }
|
32
33
|
|
33
34
|
# Process options
|
34
35
|
begin
|
@@ -68,6 +69,7 @@ Rcmd.nthreads= options[:threads]
|
|
68
69
|
Rcmd.user= options[:user]
|
69
70
|
Rcmd.quiet= options[:quiet]
|
70
71
|
Rcmd.command= options[:command]
|
72
|
+
Rcmd.debug= options[:debug]
|
71
73
|
|
72
74
|
# Execute command on provided hosts
|
73
75
|
Rcmd.run_command
|
data/lib/rcmd.rb
CHANGED
@@ -36,6 +36,9 @@ module Rcmd
|
|
36
36
|
|
37
37
|
# Array containing the current iterations thread objects.
|
38
38
|
attr_accessor :threads
|
39
|
+
|
40
|
+
# Boolean for debug output
|
41
|
+
attr_accessor :debug
|
39
42
|
end
|
40
43
|
|
41
44
|
# Main method for this module which should be called after the correct variables have been set.
|
@@ -89,7 +92,8 @@ module Rcmd
|
|
89
92
|
num_threads.times do |i|
|
90
93
|
@threads[i] = Thread.new {
|
91
94
|
begin
|
92
|
-
conn_options = { :user => @user, :host => @queue.pop, :password => nil, :quiet => @quiet}
|
95
|
+
conn_options = { :user => @user, :host => @queue.pop, :password => nil, :quiet => @quiet, :debug => @debug }
|
96
|
+
STDERR.print "DEBUG :: Connecting to #{conn_options[:host]}\n" if conn_options[:debug]
|
93
97
|
Net::SSH.start(conn_options[:host], conn_options[:user], :password => conn_options[:passwd]) do |session|
|
94
98
|
# Open channel for input/output control
|
95
99
|
session.open_channel do |channel|
|
data/lib/rcmd/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rcmd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Rose
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ssh
|