Sha256: 0a4f285ada989ef1fd97bcd7dd605aefc33e9951fa2a5e99dd5c31e6120be96b

Contents?: true

Size: 1.25 KB

Versions: 67

Compression:

Stored size: 1.25 KB

Contents

class TestLab
  class Container

    module LXC

      # Container Console
      #
      # Opens an LXC console into the container.
      #
      # This command will replace the current process with an SSH session that
      # will execute the appropriate LXC console command on the parent node of
      # this container.
      def console
        @ui.stdout.puts("Press CTRL-A Q to exit the console.  (CTRL-A CTRL-A to enter a CTRL-A itself)".red.bold)
        self.node.ssh.console(%(-t 'sudo lxc-console -n #{self.id}'))
      end

      # LXC::Container object
      #
      # Returns a *LXC::Container* class instance configured for this container.
      #
      # @return [LXC] An instance of LXC::Container configured for this
      #   container.
      def lxc
        @lxc ||= self.node.lxc.container(self.id)
      end

      # Does the container exist?
      #
      # @return [Boolean] True if the containers exists, false otherwise.
      def exists?
        @ui.logger.debug { "Container Exists?: #{self.id} " }

        self.lxc.exists?
      end

      # Container root filesystem path
      #
      # @return [String] The path to the containers root filesystem.
      def fs_root
        self.lxc.fs_root(self.lxc_clone.exists?)
      end

    end

  end
end

Version data entries

67 entries across 67 versions & 1 rubygems

Version Path
testlab-1.22.4 lib/testlab/container/lxc.rb
testlab-1.22.3 lib/testlab/container/lxc.rb
testlab-1.22.2 lib/testlab/container/lxc.rb
testlab-1.22.1 lib/testlab/container/lxc.rb
testlab-1.22.0 lib/testlab/container/lxc.rb
testlab-1.21.1 lib/testlab/container/lxc.rb
testlab-1.21.0 lib/testlab/container/lxc.rb
testlab-1.20.6 lib/testlab/container/lxc.rb
testlab-1.20.5 lib/testlab/container/lxc.rb
testlab-1.20.4 lib/testlab/container/lxc.rb
testlab-1.20.3 lib/testlab/container/lxc.rb
testlab-1.20.2 lib/testlab/container/lxc.rb
testlab-1.20.1 lib/testlab/container/lxc.rb
testlab-1.20.0 lib/testlab/container/lxc.rb
testlab-1.19.0 lib/testlab/container/lxc.rb
testlab-1.18.1 lib/testlab/container/lxc.rb
testlab-1.18.0 lib/testlab/container/lxc.rb
testlab-1.17.0 lib/testlab/container/lxc.rb
testlab-1.16.1 lib/testlab/container/lxc.rb
testlab-1.16.0 lib/testlab/container/lxc.rb