Sha256: a7d19090f8874e2602bc883646a67781aa28976d19967726b20e890418b5c19e

Contents?: true

Size: 1.01 KB

Versions: 21

Compression:

Stored size: 1.01 KB

Contents

require 'rundock/hook/base'

module Rundock
  module Hook
    # 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
    # ---
    class File < Base
      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.formatted_message)
        end
        file.close
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
rundock-1.2.1 lib/rundock/plugin/hook/file.rb
rundock-1.2.0 lib/rundock/plugin/hook/file.rb
rundock-1.1.7 lib/rundock/plugin/hook/file.rb
rundock-1.1.6 lib/rundock/plugin/hook/file.rb
rundock-1.1.5 lib/rundock/plugin/hook/file.rb
rundock-1.1.4 lib/rundock/plugin/hook/file.rb
rundock-1.1.3 lib/rundock/plugin/hook/file.rb
rundock-1.1.2 lib/rundock/plugin/hook/file.rb
rundock-1.1.1 lib/rundock/plugin/hook/file.rb
rundock-1.1.0 lib/rundock/plugin/hook/file.rb
rundock-1.0.8 lib/rundock/plugin/hook/file.rb
rundock-1.0.7 lib/rundock/plugin/hook/file.rb
rundock-1.0.6 lib/rundock/plugin/hook/file.rb
rundock-1.0.5 lib/rundock/plugin/hook/file.rb
rundock-1.0.4 lib/rundock/plugin/hook/file.rb
rundock-1.0.2 lib/rundock/plugin/hook/file.rb
rundock-1.0.1 lib/rundock/plugin/hook/file.rb
rundock-1.0.0 lib/rundock/plugin/hook/file.rb
rundock-0.5.8 lib/rundock/plugin/hook/file.rb
rundock-0.5.7 lib/rundock/plugin/hook/file.rb