Class: Mac::Host

Inherits:
Unix::Host show all
Includes:
Exec, Group, Pkg, User
Defined in:
lib/beaker/host/mac.rb

Constant Summary

Constants inherited from Beaker::Host

Beaker::Host::SELECT_TIMEOUT

Instance Attribute Summary collapse

Attributes included from Beaker::CommandFactory

#assertions

Attributes inherited from Beaker::Host

#host_hash, #logger, #name, #options

Instance Method Summary collapse

Methods included from Pkg

#check_for_package, #deploy_package_repo, #determine_if_x86_64, #install_package, #uninstall_package, #upgrade_package

Methods included from Beaker::CommandFactory

#execute, #fail_test

Methods included from Group

#gid_next, #group_absent, #group_get, #group_gid, #group_list, #group_present

Methods included from User

#gid_next, #uid_next, #user_absent, #user_get, #user_list, #user_present

Methods included from Exec

#ssh_permit_user_environment, #ssh_service_restart, #touch

Methods inherited from Unix::Host

#determine_ssh_server, #skip_set_env?, #solaris_puppet_agent_dev_package_info

Methods included from Unix::Pkg

#check_for_command, #check_for_package, #deploy_apt_repo, #deploy_package_repo, #deploy_yum_repo, #deploy_zyp_repo, #determine_if_x86_64, #extract_rpm_proxy_options, #install_package, #install_package_with_rpm, #pkg_initialize, #uninstall_package, #update_apt_if_needed, #upgrade_package

Methods included from Unix::Exec

#add_env_var, #clear_env_var, #delete_env_var, #echo, #get_env_var, #get_ip, #mirror_env_to_profile_d, #mkdir_p, #mv, #path, #ping, #reboot, #rm_rf, #ssh_permit_user_environment, #ssh_service_restart, #ssh_set_user_environment, #touch

Methods included from Unix::File

#file_exist?, #noask_file_text, #package_config_dir, #path_split, #repo_filename, #repo_type, #scp_path, #system_temp_path, #tmpdir, #tmpfile

Methods included from Unix::Group

#group_absent, #group_get, #group_gid, #group_list, #group_present

Methods included from Unix::User

#user_absent, #user_get, #user_list, #user_present

Methods inherited from Beaker::Host

#+, #[], #[]=, #close, #connection, create, #delete, #do_rsync_to, #do_scp_from, #do_scp_to, #exec, #get_ip, #graceful_restarts?, #has_key?, #hostname, #ip, #is_cygwin?, #is_pe?, #is_powershell?, #is_using_passenger?, #is_x86_64?, #log_prefix, #node_name, #pkg_initialize, #platform, #port_open?, #puppet_configprint, #reachable_name, #to_s, #to_str, #up?, #use_service_scripts?, #uses_passenger!

Methods included from Beaker::DSL::Patterns

#block_on

Methods included from Beaker::DSL::Helpers::WebHelpers

#link_exists?, #port_open_within?

Methods included from Beaker::DSL::Helpers::TKHelpers

#modify_tk_config

Methods included from Beaker::DSL::Helpers::TestHelpers

#current_step_name, #current_test_filename, #current_test_name, #set_current_step_name, #set_current_test_filename, #set_current_test_name

Methods included from Beaker::DSL::Helpers::PuppetHelpers

#apply_manifest, #apply_manifest_on, #create_tmpdir_for_user, #puppet_group, #puppet_user, #run_agent_on, #sign_certificate, #sign_certificate_for, #sleep_until_nc_started, #sleep_until_puppetdb_started, #sleep_until_puppetserver_started, #stop_agent, #stop_agent_on, #stub_forge, #stub_forge_on, #stub_hosts, #stub_hosts_on, #wait_for_host_in_dashboard, #with_forge_stubbed, #with_forge_stubbed_on, #with_host_stubbed_on, #with_puppet_running, #with_puppet_running_on

Methods included from Beaker::DSL::Helpers::HostHelpers

#add_system32_hosts_entry, #backup_the_file, #check_for_package, #create_remote_file, #create_tmpdir_on, #curl_on, #curl_with_retries, #deploy_package_repo, #echo_on, #execute_powershell_script_on, #exit_code, #install_package, #on, #retry_on, #rsync_to, #run_script, #run_script_on, #scp_from, #scp_to, #shell, #stderr, #stdout, #upgrade_package

Methods included from Beaker::DSL::Helpers::FacterHelpers

#fact, #fact_on

Constructor Details

#initialize(name, host_hash, options) ⇒ Host

Returns a new instance of Host.



69
70
71
72
73
# File 'lib/beaker/host/mac.rb', line 69

def initialize name, host_hash, options
  super

  @external_copy_base = '/var/root'
end

Instance Attribute Details

#external_copy_baseObject (readonly)

Returns the value of attribute external_copy_base.



68
69
70
# File 'lib/beaker/host/mac.rb', line 68

def external_copy_base
  @external_copy_base
end

Instance Method Details

#platform_defaultsObject



17
18
19
20
21
22
23
24
# File 'lib/beaker/host/mac.rb', line 17

def platform_defaults
  h = Beaker::Options::OptionsHash.new
  h.merge({
    'user'             => 'root',
    'group'            => 'root',
    'pathseparator'    => ':',
  })
end

#puppet_agent_dev_package_info(puppet_collection = nil, puppet_agent_version = nil, opts = {}) ⇒ String

Note:

OSX doesn’t use any additional options at this time, but does require both puppet_collection & puppet_agent_version, & will fail without them

Gets the path & file name for the puppet agent dev package on OSX

Parameters:

  • puppet_collection (String) (defaults to: nil)

    Name of the puppet collection to use

  • puppet_agent_version (String) (defaults to: nil)

    Version of puppet agent to get

  • opts (Hash{Symbol=>String}) (defaults to: {})

    Options hash to provide extra values

Returns:

  • (String, String)

    Path to the directory and filename of the package, respectively

Raises:

  • (ArgumentError)

    If one of the two required parameters (puppet_collection, puppet_agent_version) is either not passed or set to nil



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/beaker/host/mac.rb', line 39

def puppet_agent_dev_package_info( puppet_collection = nil, puppet_agent_version = nil, opts = {} )
  error_message = "Must provide %s argument to get puppet agent dev package information"
  raise ArgumentError, error_message % "puppet_collection" unless puppet_collection
  raise ArgumentError, error_message % "puppet_agent_version" unless puppet_agent_version

  variant, version, arch, codename = self['platform'].to_array

  mac_pkg_name = "puppet-agent-#{puppet_agent_version}"
  version = version[0,2] + '.' + version[2,2] unless version.include?(".")
  # newest hotness
  path_chunk = "apple/#{version}/#{puppet_collection}/#{arch}"
  release_path_end = path_chunk
  # moved to doing this when 'el capitan' came out & the objection was
  # raised that the code name wasn't a fact, & as such can be hard to script
  # example: puppet-agent-0.1.0-1.osx10.9.dmg
  release_file = "#{mac_pkg_name}-1.osx#{version}.dmg"
  if not link_exists?("#{opts[:download_url]}/#{release_path_end}/#{release_file}") # new hotness
    # little older change involved the code name as only difference from above
    # example: puppet-agent-0.1.0-1.mavericks.dmg
    release_file = "#{mac_pkg_name}-1.#{codename}.dmg"
  end
  if not link_exists?("#{opts[:download_url]}/#{release_path_end}/#{release_file}") # oops, try the old stuff
    release_path_end = "apple/#{puppet_collection}"
    # example: puppet-agent-0.1.0-osx-10.9-x86_64.dmg
    release_file = "#{mac_pkg_name}-#{variant}-#{version}-x86_64.dmg"
  end
  return release_path_end, release_file
end