Class: Vmit::Bootstrap::FromMedia
- Inherits:
-
Object
- Object
- Vmit::Bootstrap::FromMedia
- Defined in:
- lib/vmit/bootstrap.rb
Overview
Boostraps a vm from a SUSE repository
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#media ⇒ Object
readonly
Returns the value of attribute media.
-
#vm ⇒ Object
readonly
Returns the value of attribute vm.
Class Method Summary collapse
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(vm, location) ⇒ FromMedia
constructor
A new instance of FromMedia.
Constructor Details
#initialize(vm, location) ⇒ FromMedia
Returns a new instance of FromMedia.
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
# File 'lib/vmit/bootstrap.rb', line 222 def initialize(vm, location) @location = location @vm = vm @media = Vmit::VFS.from(location) # TODO FIXME we need a clever way to detect the # location distro type. I could uname the kernel, but # I need the type to know the location. media_handler = case location.to_s.downcase when /fedora|redhat|centos/ then FedoraMedia when /suse/ then SUSEMedia when /debian/ then DebianMedia else raise "Don't know how to bootstrap media #{location}" end self.extend media_handler @boot_kernel = get_kernel @boot_initrd = get_initrd end |
Instance Attribute Details
#location ⇒ Object (readonly)
Returns the value of attribute location.
210 211 212 |
# File 'lib/vmit/bootstrap.rb', line 210 def location @location end |
#media ⇒ Object (readonly)
Returns the value of attribute media.
209 210 211 |
# File 'lib/vmit/bootstrap.rb', line 209 def media @media end |
#vm ⇒ Object (readonly)
Returns the value of attribute vm.
208 209 210 |
# File 'lib/vmit/bootstrap.rb', line 208 def vm @vm end |
Class Method Details
.accept?(location) ⇒ Boolean
213 214 215 216 217 218 219 220 |
# File 'lib/vmit/bootstrap.rb', line 213 def self.accept?(location) # either a local ISO or a remote repository # (and not a remote file, but we don't have # a good way to check) Vmit::VFS::ISO.accept?(location) || (Vmit::VFS::URI.accept?(location) && File.extname(location.to_s) == '') end |
Instance Method Details
#execute ⇒ Object
243 244 245 246 247 |
# File 'lib/vmit/bootstrap.rb', line 243 def execute args = {} args.merge!({:kernel => @boot_kernel.path, :initrd => @boot_initrd.path}) execute_autoinstall(args) end |