Class: TtlAuto::Exe
- Inherits:
-
Object
- Object
- TtlAuto::Exe
- Defined in:
- lib/ttlauto/exe.rb
Constant Summary
Constants included from Log
Constants included from Constant
Constant::OUT, Constant::PEM, Constant::TEMPLATE
Instance Attribute Summary collapse
-
#command_templates ⇒ Object
readonly
Returns the value of attribute command_templates.
-
#yaml ⇒ Object
readonly
Returns the value of attribute yaml.
Instance Method Summary collapse
-
#initialize(file, templates = nil) ⇒ Exe
constructor
A new instance of Exe.
- #ping ⇒ Object
- #run ⇒ Object
Methods included from Log
#log_debug, #log_error, #log_info
Constructor Details
#initialize(file, templates = nil) ⇒ Exe
Returns a new instance of Exe.
7 8 9 10 11 12 13 14 15 |
# File 'lib/ttlauto/exe.rb', line 7 def initialize file, templates=nil @yaml = TtlAuto::Yaml.new @yaml.read file @yaml.set_categories unless templates.nil? yml = TtlAuto::Yaml.new @command_templates = yml.read templates end end |
Instance Attribute Details
#command_templates ⇒ Object (readonly)
Returns the value of attribute command_templates.
6 7 8 |
# File 'lib/ttlauto/exe.rb', line 6 def command_templates @command_templates end |
#yaml ⇒ Object (readonly)
Returns the value of attribute yaml.
6 7 8 |
# File 'lib/ttlauto/exe.rb', line 6 def yaml @yaml end |
Instance Method Details
#ping ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/ttlauto/exe.rb', line 23 def ping return_code = 0 server_list.each do |server| tcp = TtlAuto::Ping.new( server ) if tcp.scan? log_info "#{server[:server]}:#{server[:port]} is enable to connect" else log_error "!!! #{server[:server]}:#{server[:port]} is NOT enable to connect !!!" return_code = 1 end end return_code end |
#run ⇒ Object
17 18 19 20 21 |
# File 'lib/ttlauto/exe.rb', line 17 def run @yaml.records.each do |record| run_each_parents record end end |