rcmd 1.6.5 → 1.6.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +23 -19
- data/doc/rdocs/OptionParser.html +2 -4
- data/doc/rdocs/README_md.html +9 -7
- data/doc/rdocs/Rcmd.html +45 -8
- data/doc/rdocs/Rcmd/DB.html +38 -34
- data/doc/rdocs/created.rid +6 -6
- data/doc/rdocs/index.html +9 -7
- data/doc/rdocs/js/navigation.js.gz +0 -0
- data/doc/rdocs/js/search_index.js +1 -1
- data/doc/rdocs/js/search_index.js.gz +0 -0
- data/doc/rdocs/js/searcher.js.gz +0 -0
- data/doc/rdocs/table_of_contents.html +11 -2
- data/exe/rcmd +1 -3
- data/lib/rcmd.rb +1 -4
- data/lib/rcmd/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5106694e786c92c0c943a91bbf28656735c4e2d469516de309e0d533ce0982b
|
4
|
+
data.tar.gz: 4ea8223a88dc5f0fde2d781978ed968c3611a6c9c7dae659ac76bf415e734ca6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab2df75c3ac10c54637a9fe9c241a2e91d738a3f36e0d37b4f86124f6ab4134990d4496e92db8fe9b03ff075618d588ccdd18ad20c5c630835e1b37f462496e5
|
7
|
+
data.tar.gz: 8ed67ad5df5509b965623e9f6af9aa100889d3548d74fed7174740c65ecef97ededb0dd575c48793508c920d2363a258f3bde24cca65b8e352445ebc5c54e8d9
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rcmd (1.6.
|
4
|
+
rcmd (1.6.6)
|
5
5
|
activerecord
|
6
6
|
activesupport
|
7
7
|
io-console
|
@@ -13,32 +13,33 @@ PATH
|
|
13
13
|
GEM
|
14
14
|
remote: https://rubygems.org/
|
15
15
|
specs:
|
16
|
-
activemodel (5.
|
17
|
-
activesupport (= 5.
|
18
|
-
activerecord (5.
|
19
|
-
activemodel (= 5.
|
20
|
-
activesupport (= 5.
|
21
|
-
arel (
|
22
|
-
activesupport (5.
|
16
|
+
activemodel (5.2.0)
|
17
|
+
activesupport (= 5.2.0)
|
18
|
+
activerecord (5.2.0)
|
19
|
+
activemodel (= 5.2.0)
|
20
|
+
activesupport (= 5.2.0)
|
21
|
+
arel (>= 9.0)
|
22
|
+
activesupport (5.2.0)
|
23
23
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
24
|
-
i18n (
|
24
|
+
i18n (>= 0.7, < 2)
|
25
25
|
minitest (~> 5.1)
|
26
26
|
tzinfo (~> 1.1)
|
27
|
-
arel (
|
27
|
+
arel (9.0.0)
|
28
28
|
concurrent-ruby (1.0.5)
|
29
29
|
diff-lcs (1.3)
|
30
30
|
equatable (0.5.0)
|
31
31
|
hitimes (1.2.6)
|
32
|
-
i18n (0.
|
32
|
+
i18n (1.0.1)
|
33
|
+
concurrent-ruby (~> 1.0)
|
33
34
|
io-console (0.4.6)
|
34
|
-
minitest (5.
|
35
|
+
minitest (5.11.3)
|
35
36
|
necromancer (0.4.0)
|
36
37
|
net-ssh (4.2.0)
|
37
|
-
pastel (0.7.
|
38
|
+
pastel (0.7.2)
|
38
39
|
equatable (~> 0.5.0)
|
39
40
|
tty-color (~> 0.4.0)
|
40
41
|
rake (10.5.0)
|
41
|
-
regexp-examples (1.
|
42
|
+
regexp-examples (1.4.2)
|
42
43
|
rspec (3.6.0)
|
43
44
|
rspec-core (~> 3.6.0)
|
44
45
|
rspec-expectations (~> 3.6.0)
|
@@ -59,15 +60,18 @@ GEM
|
|
59
60
|
hitimes
|
60
61
|
tty-color (0.4.2)
|
61
62
|
tty-cursor (0.5.0)
|
62
|
-
tty-prompt (0.
|
63
|
+
tty-prompt (0.16.1)
|
63
64
|
necromancer (~> 0.4.0)
|
64
65
|
pastel (~> 0.7.0)
|
65
|
-
timers (~> 4.
|
66
|
+
timers (~> 4.0)
|
66
67
|
tty-cursor (~> 0.5.0)
|
67
|
-
tty-reader (~> 0.
|
68
|
-
tty-reader (0.
|
68
|
+
tty-reader (~> 0.3.0)
|
69
|
+
tty-reader (0.3.0)
|
70
|
+
tty-cursor (~> 0.5.0)
|
71
|
+
tty-screen (~> 0.6.4)
|
69
72
|
wisper (~> 2.0.0)
|
70
|
-
|
73
|
+
tty-screen (0.6.4)
|
74
|
+
tzinfo (1.2.5)
|
71
75
|
thread_safe (~> 0.1)
|
72
76
|
wisper (2.0.0)
|
73
77
|
|
data/doc/rdocs/OptionParser.html
CHANGED
@@ -72,8 +72,6 @@
|
|
72
72
|
</section>
|
73
73
|
|
74
74
|
|
75
|
-
|
76
|
-
|
77
75
|
<section id="5Buntitled-5D" class="documentation-section">
|
78
76
|
|
79
77
|
|
@@ -89,8 +87,8 @@
|
|
89
87
|
|
90
88
|
|
91
89
|
<footer id="validator-badges" role="contentinfo">
|
92
|
-
<p><a href="
|
93
|
-
<p>Generated by <a href="https://
|
90
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
91
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.0.1.
|
94
92
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
95
93
|
</footer>
|
96
94
|
|
data/doc/rdocs/README_md.html
CHANGED
@@ -251,26 +251,28 @@ with <em>rake</em>.</p>
|
|
251
251
|
|
252
252
|
<p>Available Rake tasks are:</p>
|
253
253
|
|
254
|
-
<pre class="ruby"><span class="ruby-identifier">rake</span> <span class="ruby-identifier">build</span> <span class="ruby-comment"># Build rcmd-1.
|
254
|
+
<pre class="ruby"><span class="ruby-identifier">rake</span> <span class="ruby-identifier">build</span> <span class="ruby-comment"># Build rcmd-1.6.4.gem into the pkg directory</span>
|
255
255
|
<span class="ruby-identifier">rake</span> <span class="ruby-identifier">clean</span> <span class="ruby-comment"># Remove any temporary products</span>
|
256
256
|
<span class="ruby-identifier">rake</span> <span class="ruby-identifier">clobber</span> <span class="ruby-comment"># Remove any generated files</span>
|
257
257
|
<span class="ruby-identifier">rake</span> <span class="ruby-identifier">clobber_rdoc</span> <span class="ruby-comment"># Remove RDoc HTML files</span>
|
258
258
|
<span class="ruby-identifier">rake</span> <span class="ruby-identifier">console</span> <span class="ruby-comment"># Open an IRB console with this gem loaded</span>
|
259
|
-
<span class="ruby-identifier">rake</span> <span class="ruby-identifier">install</span> <span class="ruby-comment"># Build and install rcmd-1.
|
260
|
-
<span class="ruby-identifier">rake</span> <span class="ruby-
|
259
|
+
<span class="ruby-identifier">rake</span> <span class="ruby-identifier">install</span> <span class="ruby-comment"># Build and install rcmd-1.6.4.gem into system gems</span>
|
260
|
+
<span class="ruby-identifier">rake</span> <span class="ruby-value">install:</span><span class="ruby-identifier">local</span> <span class="ruby-comment"># Build and install rcmd-1.6.4.gem into system gems without network access</span>
|
261
261
|
<span class="ruby-identifier">rake</span> <span class="ruby-identifier">rdoc</span> <span class="ruby-comment"># Build RDoc HTML files</span>
|
262
262
|
<span class="ruby-identifier">rake</span> <span class="ruby-identifier">reinstall</span> <span class="ruby-comment"># Remove, build, and install gem</span>
|
263
|
-
<span class="ruby-identifier">rake</span> <span class="ruby-identifier">release</span>[<span class="ruby-identifier">remote</span>] <span class="ruby-comment"># Create tag v1.
|
263
|
+
<span class="ruby-identifier">rake</span> <span class="ruby-identifier">release</span>[<span class="ruby-identifier">remote</span>] <span class="ruby-comment"># Create tag v1.6.4 and build and push rcmd-1.6.4.gem to Rubygems</span>
|
264
264
|
<span class="ruby-identifier">rake</span> <span class="ruby-identifier">rerdoc</span> <span class="ruby-comment"># Rebuild RDoc HTML files</span>
|
265
|
-
<span class="ruby-identifier">rake</span> <span class="ruby-identifier">
|
265
|
+
<span class="ruby-identifier">rake</span> <span class="ruby-value">test:</span><span class="ruby-identifier">all</span> <span class="ruby-comment"># Run all RSpec tests</span>
|
266
|
+
<span class="ruby-identifier">rake</span> <span class="ruby-value">test:</span><span class="ruby-identifier">db</span> <span class="ruby-comment"># Test Database functionality (sqlite3 required)</span>
|
267
|
+
<span class="ruby-identifier">rake</span> <span class="ruby-value">test:</span><span class="ruby-identifier">mainlib</span> <span class="ruby-comment"># Test main rcmd lib</span>
|
266
268
|
</pre>
|
267
269
|
</main>
|
268
270
|
|
269
271
|
|
270
272
|
|
271
273
|
<footer id="validator-badges" role="contentinfo">
|
272
|
-
<p><a href="
|
273
|
-
<p>Generated by <a href="https://
|
274
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
275
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.0.1.
|
274
276
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
275
277
|
</footer>
|
276
278
|
|
data/doc/rdocs/Rcmd.html
CHANGED
@@ -52,6 +52,15 @@
|
|
52
52
|
</div>
|
53
53
|
|
54
54
|
|
55
|
+
<div class="nav-section">
|
56
|
+
<h3>Table of Contents</h3>
|
57
|
+
|
58
|
+
<ul class="link-list" role="directory">
|
59
|
+
<li><a href="#module-Rcmd-label-begin+rdoc">begin rdoc</a>
|
60
|
+
<li><a href="#module-Rcmd-label-end">end</a>
|
61
|
+
</ul>
|
62
|
+
</div>
|
63
|
+
|
55
64
|
|
56
65
|
<div id="class-metadata">
|
57
66
|
|
@@ -79,16 +88,18 @@
|
|
79
88
|
|
80
89
|
<section class="description">
|
81
90
|
|
91
|
+
<h1 id="module-Rcmd-label-begin+rdoc">begin rdoc<span><a href="#module-Rcmd-label-begin+rdoc">¶</a> <a href="#top">↑</a></span></h1>
|
92
|
+
|
82
93
|
<p>This module is for parellel remote (SSH) execution of a single command
|
83
94
|
string on Multiple hosts. The module itself consists of one method for
|
84
95
|
execution (Rcmd.run_command) which does not accept any arguments. The
|
85
96
|
required arguments are set as variables through the use of accessors.</p>
|
86
97
|
|
98
|
+
<h1 id="module-Rcmd-label-end">end<span><a href="#module-Rcmd-label-end">¶</a> <a href="#top">↑</a></span></h1>
|
99
|
+
|
87
100
|
</section>
|
88
101
|
|
89
102
|
|
90
|
-
|
91
|
-
|
92
103
|
<section id="5Buntitled-5D" class="documentation-section">
|
93
104
|
|
94
105
|
|
@@ -156,6 +167,32 @@ required arguments are set as variables through the use of accessors.</p>
|
|
156
167
|
</div>
|
157
168
|
</div>
|
158
169
|
|
170
|
+
<div id="attribute-c-hosts_file" class="method-detail">
|
171
|
+
<div class="method-heading attribute-method-heading">
|
172
|
+
<span class="method-name">hosts_file</span><span
|
173
|
+
class="attribute-access-type">[RW]</span>
|
174
|
+
</div>
|
175
|
+
|
176
|
+
<div class="method-description">
|
177
|
+
|
178
|
+
<p>String fo path to user_known_hosts_file</p>
|
179
|
+
|
180
|
+
</div>
|
181
|
+
</div>
|
182
|
+
|
183
|
+
<div id="attribute-c-keys_only" class="method-detail">
|
184
|
+
<div class="method-heading attribute-method-heading">
|
185
|
+
<span class="method-name">keys_only</span><span
|
186
|
+
class="attribute-access-type">[RW]</span>
|
187
|
+
</div>
|
188
|
+
|
189
|
+
<div class="method-description">
|
190
|
+
|
191
|
+
<p>Boolean for using only ssh-keys or not</p>
|
192
|
+
|
193
|
+
</div>
|
194
|
+
</div>
|
195
|
+
|
159
196
|
<div id="attribute-c-nthreads" class="method-detail">
|
160
197
|
<div class="method-heading attribute-method-heading">
|
161
198
|
<span class="method-name">nthreads</span><span
|
@@ -277,8 +314,8 @@ the thread count. This prevents spawning of unneeded threads.</p>
|
|
277
314
|
|
278
315
|
|
279
316
|
<div class="method-source-code" id="run_command-source">
|
280
|
-
<pre><span class="ruby-comment"># File lib/rcmd.rb, line
|
281
|
-
<span class="ruby-keyword">def</span> <span class="ruby-constant">Rcmd</span>.<span class="ruby-identifier">run_command</span>()
|
317
|
+
<pre><span class="ruby-comment"># File lib/rcmd.rb, line 86</span>
|
318
|
+
<span class="ruby-keyword">def</span> <span class="ruby-constant">Rcmd</span>.<span class="ruby-identifier ruby-title">run_command</span>()
|
282
319
|
<span class="ruby-keyword">if</span> <span class="ruby-keyword">not</span> <span class="ruby-ivar">@command</span>
|
283
320
|
<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>)
|
284
321
|
<span class="ruby-keyword">end</span>
|
@@ -296,9 +333,9 @@ the thread count. This prevents spawning of unneeded threads.</p>
|
|
296
333
|
<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>
|
297
334
|
<span class="ruby-ivar">@threads</span>[<span class="ruby-identifier">i</span>] = <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> {
|
298
335
|
<span class="ruby-keyword">begin</span>
|
299
|
-
<span class="ruby-identifier">conn_options</span> = { <span class="ruby-value">:user</span>
|
336
|
+
<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>, <span class="ruby-value">:keys_only</span> <span class="ruby-operator">=></span> <span class="ruby-ivar">@keys_only</span>, <span class="ruby-value">:user_known_hosts_file</span> <span class="ruby-operator">=></span> <span class="ruby-ivar">@hosts_file</span>}
|
300
337
|
<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>]
|
301
|
-
<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>
|
338
|
+
<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>
|
302
339
|
<span class="ruby-comment"># Open channel for input/output control</span>
|
303
340
|
<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>
|
304
341
|
<span class="ruby-identifier">channel</span>.<span class="ruby-identifier">on_data</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ch</span>, <span class="ruby-identifier">data</span><span class="ruby-operator">|</span>
|
@@ -344,8 +381,8 @@ the thread count. This prevents spawning of unneeded threads.</p>
|
|
344
381
|
|
345
382
|
|
346
383
|
<footer id="validator-badges" role="contentinfo">
|
347
|
-
<p><a href="
|
348
|
-
<p>Generated by <a href="https://
|
384
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
385
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.0.1.
|
349
386
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
350
387
|
</footer>
|
351
388
|
|
data/doc/rdocs/Rcmd/DB.html
CHANGED
@@ -98,6 +98,8 @@
|
|
98
98
|
|
99
99
|
<section class="description">
|
100
100
|
|
101
|
+
<h1 id="class-Rcmd::DB-label-begin+rdoc">begin rdoc<span><a href="#class-Rcmd::DB-label-begin+rdoc">¶</a> <a href="#top">↑</a></span></h1>
|
102
|
+
|
101
103
|
<p>This class provides a middle layer for allowing a database to be queried
|
102
104
|
for hosts. This is accomplished by using ActiveRecord for the middle layer
|
103
105
|
and thus should support any database ActiveRecord supports. Currently
|
@@ -130,8 +132,6 @@ are:</p>
|
|
130
132
|
</section>
|
131
133
|
|
132
134
|
|
133
|
-
|
134
|
-
|
135
135
|
<section id="5Buntitled-5D" class="documentation-section">
|
136
136
|
|
137
137
|
|
@@ -168,13 +168,12 @@ are:</p>
|
|
168
168
|
|
169
169
|
<div class="method-source-code" id="create_config-source">
|
170
170
|
<pre><span class="ruby-comment"># File lib/rcmd/db.rb, line 79</span>
|
171
|
-
<span class="ruby-keyword">def</span> <span class="ruby-constant">DB</span>.<span class="ruby-identifier">create_config</span>
|
172
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Function: #{@config_dir}"</span>
|
171
|
+
<span class="ruby-keyword">def</span> <span class="ruby-constant">DB</span>.<span class="ruby-identifier ruby-title">create_config</span>
|
173
172
|
<span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-ivar">@config_dir</span>)
|
174
173
|
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mkdir_p</span>(<span class="ruby-ivar">@config_dir</span>)
|
175
174
|
<span class="ruby-keyword">end</span>
|
176
175
|
|
177
|
-
<span class="ruby-identifier">conf</span> = [ <span class="ruby-value">:adapter</span>
|
176
|
+
<span class="ruby-identifier">conf</span> = [ <span class="ruby-value">:adapter</span> <span class="ruby-operator">=></span> <span class="ruby-string">"sqlite3"</span>, <span class="ruby-value">:host</span> <span class="ruby-operator">=></span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">:database</span> <span class="ruby-operator">=></span> <span class="ruby-string">':memory:'</span>, <span class="ruby-value">:table</span> <span class="ruby-operator">=></span> <span class="ruby-string">'servers'</span>, <span class="ruby-value">:username</span> <span class="ruby-operator">=></span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">:password</span> <span class="ruby-operator">=></span> <span class="ruby-keyword">nil</span>, <span class="ruby-value">:host_field</span> <span class="ruby-operator">=></span> <span class="ruby-string">'hostname'</span>, <span class="ruby-value">:type_field</span> <span class="ruby-operator">=></span> <span class="ruby-string">'server_type'</span>, <span class="ruby-value">:os_field</span> <span class="ruby-operator">=></span> <span class="ruby-string">'osversion'</span> ]
|
178
177
|
|
179
178
|
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-ivar">@config_file</span>, <span class="ruby-string">'w'</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
|
180
179
|
<span class="ruby-identifier">f</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">conf</span>.<span class="ruby-identifier">to_yaml</span>)
|
@@ -212,23 +211,27 @@ and set the table_name variable of the class.</p>
|
|
212
211
|
|
213
212
|
|
214
213
|
<div class="method-source-code" id="db_connect-source">
|
215
|
-
<pre><span class="ruby-comment"># File lib/rcmd/db.rb, line
|
216
|
-
<span class="ruby-keyword">def</span> <span class="ruby-constant">DB</span>.<span class="ruby-identifier">db_connect</span>
|
214
|
+
<pre><span class="ruby-comment"># File lib/rcmd/db.rb, line 156</span>
|
215
|
+
<span class="ruby-keyword">def</span> <span class="ruby-constant">DB</span>.<span class="ruby-identifier ruby-title">db_connect</span>
|
217
216
|
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">load_config</span>
|
218
|
-
|
219
|
-
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@conf</span>[<span class="ruby-value">:adapter</span>].<span class="ruby-identifier">downcase</span> <span class="ruby-operator">==</span> <span class="ruby-string">"sqlite3"</span>
|
220
|
-
<span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">establish_connection</span>(<span class="ruby-value">:adapter</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@conf</span>[<span class="ruby-value">:adapter</span>].<span class="ruby-identifier">downcase</span>,
|
221
|
-
<span class="ruby-value">:database</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@conf</span>[<span class="ruby-value">:database</span>])
|
222
|
-
<span class="ruby-keyword">else</span>
|
223
|
-
<span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">establish_connection</span>(
|
224
|
-
<span class="ruby-value">:adapter</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@conf</span>[<span class="ruby-value">:adapter</span>].<span class="ruby-identifier">downcase</span>,
|
225
|
-
<span class="ruby-value">:host</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@conf</span>[<span class="ruby-value">:host</span>],
|
226
|
-
<span class="ruby-value">:username</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@conf</span>[<span class="ruby-value">:username</span>],
|
227
|
-
<span class="ruby-value">:password</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@conf</span>[<span class="ruby-value">:password</span>],
|
228
|
-
<span class="ruby-value">:database</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@conf</span>[<span class="ruby-value">:database</span>] )
|
229
|
-
<span class="ruby-keyword">end</span>
|
230
217
|
|
231
|
-
<span class="ruby-
|
218
|
+
<span class="ruby-keyword">begin</span>
|
219
|
+
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@conf</span>[<span class="ruby-value">:adapter</span>].<span class="ruby-identifier">downcase</span> <span class="ruby-operator">==</span> <span class="ruby-string">"sqlite3"</span>
|
220
|
+
<span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">establish_connection</span>(<span class="ruby-value">:adapter</span> <span class="ruby-operator">=></span> <span class="ruby-ivar">@conf</span>[<span class="ruby-value">:adapter</span>].<span class="ruby-identifier">downcase</span>,
|
221
|
+
<span class="ruby-value">:database</span> <span class="ruby-operator">=></span> <span class="ruby-ivar">@conf</span>[<span class="ruby-value">:database</span>])
|
222
|
+
<span class="ruby-keyword">else</span>
|
223
|
+
<span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">establish_connection</span>(
|
224
|
+
<span class="ruby-value">:adapter</span> <span class="ruby-operator">=></span> <span class="ruby-ivar">@conf</span>[<span class="ruby-value">:adapter</span>].<span class="ruby-identifier">downcase</span>,
|
225
|
+
<span class="ruby-value">:host</span> <span class="ruby-operator">=></span> <span class="ruby-ivar">@conf</span>[<span class="ruby-value">:host</span>],
|
226
|
+
<span class="ruby-value">:username</span> <span class="ruby-operator">=></span> <span class="ruby-ivar">@conf</span>[<span class="ruby-value">:username</span>],
|
227
|
+
<span class="ruby-value">:password</span> <span class="ruby-operator">=></span> <span class="ruby-ivar">@conf</span>[<span class="ruby-value">:password</span>],
|
228
|
+
<span class="ruby-value">:database</span> <span class="ruby-operator">=></span> <span class="ruby-ivar">@conf</span>[<span class="ruby-value">:database</span>] )
|
229
|
+
<span class="ruby-keyword">end</span>
|
230
|
+
|
231
|
+
<span class="ruby-ivar">@table_name</span> = <span class="ruby-ivar">@conf</span>[<span class="ruby-value">:table</span>]
|
232
|
+
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">RuntimeError</span>, <span class="ruby-constant">AdapterNotFound</span>, <span class="ruby-constant">ArgumentError</span> <span class="ruby-operator">=></span> <span class="ruby-identifier">e</span>
|
233
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">RuntimeError</span>, <span class="ruby-node">"DB Error when configuring connection: #{e}"</span>
|
234
|
+
<span class="ruby-keyword">end</span>
|
232
235
|
<span class="ruby-keyword">end</span></pre>
|
233
236
|
</div>
|
234
237
|
|
@@ -261,8 +264,8 @@ disabling of os/type queries if those fields are not in the configuration</p>
|
|
261
264
|
|
262
265
|
|
263
266
|
<div class="method-source-code" id="load_config-source">
|
264
|
-
<pre><span class="ruby-comment"># File lib/rcmd/db.rb, line
|
265
|
-
<span class="ruby-keyword">def</span> <span class="ruby-constant">DB</span>.<span class="ruby-identifier">load_config</span>
|
267
|
+
<pre><span class="ruby-comment"># File lib/rcmd/db.rb, line 115</span>
|
268
|
+
<span class="ruby-keyword">def</span> <span class="ruby-constant">DB</span>.<span class="ruby-identifier ruby-title">load_config</span>
|
266
269
|
<span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">file?</span>(<span class="ruby-ivar">@config_file</span>)
|
267
270
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">RuntimeError</span>, <span class="ruby-node">"No database configuration file found: #{@config_file}"</span>
|
268
271
|
<span class="ruby-keyword">end</span>
|
@@ -321,14 +324,15 @@ disabling of os/type queries if those fields are not in the configuration</p>
|
|
321
324
|
|
322
325
|
<div class="method-description">
|
323
326
|
|
324
|
-
<p>Method for overiding the location and name of the default config file
|
327
|
+
<p>Method for overiding the location and name of the default config file (Used
|
328
|
+
by RSpec tests)</p>
|
325
329
|
|
326
330
|
|
327
331
|
|
328
332
|
|
329
333
|
<div class="method-source-code" id="override_config_file-source">
|
330
334
|
<pre><span class="ruby-comment"># File lib/rcmd/db.rb, line 74</span>
|
331
|
-
<span class="ruby-keyword">def</span> <span class="ruby-constant">DB</span>.<span class="ruby-identifier">override_config_file</span>(<span class="ruby-identifier">path</span>)
|
335
|
+
<span class="ruby-keyword">def</span> <span class="ruby-constant">DB</span>.<span class="ruby-identifier ruby-title">override_config_file</span>(<span class="ruby-identifier">path</span>)
|
332
336
|
<span class="ruby-ivar">@config_file</span> = <span class="ruby-identifier">path</span>
|
333
337
|
<span class="ruby-keyword">end</span></pre>
|
334
338
|
</div>
|
@@ -360,8 +364,8 @@ disabling of os/type queries if those fields are not in the configuration</p>
|
|
360
364
|
|
361
365
|
|
362
366
|
<div class="method-source-code" id="query_by_hostname-source">
|
363
|
-
<pre><span class="ruby-comment"># File lib/rcmd/db.rb, line
|
364
|
-
<span class="ruby-keyword">def</span> <span class="ruby-constant">DB</span>.<span class="ruby-identifier">query_by_hostname</span>(<span class="ruby-identifier">term</span>)
|
367
|
+
<pre><span class="ruby-comment"># File lib/rcmd/db.rb, line 92</span>
|
368
|
+
<span class="ruby-keyword">def</span> <span class="ruby-constant">DB</span>.<span class="ruby-identifier ruby-title">query_by_hostname</span>(<span class="ruby-identifier">term</span>)
|
365
369
|
<span class="ruby-keyword">return</span> <span class="ruby-identifier">where</span>(<span class="ruby-node">"#{@conf[:host_field]} LIKE ?"</span>, <span class="ruby-identifier">term</span> ).<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> <span class="ruby-identifier">r</span>[<span class="ruby-ivar">@conf</span>[<span class="ruby-value">:host_field</span>]] }
|
366
370
|
<span class="ruby-keyword">end</span></pre>
|
367
371
|
</div>
|
@@ -393,12 +397,12 @@ disabling of os/type queries if those fields are not in the configuration</p>
|
|
393
397
|
|
394
398
|
|
395
399
|
<div class="method-source-code" id="query_by_os-source">
|
396
|
-
<pre><span class="ruby-comment"># File lib/rcmd/db.rb, line
|
397
|
-
<span class="ruby-keyword">def</span> <span class="ruby-constant">DB</span>.<span class="ruby-identifier">query_by_os</span>(<span class="ruby-identifier">term</span>)
|
400
|
+
<pre><span class="ruby-comment"># File lib/rcmd/db.rb, line 97</span>
|
401
|
+
<span class="ruby-keyword">def</span> <span class="ruby-constant">DB</span>.<span class="ruby-identifier ruby-title">query_by_os</span>(<span class="ruby-identifier">term</span>)
|
398
402
|
<span class="ruby-keyword">unless</span> <span class="ruby-ivar">@db_os_queries</span>
|
399
403
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">RuntimeError</span>, <span class="ruby-string">"OS based queries not supported in the configuration supplied"</span>
|
400
404
|
<span class="ruby-keyword">end</span>
|
401
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">where</span>(<span class="ruby-ivar">@conf</span>[<span class="ruby-value">:os_field</span>]
|
405
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">where</span>(<span class="ruby-ivar">@conf</span>[<span class="ruby-value">:os_field</span>] <span class="ruby-operator">=></span> <span class="ruby-identifier">term</span>).<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> <span class="ruby-identifier">r</span>[<span class="ruby-ivar">@conf</span>[<span class="ruby-value">:host_field</span>]] }
|
402
406
|
<span class="ruby-keyword">end</span></pre>
|
403
407
|
</div>
|
404
408
|
|
@@ -429,12 +433,12 @@ disabling of os/type queries if those fields are not in the configuration</p>
|
|
429
433
|
|
430
434
|
|
431
435
|
<div class="method-source-code" id="query_by_type-source">
|
432
|
-
<pre><span class="ruby-comment"># File lib/rcmd/db.rb, line
|
433
|
-
<span class="ruby-keyword">def</span> <span class="ruby-constant">DB</span>.<span class="ruby-identifier">query_by_type</span>(<span class="ruby-identifier">term</span>)
|
436
|
+
<pre><span class="ruby-comment"># File lib/rcmd/db.rb, line 105</span>
|
437
|
+
<span class="ruby-keyword">def</span> <span class="ruby-constant">DB</span>.<span class="ruby-identifier ruby-title">query_by_type</span>(<span class="ruby-identifier">term</span>)
|
434
438
|
<span class="ruby-keyword">unless</span> <span class="ruby-ivar">@db_type_queries</span>
|
435
439
|
<span class="ruby-identifier">raise</span> <span class="ruby-constant">RuntimeError</span>, <span class="ruby-string">"Type queries not supported in the configuration supplied"</span>
|
436
440
|
<span class="ruby-keyword">end</span>
|
437
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">where</span>(<span class="ruby-ivar">@conf</span>[<span class="ruby-value">:type_field</span>]
|
441
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">where</span>(<span class="ruby-ivar">@conf</span>[<span class="ruby-value">:type_field</span>] <span class="ruby-operator">=></span> <span class="ruby-identifier">term</span>).<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> <span class="ruby-identifier">r</span>[<span class="ruby-ivar">@conf</span>[<span class="ruby-value">:host_field</span>]] }
|
438
442
|
<span class="ruby-keyword">end</span></pre>
|
439
443
|
</div>
|
440
444
|
|
@@ -453,8 +457,8 @@ disabling of os/type queries if those fields are not in the configuration</p>
|
|
453
457
|
|
454
458
|
|
455
459
|
<footer id="validator-badges" role="contentinfo">
|
456
|
-
<p><a href="
|
457
|
-
<p>Generated by <a href="https://
|
460
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
461
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.0.1.
|
458
462
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
459
463
|
</footer>
|
460
464
|
|
data/doc/rdocs/created.rid
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
2
|
-
README.md
|
3
|
-
lib/rcmd.rb
|
4
|
-
lib/rcmd/db.rb
|
5
|
-
lib/rcmd/version.rb Sat,
|
6
|
-
exe/rcmd
|
1
|
+
Sat, 05 May 2018 19:44:22 +0000
|
2
|
+
README.md Tue, 10 Oct 2017 20:33:34 +0000
|
3
|
+
lib/rcmd.rb Sat, 05 May 2018 19:37:28 +0000
|
4
|
+
lib/rcmd/db.rb Tue, 10 Oct 2017 20:30:28 +0000
|
5
|
+
lib/rcmd/version.rb Sat, 05 May 2018 19:37:43 +0000
|
6
|
+
exe/rcmd Sat, 05 May 2018 19:36:46 +0000
|
data/doc/rdocs/index.html
CHANGED
@@ -246,26 +246,28 @@ with <em>rake</em>.</p>
|
|
246
246
|
|
247
247
|
<p>Available Rake tasks are:</p>
|
248
248
|
|
249
|
-
<pre class="ruby"><span class="ruby-identifier">rake</span> <span class="ruby-identifier">build</span> <span class="ruby-comment"># Build rcmd-1.
|
249
|
+
<pre class="ruby"><span class="ruby-identifier">rake</span> <span class="ruby-identifier">build</span> <span class="ruby-comment"># Build rcmd-1.6.4.gem into the pkg directory</span>
|
250
250
|
<span class="ruby-identifier">rake</span> <span class="ruby-identifier">clean</span> <span class="ruby-comment"># Remove any temporary products</span>
|
251
251
|
<span class="ruby-identifier">rake</span> <span class="ruby-identifier">clobber</span> <span class="ruby-comment"># Remove any generated files</span>
|
252
252
|
<span class="ruby-identifier">rake</span> <span class="ruby-identifier">clobber_rdoc</span> <span class="ruby-comment"># Remove RDoc HTML files</span>
|
253
253
|
<span class="ruby-identifier">rake</span> <span class="ruby-identifier">console</span> <span class="ruby-comment"># Open an IRB console with this gem loaded</span>
|
254
|
-
<span class="ruby-identifier">rake</span> <span class="ruby-identifier">install</span> <span class="ruby-comment"># Build and install rcmd-1.
|
255
|
-
<span class="ruby-identifier">rake</span> <span class="ruby-
|
254
|
+
<span class="ruby-identifier">rake</span> <span class="ruby-identifier">install</span> <span class="ruby-comment"># Build and install rcmd-1.6.4.gem into system gems</span>
|
255
|
+
<span class="ruby-identifier">rake</span> <span class="ruby-value">install:</span><span class="ruby-identifier">local</span> <span class="ruby-comment"># Build and install rcmd-1.6.4.gem into system gems without network access</span>
|
256
256
|
<span class="ruby-identifier">rake</span> <span class="ruby-identifier">rdoc</span> <span class="ruby-comment"># Build RDoc HTML files</span>
|
257
257
|
<span class="ruby-identifier">rake</span> <span class="ruby-identifier">reinstall</span> <span class="ruby-comment"># Remove, build, and install gem</span>
|
258
|
-
<span class="ruby-identifier">rake</span> <span class="ruby-identifier">release</span>[<span class="ruby-identifier">remote</span>] <span class="ruby-comment"># Create tag v1.
|
258
|
+
<span class="ruby-identifier">rake</span> <span class="ruby-identifier">release</span>[<span class="ruby-identifier">remote</span>] <span class="ruby-comment"># Create tag v1.6.4 and build and push rcmd-1.6.4.gem to Rubygems</span>
|
259
259
|
<span class="ruby-identifier">rake</span> <span class="ruby-identifier">rerdoc</span> <span class="ruby-comment"># Rebuild RDoc HTML files</span>
|
260
|
-
<span class="ruby-identifier">rake</span> <span class="ruby-identifier">
|
260
|
+
<span class="ruby-identifier">rake</span> <span class="ruby-value">test:</span><span class="ruby-identifier">all</span> <span class="ruby-comment"># Run all RSpec tests</span>
|
261
|
+
<span class="ruby-identifier">rake</span> <span class="ruby-value">test:</span><span class="ruby-identifier">db</span> <span class="ruby-comment"># Test Database functionality (sqlite3 required)</span>
|
262
|
+
<span class="ruby-identifier">rake</span> <span class="ruby-value">test:</span><span class="ruby-identifier">mainlib</span> <span class="ruby-comment"># Test main rcmd lib</span>
|
261
263
|
</pre>
|
262
264
|
</main>
|
263
265
|
|
264
266
|
|
265
267
|
|
266
268
|
<footer id="validator-badges" role="contentinfo">
|
267
|
-
<p><a href="
|
268
|
-
<p>Generated by <a href="https://
|
269
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
270
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.0.1.
|
269
271
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
270
272
|
</footer>
|
271
273
|
|
Binary file
|
@@ -1 +1 @@
|
|
1
|
-
var search_data = {"index":{"searchIndex":["optionparser","rcmd","db","create_config()","db_connect()","load_config()","override_config_file()","query_by_hostname()","query_by_os()","query_by_type()","run_command()","readme"],"longSearchIndex":["optionparser","rcmd","rcmd::db","rcmd::db::create_config()","rcmd::db::db_connect()","rcmd::db::load_config()","rcmd::db::override_config_file()","rcmd::db::query_by_hostname()","rcmd::db::query_by_os()","rcmd::db::query_by_type()","rcmd::run_command()",""],"info":[["OptionParser","","OptionParser.html","",""],["Rcmd","","Rcmd.html","","<p>This module is for parellel remote (SSH) execution of a single command\nstring on Multiple hosts.
|
1
|
+
var search_data = {"index":{"searchIndex":["optionparser","rcmd","db","create_config()","db_connect()","load_config()","override_config_file()","query_by_hostname()","query_by_os()","query_by_type()","run_command()","readme"],"longSearchIndex":["optionparser","rcmd","rcmd::db","rcmd::db::create_config()","rcmd::db::db_connect()","rcmd::db::load_config()","rcmd::db::override_config_file()","rcmd::db::query_by_hostname()","rcmd::db::query_by_os()","rcmd::db::query_by_type()","rcmd::run_command()",""],"info":[["OptionParser","","OptionParser.html","",""],["Rcmd","","Rcmd.html","","<p>begin rdoc\n<p>This module is for parellel remote (SSH) execution of a single command\nstring on Multiple hosts. …\n"],["Rcmd::DB","","Rcmd/DB.html","","<p>begin rdoc\n<p>This class provides a middle layer for allowing a database to be queried\nfor hosts. This is …\n"],["create_config","Rcmd::DB","Rcmd/DB.html#method-c-create_config","()","<p>Create a base config file\n"],["db_connect","Rcmd::DB","Rcmd/DB.html#method-c-db_connect","()","<p>Method for establishing a connection to the database backend according to\nthe configuration file. This …\n"],["load_config","Rcmd::DB","Rcmd/DB.html#method-c-load_config","()","<p>Method called by DB.db_connect to load the yaml configuration file and\nperform some basic sanity checks …\n"],["override_config_file","Rcmd::DB","Rcmd/DB.html#method-c-override_config_file","(path)","<p>Method for overiding the location and name of the default config file (Used\nby RSpec tests)\n"],["query_by_hostname","Rcmd::DB","Rcmd/DB.html#method-c-query_by_hostname","(term)","<p>Performs “LIKE” queries on the host_field (hostname)\n"],["query_by_os","Rcmd::DB","Rcmd/DB.html#method-c-query_by_os","(term)","<p>Perform direct 'Hash style' queries on the os_field\n"],["query_by_type","Rcmd::DB","Rcmd/DB.html#method-c-query_by_type","(term)","<p>Perform direct 'Hash style' queries on the type_field\n"],["run_command","Rcmd","Rcmd.html#method-c-run_command","()","<p>Main method for this module which should be called after the correct\nvariables have been set.\n<p>We iterate …\n"],["README","","README_md.html","","<p>Description\n<p>rcmd (remote command) is a command line utility written in Ruby for\nexecuting the same command …\n"]]}}
|
Binary file
|
data/doc/rdocs/js/searcher.js.gz
CHANGED
Binary file
|
@@ -53,9 +53,18 @@
|
|
53
53
|
</li>
|
54
54
|
<li class="module">
|
55
55
|
<a href="Rcmd.html">Rcmd</a>
|
56
|
+
|
57
|
+
<ul>
|
58
|
+
<li><a href="Rcmd.html#label-begin+rdoc">begin rdoc</a>
|
59
|
+
<li><a href="Rcmd.html#label-end">end</a>
|
60
|
+
</ul>
|
56
61
|
</li>
|
57
62
|
<li class="class">
|
58
63
|
<a href="Rcmd/DB.html">Rcmd::DB</a>
|
64
|
+
|
65
|
+
<ul>
|
66
|
+
<li><a href="Rcmd/DB.html#label-begin+rdoc">begin rdoc</a>
|
67
|
+
</ul>
|
59
68
|
</li>
|
60
69
|
</ul>
|
61
70
|
|
@@ -106,8 +115,8 @@
|
|
106
115
|
|
107
116
|
|
108
117
|
<footer id="validator-badges" role="contentinfo">
|
109
|
-
<p><a href="
|
110
|
-
<p>Generated by <a href="https://
|
118
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
119
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.0.1.
|
111
120
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
112
121
|
</footer>
|
113
122
|
|
data/exe/rcmd
CHANGED
@@ -19,7 +19,7 @@ require 'rcmd'
|
|
19
19
|
options = { :threads => 4, :nodes => nil, :environment => nil, :user => 'root', :password => false,
|
20
20
|
:command => nil, :quiet => false, :version => false, :debug => false, :expression => nil,
|
21
21
|
:database => false, :config => false, :type => nil, :host => nil, :os => nil ,
|
22
|
-
:
|
22
|
+
:hosts_file => File.expand_path('~/.ssh/known_hosts'), :keys_only => false }
|
23
23
|
|
24
24
|
host_list = []
|
25
25
|
|
@@ -34,7 +34,6 @@ opts.on('-c <command>', '--command <command>', String, "Quoted string containing
|
|
34
34
|
opts.on('-q', '--quiet', "Suppress stdout of commands. stderr will still be displayed") { |v| options[:quiet] = v }
|
35
35
|
opts.on('-v', '--version', "Print what version of the command is in use") { |v| options[:version] = v}
|
36
36
|
opts.on('-D', '--debug', "Print debug information") { |v| options[:debug] = v }
|
37
|
-
opts.on('--timeout Seconds', Integer, "Number of seconds to wait before timeing out the session") { |v| options[:timeout] = v }
|
38
37
|
opts.on('--hosts-file FILE', String, "Filename to use as the SSH hosts file (known_hosts)") { |v| options[:hosts_file] = File.file?(File.expand_path(v)) ? File.expand_path(v) : File.expand_path('~/.ssh/known_hosts') }
|
39
38
|
opts.on('--keys_only', "Use only ssh keys for authentication. (No Passwords)") { |v| options[:keys_only] = v }
|
40
39
|
opts.separator " "
|
@@ -128,7 +127,6 @@ Rcmd.user= options[:user]
|
|
128
127
|
Rcmd.quiet= options[:quiet]
|
129
128
|
Rcmd.command= options[:command]
|
130
129
|
Rcmd.debug= options[:debug]
|
131
|
-
Rcmd.timeout = options[:timeout]
|
132
130
|
Rcmd.keys_only = options[:keys_only]
|
133
131
|
Rcmd.hosts_file = options[:host_file]
|
134
132
|
|
data/lib/rcmd.rb
CHANGED
@@ -46,9 +46,6 @@ Self class for setting up accessors
|
|
46
46
|
# Boolean for using only ssh-keys or not
|
47
47
|
attr_accessor :keys_only
|
48
48
|
|
49
|
-
# Integer for ssh sesison timeout value
|
50
|
-
attr_accessor :timeout
|
51
|
-
|
52
49
|
# String fo path to user_known_hosts_file
|
53
50
|
attr_accessor :hosts_file
|
54
51
|
end
|
@@ -104,7 +101,7 @@ Self class for setting up accessors
|
|
104
101
|
num_threads.times do |i|
|
105
102
|
@threads[i] = Thread.new {
|
106
103
|
begin
|
107
|
-
conn_options = { :user => @user, :host => @queue.pop, :password => nil, :quiet => @quiet, :debug => @debug, :
|
104
|
+
conn_options = { :user => @user, :host => @queue.pop, :password => nil, :quiet => @quiet, :debug => @debug, :keys_only => @keys_only, :user_known_hosts_file => @hosts_file}
|
108
105
|
STDERR.print "DEBUG :: Connecting to #{conn_options[:host]}\n" if conn_options[:debug]
|
109
106
|
Net::SSH.start(conn_options[:host], conn_options[:user], :password => conn_options[:passwd]) do |session|
|
110
107
|
# Open channel for input/output control
|
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.6.
|
4
|
+
version: 1.6.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Rose
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ssh
|