rcmd 1.6.6 → 1.6.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/Gemfile.lock +1 -1
- data/exe/rcmd +6 -1
- data/lib/rcmd.rb +4 -1
- 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: 7abff8dc6abdc50af46ddb4260bc59e068383d4e6e51edb0ce3e981bbd1d37a3
|
4
|
+
data.tar.gz: e0f7a6d2c1f0aefab14b060078020e508f3e3684d5007c62aed910637be05f82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5298eec2aaba9b3bc402a61e9db1bdaec8f65eef01d7683415e9392c68fe1cda16741dc679892f4d76fa42e43e4ee8d8bd0219ddf136eba8fe556df64bc2cdd1
|
7
|
+
data.tar.gz: 0d0a28530baa4dcb63f397049aac78fbc4eb60b140e28e432e552c59edd4a6a017b5be4d3f2e279edf3f207591996f0611b6e16d4bbea725f0f8159aa65ee8a7
|
data/Gemfile.lock
CHANGED
data/exe/rcmd
CHANGED
@@ -19,7 +19,8 @@ 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
|
-
:hosts_file => File.expand_path('~/.ssh/known_hosts'), :keys_only => false
|
22
|
+
:hosts_file => File.expand_path('~/.ssh/known_hosts'), :keys_only => false,
|
23
|
+
:key_file => Dir["#{File.expand_path('~/.ssh')}/**"].map { |f| f if File.open(f, 'r').readline.include?('PRIVATE') }.compact }
|
23
24
|
|
24
25
|
host_list = []
|
25
26
|
|
@@ -30,6 +31,7 @@ opts.on('-u username', '--username username', String, "Username for SSH connecti
|
|
30
31
|
opts.on('-n nodes', '--nodes x,y,z', Array, "Comma seperated list of nodes. use '-' for a space seperated list piped from another command") { |v| options[:nodes] = v }
|
31
32
|
opts.on('-r regex', '--regexp regex', Regexp, "Use Regex to build host list (ruby regexp)") { |v| options[:expression] = v}
|
32
33
|
opts.on('-t threads', '--threads threads', Integer, "Number of threads to run") { |v| options[:threads] = v }
|
34
|
+
opts.on('-k keyfile', '--keyfile keyfile', String, "Keyfile to use for the connections") { |v| options[:key_file] = v }
|
33
35
|
opts.on('-c <command>', '--command <command>', String, "Quoted string containing the command to be run") { |v| options[:command] = v }
|
34
36
|
opts.on('-q', '--quiet', "Suppress stdout of commands. stderr will still be displayed") { |v| options[:quiet] = v }
|
35
37
|
opts.on('-v', '--version', "Print what version of the command is in use") { |v| options[:version] = v}
|
@@ -43,6 +45,8 @@ opts.on('-T server-type ', '--type server-type', "Database query on server type"
|
|
43
45
|
opts.on('-H hostname-pattern', '--host hostname-pattern', "Database query on hostname (sql like query)") { |v| options[:host] = v}
|
44
46
|
opts.on('-O operating-system', '--os operating-system', "Database query on Operating System string") { |v| options[:os] = v}
|
45
47
|
|
48
|
+
|
49
|
+
|
46
50
|
# Process options
|
47
51
|
begin
|
48
52
|
opts.parse!(ARGV)
|
@@ -129,6 +133,7 @@ Rcmd.command= options[:command]
|
|
129
133
|
Rcmd.debug= options[:debug]
|
130
134
|
Rcmd.keys_only = options[:keys_only]
|
131
135
|
Rcmd.hosts_file = options[:host_file]
|
136
|
+
Rcmd.key_file = options[:key_file]
|
132
137
|
|
133
138
|
# Execute command on provided hosts
|
134
139
|
Rcmd.run_command
|
data/lib/rcmd.rb
CHANGED
@@ -48,6 +48,9 @@ Self class for setting up accessors
|
|
48
48
|
|
49
49
|
# String fo path to user_known_hosts_file
|
50
50
|
attr_accessor :hosts_file
|
51
|
+
|
52
|
+
# Array of key_file(s) to use
|
53
|
+
attr_accessor :key_file
|
51
54
|
end
|
52
55
|
|
53
56
|
# Main method for this module which should be called after the correct variables have been set.
|
@@ -101,7 +104,7 @@ Self class for setting up accessors
|
|
101
104
|
num_threads.times do |i|
|
102
105
|
@threads[i] = Thread.new {
|
103
106
|
begin
|
104
|
-
conn_options = { :user => @user, :host => @queue.pop, :password => nil, :quiet => @quiet, :debug => @debug, :keys_only => @keys_only, :user_known_hosts_file => @hosts_file}
|
107
|
+
conn_options = { :user => @user, :host => @queue.pop, :password => nil, :quiet => @quiet, :debug => @debug, :keys_only => @keys_only, :user_known_hosts_file => @hosts_file, :keys => @key_file}
|
105
108
|
STDERR.print "DEBUG :: Connecting to #{conn_options[:host]}\n" if conn_options[:debug]
|
106
109
|
Net::SSH.start(conn_options[:host], conn_options[:user], :password => conn_options[:passwd]) do |session|
|
107
110
|
# 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.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: 2018-05-
|
11
|
+
date: 2018-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ssh
|