module Percheron::Unit::ImageHelper

Public Instance Methods

image_exists?() click to toggle source
# File lib/percheron/unit/image_helper.rb, line 28
def image_exists?
  image.nil? ? false : true
end
image_name() click to toggle source
# File lib/percheron/unit/image_helper.rb, line 4
def image_name
  '%s:%s' % [ image_repo, image_version.to_s ] if image_repo && image_version
end
image_repo() click to toggle source
# File lib/percheron/unit/image_helper.rb, line 8
def image_repo
  if !buildable?
    unit_config.docker_image.split(':')[0]
  elsif pseudo?
    pseudo_full_name
  else
    full_name
  end
end
image_size() click to toggle source
# File lib/percheron/unit/image_helper.rb, line 32
def image_size
  image.nil? ? nil : '%s MB' % [ image.info['VirtualSize'] / 1_048_576 ]
end
image_version() click to toggle source
# File lib/percheron/unit/image_helper.rb, line 18
def image_version
  if buildable?
    unit_config.version
  elsif !unit_config.docker_image.nil?
    unit_config.docker_image.split(':')[1] || 'latest'
  else
    fail Errors::UnitInvalid, 'Cannot determine image version'
  end
end