rcmd 1.5.6 → 1.5.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1b72a21c020c10acb74666026f1e467897d46c73
4
- data.tar.gz: 429163584d6ac0aab5b86ac47be0c1b8f3d57e6e
3
+ metadata.gz: 3bb34dd7c7663c40fe295bfc853479d86117bfa0
4
+ data.tar.gz: dc70389983d3396f48b06cb716624c56d3edf71f
5
5
  SHA512:
6
- metadata.gz: 931dc47e776a37e65df2a2e41c491e576a5e4772825a8656aaa00d20989fef2e0e6ac59c763a490925875e309585e77014ab9750fb8e30358fa5f83efad49b8b
7
- data.tar.gz: f051f803433b11282bf47cfaac31278b9c7058e3046546dea76bac599c227d8bedde48f4a36c3e99055a69a90cab968c9a0a0da0f2705e26b9ffdb1282989166
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.00046 seconds |
4
- ./spec/rcmd_spec.rb[1:2] | passed | 0.00089 seconds |
5
- ./spec/rcmd_spec.rb[1:3] | passed | 0.00056 seconds |
6
- ./spec/rcmd_spec.rb[1:4] | passed | 0.00009 seconds |
7
- ./spec/rcmd_spec.rb[1:5] | passed | 0.00007 seconds |
8
- ./spec/rcmd_spec.rb[1:6] | passed | 0.0008 seconds |
9
- ./spec/rcmd_spec.rb[1:7] | passed | 0.0001 seconds |
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rcmd (1.5.6)
4
+ rcmd (1.5.7)
5
5
  io-console
6
6
  net-ssh
7
7
  thread
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 74</span>
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">&quot;No command set for execution&quot;</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">&gt;</span> <span class="ruby-ivar">@user</span>, <span class="ruby-value">:host</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@queue</span>.<span class="ruby-identifier">pop</span>, <span class="ruby-value">:password</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">:quiet</span> =<span class="ruby-operator">&gt;</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">&gt;</span> <span class="ruby-ivar">@user</span>, <span class="ruby-value">:host</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@queue</span>.<span class="ruby-identifier">pop</span>, <span class="ruby-value">:password</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">:quiet</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@quiet</span>, <span class="ruby-value">:debug</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-ivar">@debug</span> }
324
+ <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">print</span> <span class="ruby-node">&quot;DEBUG :: Connecting to #{conn_options[:host]}\n&quot;</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">&gt;</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>
@@ -1,5 +1,5 @@
1
- Tue, 20 Jun 2017 22:57:08 +0200
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 Tue, 20 Jun 2017 22:50:21 +0200
4
- lib/rcmd/version.rb Tue, 20 Jun 2017 22:41:43 +0200
5
- exe/rcmd Tue, 20 Jun 2017 22:52:18 +0200
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
@@ -1,4 +1,4 @@
1
1
  module Rcmd #:notnew:
2
2
  # +VERSION+ - Version number string
3
- VERSION = "1.5.6"
3
+ VERSION = "1.5.7"
4
4
  end
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.6
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-06-20 00:00:00.000000000 Z
11
+ date: 2017-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh