Class: Cloudkeeper::CommandExecutioner

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudkeeper/command_executioner.rb

Class Method Summary collapse

Class Method Details

.execute(*args) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/cloudkeeper/command_executioner.rb', line 4

def execute(*args)
  command = Mixlib::ShellOut.new(*args, timeout: Cloudkeeper::Settings[:'external-tools-execution-timeout'])
  logger.debug "Executing command: #{command.command.inspect}"
  command.run_command

  if command.error?
    raise Cloudkeeper::Errors::CommandExecutionError, "Command #{command.command.inspect} terminated with an error: " \
                                                      "#{command.stderr}"
  end

  command.stdout
end

.list_archive(archive) ⇒ Object



17
18
19
# File 'lib/cloudkeeper/command_executioner.rb', line 17

def list_archive(archive)
  execute('tar', '-t', '-f', archive).lines.map(&:chomp)
end