Permalink
Browse files

white space tweak

  • Loading branch information...
ripienaar committed Jun 5, 2012
1 parent 61c7f61 commit a552b7acf03ea401a3345e502b1b66cace2dd4ba
Showing with 59 additions and 59 deletions.
  1. +59 −59 agent/rndc/agent/rndc.rb
View
@@ -1,77 +1,77 @@
module MCollective
- module Agent
- class Rndc<RPC::Agent
- metadata :name => "rndc",
- :description => "SimpleRPC RNDC Agent",
- :author => "R.I.Pienaar <rip@devco.net>",
- :license => "ASL2.0",
- :version => "0.2",
- :url => "http://www.devco.net/",
- :timeout => 5
+ module Agent
+ class Rndc<RPC::Agent
+ metadata :name => "rndc",
+ :description => "SimpleRPC RNDC Agent",
+ :author => "R.I.Pienaar <rip@devco.net>",
+ :license => "ASL2.0",
+ :version => "0.2",
+ :url => "http://www.devco.net/",
+ :timeout => 5
- def startup_hook
- @rndc = "/usr/sbin/rndc"
- end
+ def startup_hook
+ @rndc = "/usr/sbin/rndc"
+ end
- ["reload", "freeze", "thaw"].each do |cmd|
- action cmd do
- optional_zone_command(cmd)
- end
- end
+ ["reload", "freeze", "thaw"].each do |cmd|
+ action cmd do
+ optional_zone_command(cmd)
+ end
+ end
- ["refresh", "retransfer", "notify", "sign"].each do |cmd|
- action cmd do
- zone_command(cmd)
- end
- end
+ ["refresh", "retransfer", "notify", "sign"].each do |cmd|
+ action cmd do
+ zone_command(cmd)
+ end
+ end
- ["reconfig", "querylog", "flush"].each do |cmd|
- action cmd do
- rndc(cmd)
- end
- end
+ ["reconfig", "querylog", "flush"].each do |cmd|
+ action cmd do
+ rndc(cmd)
+ end
+ end
- action "status" do
- out = ""
- err = ""
+ action "status" do
+ out = ""
+ err = ""
- ret = run("#{@rndc} status", :stdout => out, :err => err, :chomp => true)
+ ret = run("#{@rndc} status", :stdout => out, :err => err, :chomp => true)
- reply.fail! "Failed to get rndc status: #{err}" if ret > 0
+ reply.fail! "Failed to get rndc status: #{err}" if ret > 0
- out.lines.each do |line|
- if line =~ /^(.+?): (.+)/
- val = $2
- var = $1.gsub(" ", "_").downcase.to_sym
- reply[var] = val
- end
- end
- end
+ out.lines.each do |line|
+ if line =~ /^(.+?): (.+)/
+ val = $2
+ var = $1.gsub(" ", "_").downcase.to_sym
+ reply[var] = val
+ end
+ end
+ end
- private
- def zone_command(command)
- validate :zone, :shellsafe
+ private
+ def zone_command(command)
+ validate :zone, :shellsafe
- rndc(command, request[:zone])
- end
+ rndc(command, request[:zone])
+ end
- def optional_zone_command(command)
- if request.include?(:zone)
- zone_command(command)
- else
- rndc(command)
- end
- end
+ def optional_zone_command(command)
+ if request.include?(:zone)
+ zone_command(command)
+ else
+ rndc(command)
+ end
+ end
- def rndc(command, options=nil)
- cmd = [@rndc, command, options].flatten.compact.join(" ")
+ def rndc(command, options=nil)
+ cmd = [@rndc, command, options].flatten.compact.join(" ")
- Log.info("Running #{cmd}")
+ Log.info("Running #{cmd}")
- status = run(cmd, :stdout => :out, :stderr => :err, :chomp => true)
+ status = run(cmd, :stdout => :out, :stderr => :err, :chomp => true)
- reply.fail! "#{cmd} returned #{status}" if status > 0
- end
- end
+ reply.fail! "#{cmd} returned #{status}" if status > 0
+ end
end
+ end
end

0 comments on commit a552b7a

Please sign in to comment.