Method: Beaker::DSL::InstallUtils#install_puppetagent_dev_repo

Defined in:
lib/beaker/dsl/install_utils.rb

#install_puppetagent_dev_repo(host, opts) ⇒ Object

Install development repo of the puppet-agent on the given host

Parameters:

  • host (Host)

    An object implementing Hosts‘s interface

  • opts (Hash{Symbol=>String})

    An options hash

Options Hash (opts):

  • :version (String)

    The version of puppet-agent to install

  • :copy_base_local (String)

    Directory where puppet-agent artifact will be stored locally (default: ‘tmp/repo_configs’)

  • :copy_dir_external (String)

    Directory where puppet-agent artifact will be pushed to on the external machine (default: ‘/root’)

Returns:

  • nil



1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
# File 'lib/beaker/dsl/install_utils.rb', line 1271

def install_puppetagent_dev_repo( host, opts )
  opts[:copy_base_local]    ||= File.join('tmp', 'repo_configs')
  opts[:copy_dir_external]  ||= File.join('/', 'root')
  variant, version, arch, codename = host['platform'].to_array
  release_path = "#{options[:dev_builds_url]}/puppet-agent/#{opts[:version]}/artifacts/"
  copy_dir_local = File.join(opts[:copy_base_local], variant)
  onhost_copy_base = opts[:copy_dir_external]

  case variant
  when /^(fedora|el|centos)$/
    release_path << "el/#{version}/products/#{arch}"
    release_file = "puppet-agent-#{opts[:version]}-1.#{arch}.rpm"
  when /^(debian|ubuntu|cumulus)$/
    release_path << "deb/#{codename}"
    release_file = "puppet-agent_#{opts[:version]}-1_#{arch}.deb"
  when /^windows$/
    release_path << 'windows'
    onhost_copy_base = '`cygpath -smF 35`/'
    arch_suffix = arch =~ /64/ ? '64' : '86'
    release_file = "puppet-agent-x#{arch_suffix}.msi"
  else
    raise "No repository installation step for #{variant} yet..."
  end

  onhost_copied_file = File.join(onhost_copy_base, release_file)
  fetch_http_file( release_path, release_file, copy_dir_local)
  scp_to host, File.join(copy_dir_local, release_file), onhost_copy_base

  case variant
  when /^(fedora|el|centos)$/
    on host, "rpm -ivh #{onhost_copied_file}"
  when /^(debian|ubuntu|cumulus)$/
    on host, "dpkg -i --force-all #{onhost_copied_file}"
    on host, "apt-get update"
  when /^windows$/
    result = on host, "echo #{onhost_copied_file}"
    onhost_copied_file = result.raw_output.chomp
    on host, Command.new("start /w #{onhost_copied_file}", [], { :cmdexe => true })
  end
end