Class: Rundock::Hook::File
Overview
You can use this sample as following yaml files for example.
- hook.yml
-
major_log:
hook_type: file filepath: /var/log/rundock.log
minor_log:
hook_type: file filepath: /tmp/rundock.log
- scenario.yml
-
node: anyhost-01
command:
- 'rm -f /tmp/aaa'
hook:
- major_log - minor_log
-
node: localhost
command:
- 'echo aaa > /tmp/abc'
hook: all
anyhost-01:
host: 192.168.1.11 ssh_opts: port: 22 user: anyuser key: ~/.ssh/id_rsa
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Rundock::Hook::Base
Instance Method Details
#hook(operation_attributes, log_buffer) ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/rundock/plugin/hook/file.rb', line 35 def hook(operation_attributes, log_buffer) file = ::File.open(@contents[:filepath], 'w') file.puts("[hookname:#{@name} node:#{operation_attributes[0][:nodename]}]") log_buffer.each do |log| file.puts(log.) end file.close end |