class Rundock::Operation::Base
Constants
- OperationNotImplementedError
Attributes
attributes[R]
instruction[R]
Public Class Methods
new(instruction, attributes)
click to toggle source
# File lib/rundock/operation/base.rb, line 9 def initialize(instruction, attributes) @instruction = instruction @attributes = attributes @attributes = {} unless attributes end
Public Instance Methods
assign_args(src, args)
click to toggle source
# File lib/rundock/operation/base.rb, line 25 def assign_args(src, args) return src unless args src.gsub(/\$#/, args.length.to_s) .gsub(/\$@/, args.join(' ')) .gsub(/\$[1-9]/) { |arg_n| args[arg_n.chars[1..-1].join.to_i - 1] } .gsub(/(\$\{)(\w+)(\})/) { ENV[Regexp.last_match(2)] } end
logging(message, severity)
click to toggle source
# File lib/rundock/operation/base.rb, line 19 def logging(message, severity) h_host = @attributes[:nodename].just(' ', 15) h_ope = "start #{self.class.to_s.split('::').last.downcase}:" Logger.send(severity.to_sym, "#{h_host} #{h_ope} #{message}") end
run(backend, attributes = {})
click to toggle source
# File lib/rundock/operation/base.rb, line 15 def run(backend, attributes = {}) raise OperationNotImplementedError end