Class: Pipeline::ISOMounter

Inherits:
BaseMounter show all
Defined in:
lib/pipeline/mounters/iso_mounter.rb

Instance Attribute Summary

Attributes inherited from BaseMounter

#description, #errors, #name, #trigger

Instance Method Summary collapse

Methods inherited from BaseMounter

#error

Constructor Details

#initialize(trigger, options) ⇒ ISOMounter

THIS DOESN’T WORK SO DON’T REGISTER FOR NOW Pipeline::Mounters.add self



8
9
10
11
12
13
# File 'lib/pipeline/mounters/iso_mounter.rb', line 8

def initialize trigger, options
  super(trigger)
  @options = options
  @name = "ISO"
  @description = "Mount an iso image."
end

Instance Method Details

#mount(target) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/pipeline/mounters/iso_mounter.rb', line 15

def mount target
  base = @options[:working_dir]
  working_target = base + "/" + target + "/"    
  Pipeline.notify "Cleaning directory: #{working_target}"

  if ! working_target.match(/\A.*\/line\/tmp\/.*/)
    Pipeline.notify "Bailing in case #{working_target} is malicious."      
  else
    result = `rm -rf #{working_target}`
    # puts result
    result = `mkdir -p #{working_target}`
    # puts result
    Pipeline.notify "Mounting #{target} to #{working_target}"
    result = `mount -t iso9660 #{target} #{working_target}`
    # puts result
  end
  return working_target
end

#supports?(target) ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
37
38
39
40
41
# File 'lib/pipeline/mounters/iso_mounter.rb', line 34

def supports? target
  last = target.slice(-4,target.length)
  if last === ".iso"
    return true
  else
    return false
  end
end