Sha256: 0760da8f8d482b6be75e0d888c3c5891e74b13e54b70ea6192f5512ddcd8b0e4

Contents?: true

Size: 1.34 KB

Versions: 17

Compression:

Stored size: 1.34 KB

Contents

class TestLab
  class Container

    module Support

      # Returns arguments for lxc-create based on our distro
      #
      # @return [Array<String>] An array of arguments for lxc-create
      def create_args
        case self.distro.downcase
        when "ubuntu" then
          %W(-f /etc/lxc/#{self.id} -t #{self.distro} -- --release #{self.release} --arch #{self.arch})
        when "fedora" then
          %W(-f /etc/lxc/#{self.id} -t #{self.distro} -- --release #{self.release})
        end
      end

      # Returns arguments for lxc-start-ephemeral
      #
      # @return [Array<String>] An array of arguments for lxc-start-ephemeral
      def clone_args
        arguments = Array.new

        arguments << %W(-o #{self.lxc_clone.name} -n #{self.lxc.name} -d)
        arguments << %W(--keep-data) if self.persist

        arguments.flatten.compact
      end

      # Attempt to detect the architecture of the node.  The value returned is
      # respective to the container distro.
      #
      # @return [String] The arch of the node in the context of the container
      #   distro
      def detect_arch
        case self.distro.downcase
        when "ubuntu" then
          ((self.node.arch =~ /x86_64/) ? "amd64" : "i386")
        when "fedora" then
          ((self.node.arch =~ /x86_64/) ? "amd64" : "i686")
        end
      end

    end

  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
testlab-1.6.1 lib/testlab/container/support.rb
testlab-1.6.0 lib/testlab/container/support.rb
testlab-1.5.1 lib/testlab/container/support.rb
testlab-1.5.0 lib/testlab/container/support.rb
testlab-1.4.4 lib/testlab/container/support.rb
testlab-1.4.3 lib/testlab/container/support.rb
testlab-1.4.2 lib/testlab/container/support.rb
testlab-1.4.1 lib/testlab/container/support.rb
testlab-1.4.0 lib/testlab/container/support.rb
testlab-1.3.2 lib/testlab/container/support.rb
testlab-1.3.1 lib/testlab/container/support.rb
testlab-1.3.0 lib/testlab/container/support.rb
testlab-1.2.3 lib/testlab/container/support.rb
testlab-1.2.2 lib/testlab/container/support.rb
testlab-1.2.1 lib/testlab/container/support.rb
testlab-1.2.0 lib/testlab/container/support.rb
testlab-1.1.0 lib/testlab/container/support.rb