Class: Unix::Host
- Inherits:
-
Beaker::Host
- Object
- Beaker::Host
- Unix::Host
- Defined in:
- lib/beaker/host/unix.rb
Direct Known Subclasses
Aix::Host, Eos::Host, FreeBSD::Host, Mac::Host, Windows::Host
Constant Summary
Constants inherited from Beaker::Host
Instance Attribute Summary
Attributes included from Beaker::CommandFactory
Attributes inherited from Beaker::Host
#host_hash, #logger, #name, #options
Instance Method Summary collapse
-
#determine_ssh_server ⇒ Symbol
Determines which SSH Server is in use on this host.
- #external_copy_base ⇒ Object
-
#initialize(name, host_hash, options) ⇒ Host
constructor
A new instance of Host.
- #platform_defaults ⇒ Object
-
#puppet_agent_dev_package_info(puppet_collection = nil, puppet_agent_version = nil, opts = {}) ⇒ String
Gets the path & file name for the puppet agent dev package on Unix.
-
#skip_set_env? ⇒ String?
Tells you whether a host platform supports beaker’s Beaker::HostPrebuiltSteps#set_env method.
-
#solaris_puppet_agent_dev_package_info(puppet_collection = nil, puppet_agent_version = nil, opts = {}) ⇒ String
Gets the path & file name for the puppet agent dev package on Unix.
Methods included from 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
Methods included from 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 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 Group
#group_absent, #group_get, #group_gid, #group_list, #group_present
Methods included from 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
Methods included from Beaker::DSL::Helpers::WebHelpers
#link_exists?, #port_open_within?
Methods included from Beaker::DSL::Helpers::TKHelpers
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
Constructor Details
#initialize(name, host_hash, options) ⇒ Host
Returns a new instance of Host.
158 159 160 161 162 |
# File 'lib/beaker/host/unix.rb', line 158 def initialize name, host_hash, super @external_copy_base = nil end |
Instance Method Details
#determine_ssh_server ⇒ Symbol
This method is mostly a placeholder method, since only :openssh can be returned at this time. Checkout Windows::Host#determine_ssh_server for an example where work needs to be done to determine the answer
Determines which SSH Server is in use on this host
33 34 35 |
# File 'lib/beaker/host/unix.rb', line 33 def determine_ssh_server :openssh end |
#external_copy_base ⇒ Object
132 133 134 135 136 137 138 139 |
# File 'lib/beaker/host/unix.rb', line 132 def external_copy_base return @external_copy_base if @external_copy_base @external_copy_base = '/root' variant, version, arch, codename = self['platform'].to_array # Solaris 10 uses / as the root user directory. Solaris 11 uses /root (like most). @external_copy_base = '/' if variant == 'solaris' && version == '10' @external_copy_base end |
#platform_defaults ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/beaker/host/unix.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
Solaris does require some options to be set. See #solaris_puppet_agent_dev_package_info for more details
Gets the path & file name for the puppet agent dev package on Unix
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/beaker/host/unix.rb', line 111 def puppet_agent_dev_package_info( puppet_collection = nil, puppet_agent_version = nil, opts = {} ) = "Must provide %s argument to get puppet agent dev package information" raise ArgumentError, % "puppet_collection" unless puppet_collection raise ArgumentError, % "puppet_agent_version" unless puppet_agent_version variant, version, arch, codename = self['platform'].to_array case variant when /^(solaris)$/ release_path_end, release_file = solaris_puppet_agent_dev_package_info( puppet_collection, puppet_agent_version, opts ) when /^(sles|aix)$/ arch = 'ppc' if variant == 'aix' && arch == 'power' release_path_end = "#{variant}/#{version}/#{puppet_collection}/#{arch}" release_file = "puppet-agent-#{puppet_agent_version}-1.#{variant}#{version}.#{arch}.rpm" else msg = "puppet_agent dev package info unknown for platform '#{self['platform']}'" raise ArgumentError, msg end return release_path_end, release_file end |
#skip_set_env? ⇒ String?
Tells you whether a host platform supports beaker’s
{Beaker::HostPrebuiltSteps#set_env} method
146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/beaker/host/unix.rb', line 146 def skip_set_env? variant, version, arch, codename = self['platform'].to_array case variant when /^cisco$/ 'Cisco does not allow SSH control through the BASH shell' when /^(f5|netscaler)$/ "no puppet-agent package for network device platform '#{variant}'" else nil end end |
#solaris_puppet_agent_dev_package_info(puppet_collection = nil, puppet_agent_version = nil, opts = {}) ⇒ String
Solaris does require :download_url to be set on the opts argument in order to check for builds on the builds server
Gets the path & file name for the puppet agent dev package on Unix
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/beaker/host/unix.rb', line 50 def solaris_puppet_agent_dev_package_info( puppet_collection = nil, puppet_agent_version = nil, opts = {} ) = "Must provide %s argument to get puppet agent package information" raise ArgumentError, % "puppet_collection" unless puppet_collection raise ArgumentError, % "puppet_agent_version" unless puppet_agent_version raise ArgumentError, % "opts[:download_url]" unless opts[:download_url] variant, version, arch, codename = self['platform'].to_array platform_error = "Incorrect platform '#{variant}' for #solaris_puppet_agent_dev_package_info" raise ArgumentError, platform_error if variant != 'solaris' if arch == 'x86_64' arch = 'i386' end release_path_end = "solaris/#{version}/#{puppet_collection}" solaris_revision_conjunction = '-' revision = '1' if version == '10' solaris_release_version = '' pkg_suffix = 'pkg.gz' solaris_name_conjunction = '-' component_version = puppet_agent_version elsif version == '11' # Ref: # http://www.oracle.com/technetwork/articles/servers-storage-admin/ips-package-versioning-2232906.html # # Example to show package name components: # Full package name: [email protected],5.11-1.sparc.p5p # Schema: <component-name><solaris_name_conjunction><component_version><solaris_release_version><solaris_revision_conjunction><revision>.<arch>.<pkg_suffix> solaris_release_version = ',5.11' # injecting comma to prevent from adding another var pkg_suffix = 'p5p' solaris_name_conjunction = '@' component_version = puppet_agent_version.dup component_version.gsub!(/[a-zA-Z]/, '') component_version.gsub!(/(^-)|(-$)/, '') # Here we strip leading 0 from version components but leave # singular 0 on their own. component_version = component_version.split('-').join('.') component_version = component_version.split('.').map(&:to_i).join('.') end release_file_base = "puppet-agent#{solaris_name_conjunction}#{component_version}#{solaris_release_version}" release_file_end = "#{arch}.#{pkg_suffix}" release_file = "#{release_file_base}#{solaris_revision_conjunction}#{revision}.#{release_file_end}" if not link_exists?("#{opts[:download_url]}/#{release_path_end}/#{release_file}") release_file = "#{release_file_base}.#{release_file_end}" end return release_path_end, release_file end |