From 25813dd0e4a46af5bc4a41d628c6c349cf55fba5 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Tue, 29 Sep 2015 07:18:34 +0100 Subject: add default value of 1 for parallelization --- README.md | 2 +- rubyfy.rb | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 109e876..c762a0b 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Example usage: ``` cat serverlist.txt | ./rubyfy -p 10 -c 'hostname' -./rubyfy -p 1 -c 'hostname' <<< foo.example.com +./rubyfy --root --command 'id' <<< foo.example.com ``` diff --git a/rubyfy.rb b/rubyfy.rb index 0548dd0..f9a7180 100755 --- a/rubyfy.rb +++ b/rubyfy.rb @@ -18,6 +18,8 @@ class Rubyfy @args[opt] = arg end + @args["--parallel"] = 1 unless @args["--parallel"] + log(:DEBUG, @args) if @args["--debug"] end @@ -65,13 +67,6 @@ class Rubyfy private - def log(severity, message) - return if severity == :VERBOSE and not @args["--verbose"] - @log_mutex.synchronize do - puts "#{severity}::#{message}" - end - end - def run_command(server, command="uptime", root=false, user=ENV["USER"]) log(:VERBOSE,"#{server}::Connecting") sudo = root ? "sudo " : "" @@ -103,6 +98,13 @@ private http = Net::HTTP.new(uri.host, uri.port) http.request(req).body end + + def log(severity, message) + return if severity == :VERBOSE and not @args["--verbose"] + @log_mutex.synchronize do + puts "#{severity}::#{message}" + end + end end begin -- cgit v1.2.3