lib/lxc.rb in lxc-0.0.9 vs lib/lxc.rb in lxc-0.1.0
- old
+ new
@@ -49,10 +49,15 @@
# SED command for removing ANSI colors
#
# @see http://www.commandlinefu.com/commands/view/3584/remove-color-codes-special-characters-with-sed CommandLineFu - Remove Color Codes (Special Characters) with SED
SED_REMOVE_ANSI = %q(sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g")
+ # @param [Hash] options Options hash.
+ # @option options [Boolean] :use_sudo (false) Whether or not to prefix all
+ # commands with 'sudo'.
+ # @option options [Net::SSH,ZTK::SSH,nil] :use_ssh (nil) Whether or not to
+ # execute all commands remotely via an SSH connection.
def initialize(options={})
@ui = (options[:ui] || ZTK::UI.new)
@use_sudo = (options[:use_sudo] || false)
@use_ssh = (options[:use_ssh] || nil)
end
@@ -71,11 +76,11 @@
# Initalizes an LXC::Container class for the supplied container name.
#
# @param [String] name The container name to initalize.
# @return [LXC::Container] Returns the container object.
def container(name)
- LXC::Container.new(self, name)
+ LXC::Container.new(:lxc => self, :name => name)
end
# Current containers
#
# Initalizes an LXC::Container object for all containers and returns them in
@@ -83,10 +88,10 @@
#
# @return [Array<LXC::Container>]
def containers
container_names = self.ls
container_names.map do |container_name|
- LXC::Container.new(self, container_name)
+ LXC::Container.new(:lxc => self, :name => container_name)
end
end
# List of containers
#