module DbSucker::Application::Container::Accessors

Public Instance Methods

ctn() click to toggle source
# File lib/db_sucker/application/container/accessors.rb, line 5
def ctn
  self
end
integrity?() click to toggle source
# File lib/db_sucker/application/container/accessors.rb, line 34
def integrity?
  !!integrity_sha
end
integrity_binary() click to toggle source
# File lib/db_sucker/application/container/accessors.rb, line 26
def integrity_binary
  (source["integrity_binary"].nil? ? "shasum -ba" : source["integrity_binary"]).presence
end
integrity_sha() click to toggle source
# File lib/db_sucker/application/container/accessors.rb, line 30
def integrity_sha
  source["integrity_sha"].nil? ? 512 : source["integrity_sha"]
end
source() click to toggle source
# File lib/db_sucker/application/container/accessors.rb, line 9
def source
  ctn.data["source"]
end
ssh_key_files() click to toggle source
# File lib/db_sucker/application/container/accessors.rb, line 38
def ssh_key_files
  @ssh_key_files ||= begin
    files = [*data["source"]["ssh"]["keyfile"]].reject(&:blank?).map do |f|
      if f.start_with?("~")
        Pathname.new(File.expand_path(f))
      else
        Pathname.new(File.dirname(src)).join(f)
      end
    end
    files.each do |f|
      begin
        File.open(f)
      rescue Errno::ENOENT
        warning("SSH identity file `#{f}' for identifier `#{name}' does not exist! (in `#{src}')")
      end
    end
    files
  end
end
tmp_path() click to toggle source
# File lib/db_sucker/application/container/accessors.rb, line 13
def tmp_path
  source["ssh"]["tmp_location"].presence || "/tmp/db_sucker_tmp"
end
variation(v) click to toggle source
# File lib/db_sucker/application/container/accessors.rb, line 21
def variation v
  return unless vd = data["variations"][v]
  Variation.new(self, v, vd)
end
variations() click to toggle source
# File lib/db_sucker/application/container/accessors.rb, line 17
def variations
  Hash[data["variations"].keys.map{|id| [id, variation(id)] }]
end