class Rundock::Builder::DefaultSshBuilder

Constants

HOME_SSH_OPTIONS_DEFAULT_FILE_PATH
PRESET_SSH_OPTIONS_DEFAULT_FILE_PATH
PRESET_SSH_OPTIONS_DEFAULT_ROOT
RUNDOCK_PACKAGE_PATH

Public Class Methods

new(options) click to toggle source
Calls superclass method Rundock::Builder::Base::new
# File lib/rundock/builder/default_ssh_builder.rb, line 11
def initialize(options)
  super(options)
end

Public Instance Methods

build() click to toggle source
# File lib/rundock/builder/default_ssh_builder.rb, line 15
def build
  opts = {}

  def_ssh_file = if @options[:default_ssh_opts] && FileTest.exist?(@options[:default_ssh_opts])
                   @options[:default_ssh_opts]
                 elsif FileTest.exist?(HOME_SSH_OPTIONS_DEFAULT_FILE_PATH)
                   HOME_SSH_OPTIONS_DEFAULT_FILE_PATH
                 else
                   PRESET_SSH_OPTIONS_DEFAULT_FILE_PATH
                 end

  File.open(def_ssh_file) do |f|
    YAML.load_stream(f) do |y|
      y.each do |k, v|
        opts["#{k}_ssh_default".to_sym] = v
      end
    end
  end

  opts
end