diff options
Diffstat (limited to 'lib/oxidized')
-rw-r--r-- | lib/oxidized/input/ssh.rb | 6 | ||||
-rw-r--r-- | lib/oxidized/node.rb | 1 | ||||
-rw-r--r-- | lib/oxidized/source/csv.rb | 4 | ||||
-rw-r--r-- | lib/oxidized/source/http.rb | 4 | ||||
-rw-r--r-- | lib/oxidized/worker.rb | 1 |
5 files changed, 7 insertions, 9 deletions
diff --git a/lib/oxidized/input/ssh.rb b/lib/oxidized/input/ssh.rb index 82335f9..01f7063 100644 --- a/lib/oxidized/input/ssh.rb +++ b/lib/oxidized/input/ssh.rb @@ -24,7 +24,7 @@ module Oxidized @log = File.open(Oxidized::Config::Log + "/#{@node.ip}-ssh", 'w') if Oxidized.config.input.debug? Oxidized.logger.debug "lib/oxidized/input/ssh.rb: Connecting to #{@node.name}" - @ssh = Net::SSH.start(@node.ip, @node.auth[:username], get_ssh_opts) + @ssh = Net::SSH.start(@node.ip, @node.auth[:username], make_ssh_opts) unless @exec shell_open @ssh begin @@ -117,13 +117,13 @@ module Oxidized end end - def get_ssh_opts + def make_ssh_opts ssh_opts = { port: (vars(:ssh_port) || 22).to_i, paranoid: secure, keepalive: true, password: @node.auth[:password], timeout: Oxidized.config.timeout, - number_of_password_prompts: 0 + number_of_password_prompts: 0 } auth_methods = vars(:auth_methods) || %w(none publickey password) diff --git a/lib/oxidized/node.rb b/lib/oxidized/node.rb index bc1a586..c3a6885 100644 --- a/lib/oxidized/node.rb +++ b/lib/oxidized/node.rb @@ -228,6 +228,5 @@ module Oxidized return nil unless type[0..2] == "git" type end - end end diff --git a/lib/oxidized/source/csv.rb b/lib/oxidized/source/csv.rb index 769b1f7..5b43352 100644 --- a/lib/oxidized/source/csv.rb +++ b/lib/oxidized/source/csv.rb @@ -20,7 +20,7 @@ module Oxidized def load _node_want = nil nodes = [] - get_file.each_line do |line| + open_file.each_line do |line| next if line.match(/^\s*#/) data = line.chomp.split(@cfg.delimiter, -1) next if data.empty? @@ -45,7 +45,7 @@ module Oxidized private - def get_file + def open_file file = File.expand_path(@cfg.file) if @cfg.gpg? crypto = GPGME::Crypto.new password: @cfg.gpg_password diff --git a/lib/oxidized/source/http.rb b/lib/oxidized/source/http.rb index 36fa764..26c9e05 100644 --- a/lib/oxidized/source/http.rb +++ b/lib/oxidized/source/http.rb @@ -17,7 +17,7 @@ module Oxidized def load node_want = nil nodes = [] - data = JSON.parse(get_http) + data = JSON.parse(read_http(node_want)) data = string_navigate(data, @cfg.hosts_location) if @cfg.hosts_location? data.each do |node| next if node.empty? @@ -52,7 +52,7 @@ module Oxidized object end - def get_http + def read_http node_want uri = URI.parse(@cfg.url) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true if uri.scheme == 'https' diff --git a/lib/oxidized/worker.rb b/lib/oxidized/worker.rb index 06e8689..4b9614b 100644 --- a/lib/oxidized/worker.rb +++ b/lib/oxidized/worker.rb @@ -36,7 +36,6 @@ module Oxidized Oxidized.logger.debug("lib/oxidized/worker.rb: #{@jobs.size} jobs running in parallel") unless @jobs.empty? end - def process job node = job.node node.last = job |