Class: InstanceAgent::LinuxUtil
- Inherits:
-
Object
- Object
- InstanceAgent::LinuxUtil
- Defined in:
- lib/instance_agent/platform/linux_util.rb
Class Method Summary collapse
- .codedeploy_version_file ⇒ Object
- .extract_tar(bundle_file, dst) ⇒ Object
- .extract_tgz(bundle_file, dst) ⇒ Object
- .prepare_script_command(script, absolute_cmd_path) ⇒ Object
- .quit ⇒ Object
- .script_executable?(path) ⇒ Boolean
- .supported_oses ⇒ Object
- .supported_versions ⇒ Object
- .supports_process_groups? ⇒ Boolean
Class Method Details
.codedeploy_version_file ⇒ Object
55 56 57 |
# File 'lib/instance_agent/platform/linux_util.rb', line 55 def self.codedeploy_version_file File.join(ProcessManager::Config.config[:root_dir], '..') end |
.extract_tar(bundle_file, dst) ⇒ Object
41 42 43 44 |
# File 'lib/instance_agent/platform/linux_util.rb', line 41 def self.extract_tar(bundle_file, dst) FileUtils.mkdir_p(dst) execute_tar_command("/bin/tar -xpsf #{bundle_file} -C #{dst}") end |
.extract_tgz(bundle_file, dst) ⇒ Object
46 47 48 49 |
# File 'lib/instance_agent/platform/linux_util.rb', line 46 def self.extract_tgz(bundle_file, dst) FileUtils.mkdir_p(dst) execute_tar_command("/bin/tar -zxpsf #{bundle_file} -C #{dst}") end |
.prepare_script_command(script, absolute_cmd_path) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/instance_agent/platform/linux_util.rb', line 11 def self.prepare_script_command(script, absolute_cmd_path) runas = !!script.runas sudo = !!script.sudo if runas && sudo return 'sudo su ' + script.runas + ' -c ' + absolute_cmd_path end if runas && !sudo return 'su ' + script.runas + ' -c ' + absolute_cmd_path end if !runas && sudo return 'sudo ' + absolute_cmd_path end # If neither sudo or runas is specified, execute the # command as the code deploy agent user absolute_cmd_path end |
.quit ⇒ Object
32 33 34 35 |
# File 'lib/instance_agent/platform/linux_util.rb', line 32 def self.quit() # Send kill signal to parent and exit Process.kill('TERM', Process.ppid) end |
.script_executable?(path) ⇒ Boolean
37 38 39 |
# File 'lib/instance_agent/platform/linux_util.rb', line 37 def self.script_executable?(path) File.executable?(path) end |
.supported_oses ⇒ Object
7 8 9 |
# File 'lib/instance_agent/platform/linux_util.rb', line 7 def self.supported_oses() ['linux'] end |
.supported_versions ⇒ Object
3 4 5 |
# File 'lib/instance_agent/platform/linux_util.rb', line 3 def self.supported_versions() [0.0] end |
.supports_process_groups? ⇒ Boolean
51 52 53 |
# File 'lib/instance_agent/platform/linux_util.rb', line 51 def self.supports_process_groups?() true end |