lib/testlab/container/lxc.rb in testlab-0.9.0 vs lib/testlab/container/lxc.rb in testlab-0.9.1
- old
+ new
@@ -23,10 +23,22 @@
else
self.lxc.bootstrap(content)
end
end
+ # 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
@@ -140,11 +152,11 @@
#
# @return [Boolean] True if successful.
def build_lxc_config(lxc_config)
lxc_config.clear
- lxc_config['lxc.utsname'] = self.fqdn
lxc_config['lxc.arch'] = self.arch
+ lxc_config['lxc.utsname'] = self.fqdn
lxc_config.networks = build_lxc_network_conf(self.interfaces)
lxc_config.save
true