module ChefCore::TargetHost::Linux
Constants
- MKTEMP_COMMAND
Public Instance Methods
chown(path, owner)
click to toggle source
# File lib/chef_core/target_host/linux.rb, line 17 def chown(path, owner) owner ||= user run_command!("chown #{owner} '#{path}'") nil end
del_dir(path)
click to toggle source
# File lib/chef_core/target_host/linux.rb, line 46 def del_dir(path) del_file(path) end
del_file(path)
click to toggle source
# File lib/chef_core/target_host/linux.rb, line 42 def del_file(path) run_command!("rm -rf #{path}") end
install_package(target_package_path)
click to toggle source
# File lib/chef_core/target_host/linux.rb, line 31 def install_package(target_package_path) install_cmd = case File.extname(target_package_path) when ".rpm" "rpm -Uvh #{target_package_path}" when ".deb" "dpkg -i #{target_package_path}" end run_command!(install_cmd) nil end
make_temp_dir()
click to toggle source
# File lib/chef_core/target_host/linux.rb, line 23 def make_temp_dir # We will cache this so that we only @tempdir ||= begin res = run_command!("bash -c '#{MKTEMP_COMMAND}'") res.stdout.chomp.strip end end
mkdir(path)
click to toggle source
# File lib/chef_core/target_host/linux.rb, line 13 def mkdir(path) run_command!("mkdir -p #{path}") end
normalize_path(path)
click to toggle source
Nothing to escape in a linux-based path
# File lib/chef_core/target_host/linux.rb, line 55 def normalize_path(path) path end
omnibus_manifest_path()
click to toggle source
# File lib/chef_core/target_host/linux.rb, line 6 def omnibus_manifest_path # TODO - if habitat install on target, this won't work # Note that we can't use File::Join, because that will render for the # CURRENT platform - not the platform of the target. "/opt/chef/version-manifest.json" end
ws_cache_path()
click to toggle source
# File lib/chef_core/target_host/linux.rb, line 50 def ws_cache_path "/var/chef-workstation" end