Class: Imagemaster3000::Actions::Remove

Inherits:
Object
  • Object
show all
Defined in:
lib/imagemaster3000/actions/remove.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Remove

Returns a new instance of Remove.



6
7
8
9
# File 'lib/imagemaster3000/actions/remove.rb', line 6

def initialize(file)
  @file = file
  logger.debug "Created action #{inspect}"
end

Instance Attribute Details

#fileObject

Returns the value of attribute file.



4
5
6
# File 'lib/imagemaster3000/actions/remove.rb', line 4

def file
  @file
end

Instance Method Details

#run(image_file) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/imagemaster3000/actions/remove.rb', line 11

def run(image_file)
  logger.debug "Running 'remove' action with argument #{file.inspect} on file #{image_file.inspect}"
  Imagemaster3000::Utils::CommandExecutioner.execute Imagemaster3000::Settings[:'binaries-guestfish'],
                                                     '-a',
                                                     image_file,
                                                     '-i',
                                                     'rm',
                                                     file
rescue Imagemaster3000::Errors::CommandExecutionError => ex
  raise Imagemaster3000::Errors::ActionError, ex
end