Class: Eos::Host

Inherits:
Unix::Host show all
Defined in:
lib/beaker/host/eos.rb

Constant Summary

Constants inherited from Beaker::Host

Beaker::Host::SELECT_TIMEOUT

Instance Attribute Summary

Attributes included from Beaker::CommandFactory

#assertions

Attributes inherited from Beaker::Host

#host_hash, #logger, #name, #options

Instance Method Summary collapse

Methods inherited from Unix::Host

#platform_defaults

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 Beaker::CommandFactory

#execute, #fail_test

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?, #path_split, #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, #initialize, #ip, #is_cygwin?, #is_pe?, #is_powershell?, #is_using_passenger?, #is_x86_64?, #log_prefix, #node_name, #pkg_initialize, #platform, #port_open?, #puppet, #reachable_name, #to_s, #to_str, #up?, #use_service_scripts?, #uses_passenger!

Constructor Details

This class inherits a constructor from Beaker::Host

Instance Method Details

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

Gets the path & file name for the puppet agent package on EOS

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



18
19
20
21
22
23
24
25
26
27
# File 'lib/beaker/host/eos.rb', line 18

def get_puppet_agent_package_info( puppet_collection = nil, puppet_agent_version = nil, opts = {} )
  error_message = "Must provide %s argument to get puppet agent 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, _ = self['platform'].to_array
  release_path = "#{variant}/#{version}/#{puppet_collection}/#{arch}"
  release_file = "puppet-agent-#{puppet_agent_version}-1.#{variant}#{version}.#{arch}.swix"
  return release_path, release_file
end

#get_remote_file(remote_url, host_directory = '') ⇒ Result

Note:

in EOS, you just copy the file as an extension, you don’t worry about location, so that parameter is ignored

Copies a remote file to the host location specified

Parameters:

  • remote_url (String)

    URL to the remote file

  • host_directory (String) (defaults to: '')

    Path to the host directory on the host.

Returns:

  • (Result)

    The result of copying that file to the host



38
39
40
41
42
# File 'lib/beaker/host/eos.rb', line 38

def get_remote_file( remote_url, host_directory = '' )
  commands = ['enable', "copy #{remote_url} extension:"]
  command = commands.join("\n")
  execute("Cli -c '#{command}'")
end

#install_from_file(filename) ⇒ Result

Installs an extension file already copied via #get_remote_file or something similar

Parameters:

  • filename (String)

    Name of the file to install, including file extension

Returns:

  • (Result)

    The result of running the install command on the host



49
50
51
52
53
# File 'lib/beaker/host/eos.rb', line 49

def install_from_file( filename )
  commands = ['enable', "extension #{filename}"]
  command = commands.join("\n")
  execute("Cli -c '#{command}'")
end