Sha256: ca5eaaa331dad683bfd6b654c991533e3d033c5e9a09e0271cfd49b510743c82
Contents?: true
Size: 934 Bytes
Versions: 5
Compression:
Stored size: 934 Bytes
Contents
module Specinfra::Backend class Lxc < Exec def initialize begin require 'lxc/extra' unless defined?(::LXC::Extra) rescue LoadError fail "LXC client library is not available. Try installing `lxc-extra' gem" end end def run_command(cmd, opts={}) cmd = build_command(cmd) cmd = add_pre_command(cmd) out, ret = ct.execute do out = `#{cmd} 2>&1` [out, $?.dup] end if @example @example.metadata[:command] = cmd @example.metadata[:stdout] = out end CommandResult.new :stdout => out, :exit_status => ret.exitstatus end def build_command(cmd) cmd end def add_pre_command(cmd) cmd end def copy_file(from, to) FileUtils.cp(from, File.join(ct.config_item('lxc.rootfs'), to)) end def ct @ct ||= ::LXC::Container.new(Specinfra.configuration.lxc) end end end
Version data entries
5 entries across 5 versions & 1 rubygems