Module: Mac::Pkg
Instance Attribute Summary
Attributes included from Beaker::CommandFactory
Instance Method Summary collapse
- #check_for_package(name) ⇒ Object
-
#deploy_package_repo(path, name, version) ⇒ Object
Deploy configuration generated by the packaging tooling to this host.
-
#determine_if_x86_64 ⇒ Boolean
Examine the host system to determine the architecture.
- #install_package(name, cmdline_args = '', version = nil) ⇒ Object
-
#pe_puppet_agent_promoted_package_info(puppet_collection = nil, opts = {}) ⇒ String
Gets host-specific information for PE promoted puppet-agent packages.
-
#pe_puppet_agent_promoted_package_install(onhost_copy_base, onhost_copied_download, onhost_copied_file, download_file, opts) ⇒ Object
Installs a given PE promoted package on a host.
-
#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 OSX.
- #uninstall_package(name, cmdline_args = '') ⇒ Object
-
#upgrade_package(name, cmdline_args = '') ⇒ Object
Upgrade an installed package to the latest available version.
Methods included from Beaker::CommandFactory
Instance Method Details
#check_for_package(name) ⇒ Object
4 5 6 |
# File 'lib/beaker/host/mac/pkg.rb', line 4 def check_for_package(name) raise "Package #{name} cannot be queried on #{self}" end |
#deploy_package_repo(path, name, version) ⇒ Object
See Beaker::DSL::Helpers::HostHelpers#deploy_package_repo for info on params
Deploy configuration generated by the packaging tooling to this host.
This method calls one of #deploy_apt_repo, #deploy_yum_repo, or #deploy_zyp_repo depending on the platform of this Host.
33 34 35 |
# File 'lib/beaker/host/mac/pkg.rb', line 33 def deploy_package_repo(path, name, version) raise "Package repo cannot be deployed on #{self}; the platform is not supported" end |
#determine_if_x86_64 ⇒ Boolean
Examine the host system to determine the architecture
39 40 41 42 |
# File 'lib/beaker/host/mac/pkg.rb', line 39 def determine_if_x86_64 result = exec(Beaker::Command.new("uname -a | grep x86_64"), :expect_all_exit_codes => true) result.exit_code == 0 end |
#install_package(name, cmdline_args = '', version = nil) ⇒ Object
8 9 10 11 |
# File 'lib/beaker/host/mac/pkg.rb', line 8 def install_package(name, cmdline_args = '', version = nil) execute("hdiutil attach #{name}.dmg") execute("installer -pkg /Volumes/#{name}/#{name}.pkg -target /") end |
#pe_puppet_agent_promoted_package_info(puppet_collection = nil, opts = {}) ⇒ String
Gets host-specific information for PE promoted puppet-agent packages
96 97 98 99 100 101 102 103 104 |
# File 'lib/beaker/host/mac/pkg.rb', line 96 def pe_puppet_agent_promoted_package_info( puppet_collection = nil, opts = {} ) = "Must provide %s argument to get puppet agent dev package information" raise ArgumentError, % "puppet_collection" unless puppet_collection variant, version, arch, codename = self['platform'].to_array release_file = "/repos/apple/#{puppet_collection}/puppet-agent-*" download_file = "puppet-agent-#{variant}-#{version}.tar.gz" return '', release_file, download_file end |
#pe_puppet_agent_promoted_package_install(onhost_copy_base, onhost_copied_download, onhost_copied_file, download_file, opts) ⇒ Object
Installs a given PE promoted package on a host
115 116 117 118 119 120 121 122 |
# File 'lib/beaker/host/mac/pkg.rb', line 115 def pe_puppet_agent_promoted_package_install( onhost_copy_base, onhost_copied_download, onhost_copied_file, download_file, opts ) execute("tar -zxvf #{onhost_copied_download} -C #{onhost_copy_base}") # move to better location execute("mv #{onhost_copied_file}.dmg .") self.install_package("puppet-agent-*") end |
#puppet_agent_dev_package_info(puppet_collection = nil, puppet_agent_version = nil, opts = {}) ⇒ String
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
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 |
# File 'lib/beaker/host/mac/pkg.rb', line 57 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 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 |
#uninstall_package(name, cmdline_args = '') ⇒ Object
13 14 15 |
# File 'lib/beaker/host/mac/pkg.rb', line 13 def uninstall_package(name, cmdline_args = '') raise "Package #{name} cannot be uninstalled on #{self}" end |
#upgrade_package(name, cmdline_args = '') ⇒ Object
Upgrade an installed package to the latest available version
22 23 24 |
# File 'lib/beaker/host/mac/pkg.rb', line 22 def upgrade_package(name, cmdline_args = '') raise "Package #{name} cannot be upgraded on #{self}" end |