class Sle2Docker::Image

This class is the base class of native and prebulid images for SUSE Linux Enterprise

Attributes

image_id[R]

Public Instance Methods

activated?() click to toggle source
# File lib/sle2docker/image.rb, line 7
def activated?
  Docker::Image.exist?(image_id)
end
check_image_exists() click to toggle source
# File lib/sle2docker/image.rb, line 36
def check_image_exists
  msg = "Cannot find pre-built image #{@image_name}"
  raise(ImageNotFoundError, msg) unless File.exist? File.join(
    self.class::IMAGES_DIR, "#{@image_name}.tar.xz"
  )
end
rpm_package_name() click to toggle source
# File lib/sle2docker/image.rb, line 24
def rpm_package_name
  image_file = File.join(self.class::IMAGES_DIR, "#{@image_name}.tar.xz")
  package_name = `rpm -qf #{image_file}`
  if $CHILD_STATUS.exitstatus.nonzero?
    raise(
      ImageVerificationError,
      "Cannot find rpm package providing #{file}: #{package_name}"
    )
  end
  package_name
end
verify_image() click to toggle source
# File lib/sle2docker/image.rb, line 11
def verify_image
  check_image_exists

  puts 'Verifying integrity of the pre-built image'
  package_name = rpm_package_name
  verification = `rpm --verify #{package_name}`
  if $CHILD_STATUS.exitstatus.nonzero?
    raise(ImageVerificationError,
          "Verification of #{package_name} failed: #{verification}")
  end
  true
end