Class: ScoutAgent::Assignment::Configuration

Inherits:
ScoutAgent::Assignment show all
Defined in:
lib/scout_agent/assignment/configuration.rb

Overview

Invoke with:

scout_agent config

This command shows the current configuration of the agent mainly determined by reading the configuration file. However, you can pass command-line switches when running this command to see how they change things and help you find a good setup for other commands.

Instance Attribute Summary

Attributes inherited from ScoutAgent::Assignment

#group, #other_args, #switches, #user

Instance Method Summary collapse

Methods inherited from ScoutAgent::Assignment

choose_group, choose_user, #initialize, plan, #prepare_and_execute

Methods included from Tracked

#clear_status, #force_status_database_reload, #status, #status_database, #status_log

Constructor Details

This class inherits a constructor from ScoutAgent::Assignment

Instance Method Details

#executeObject

Runs the configuration command.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/scout_agent/assignment/configuration.rb', line 18

def execute
  puts "Configuration"
  puts "============="
  puts 
  settings = [:agent_key] + Plan.defaults.map { |name, _| name }
  size     = settings.map { |name| name.to_s.size }.max
  settings.each do |name|
    value = case v = Plan.send(name)
            when Pathname
              if name.to_s =~ /\Aos_/
                v.relative_path_from(Plan.prefix_path).to_s.inspect
              else
                v.to_s.inspect
              end
            when Array
              "%w[#{v.join(' ')}]"
            else
              v.inspect
            end
    puts "config.%-#{size}s = %s" % [name, value]
  end
end