module Bosh::Stemcell

rubocop:disable MethodLength

Constants

VERSION

Public Instance Methods

base_directory() click to toggle source
# File lib/bosh/stemcell/build_environment.rb, line 205
def base_directory
  File.join('/mnt', 'stemcells', infrastructure.name, infrastructure.hypervisor, operating_system.name)
end
bosh_micro_options() click to toggle source
# File lib/bosh/stemcell/builder_options.rb, line 74
def bosh_micro_options
  {
    'bosh_micro_enabled' => environment.fetch('BOSH_MICRO_ENABLED', 'yes'),
    'bosh_micro_package_compiler_path' => File.join(source_root, 'bosh-release'),
    'bosh_micro_manifest_yml_path' => File.join(source_root, 'release', 'micro', "#{infrastructure.name}.yml"),
    'bosh_micro_release_tgz_path' => bosh_micro_release_tgz_path,
  }
end
build_root() click to toggle source
# File lib/bosh/stemcell/build_environment.rb, line 209
def build_root
  File.join(base_directory, 'build')
end
copy_stemcell_builder_to_build_path() click to toggle source
# File lib/bosh/stemcell/build_environment.rb, line 142
def copy_stemcell_builder_to_build_path
  FileUtils.cp_r(Dir.glob("#{STEMCELL_BUILDER_SOURCE_DIR}/*"), build_path, preserve: true, verbose: true)
end
environment_variables() click to toggle source
# File lib/bosh/stemcell/builder_options.rb, line 65
def environment_variables
  {
    'UBUNTU_ISO' => environment['UBUNTU_ISO'],
    'UBUNTU_MIRROR' => environment['UBUNTU_MIRROR'],
    'RHN_USERNAME' => environment['RHN_USERNAME'],
    'RHN_PASSWORD' => environment['RHN_PASSWORD'],
  }
end
exclude_arch_exclusions() click to toggle source
# File lib/bosh/stemcell/build_environment.rb, line 185
def exclude_arch_exclusions
  if Bosh::Stemcell::Arch.ppc64le?
    ' --tag ~exclude_on_ppc64le'
  else
    ''
  end
end
exclude_exclusions() click to toggle source
# File lib/bosh/stemcell/build_environment.rb, line 159
def exclude_exclusions
  [
  case infrastructure.name
  when 'vsphere'
    ' --tag ~exclude_on_vsphere'
  when 'vcloud'
    ' --tag ~exclude_on_vcloud'
  when 'warden'
    ' --tag ~exclude_on_warden'
  when 'aws'
    ' --tag ~exclude_on_aws'
  when 'openstack'
    ' --tag ~exclude_on_openstack'
  when 'azure'
    ' --tag ~exclude_on_azure'
  when 'softlayer'
    ' --tag ~exclude_on_softlayer'
  when 'google'
    ' --tag ~exclude_on_google'
  else
    ''
  end,
  exclude_arch_exclusions.strip
  ].join(' ').rstrip
end
hash_as_bash_env(env) click to toggle source
# File lib/bosh/stemcell/build_environment.rb, line 223
def hash_as_bash_env(env)
  env.map { |k, v| "#{k}='#{v}'" }.join(' ')
end
image_file_path() click to toggle source
# File lib/bosh/stemcell/build_environment.rb, line 193
def image_file_path
  File.join(work_path, settings['stemcell_image_name'])
end
image_mount_point() click to toggle source
# File lib/bosh/stemcell/build_environment.rb, line 197
def image_mount_point
  File.join(work_path, 'mnt')
end
operating_system_spec_name() click to toggle source
# File lib/bosh/stemcell/build_environment.rb, line 129
def operating_system_spec_name
  "#{operating_system.name}_#{operating_system.version}"
end
persist_settings_for_bash() click to toggle source
# File lib/bosh/stemcell/build_environment.rb, line 150
def persist_settings_for_bash
  File.open(settings_path, 'a') do |f|
    f.printf("\n# %s\n\n", '=' * 20)
    settings.each do |k, v|
      f.print "#{k}=#{v}\n"
    end
  end
end
prepare_build_path() click to toggle source
# File lib/bosh/stemcell/build_environment.rb, line 133
def prepare_build_path
  FileUtils.rm_rf(build_path, verbose: true) if File.exist?(build_path)
  FileUtils.mkdir_p(build_path, verbose: true)
end
prepare_stemcell_path() click to toggle source
# File lib/bosh/stemcell/build_environment.rb, line 138
def prepare_stemcell_path
  FileUtils.mkdir_p(File.join(work_path, 'stemcell'))
end
prepare_work_root() click to toggle source
# File lib/bosh/stemcell/build_environment.rb, line 146
def prepare_work_root
  FileUtils.mkdir_p(work_root, verbose: true)
end
proxy_settings_from_environment() click to toggle source
# File lib/bosh/stemcell/build_environment.rb, line 217
def proxy_settings_from_environment
  keep = %w(HTTP_PROXY HTTPS_PROXY NO_PROXY)

  environment.select { |k| keep.include?(k.upcase) }
end
ruby_bin() click to toggle source
# File lib/bosh/stemcell/builder_options.rb, line 87
def ruby_bin
  environment['RUBY_BIN'] || File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])
end
settings() click to toggle source
# File lib/bosh/stemcell/build_environment.rb, line 201
def settings
  stemcell_builder_options.default
end
source_root() click to toggle source
# File lib/bosh/stemcell/builder_options.rb, line 91
def source_root
  File.expand_path('../../../../..', __FILE__)
end
stemcell_image_name() click to toggle source
# File lib/bosh/stemcell/builder_options.rb, line 83
def stemcell_image_name
  "#{infrastructure.name}-#{infrastructure.hypervisor}-#{operating_system.name}.raw"
end
work_root() click to toggle source
# File lib/bosh/stemcell/build_environment.rb, line 213
def work_root
  File.join(base_directory, 'work')
end