Exception: Metasploit::Model::Spec::PathnameCollision

Inherits:
Error
  • Object
show all
Defined in:
lib/metasploit/model/spec/pathname_collision.rb

Overview

Error raised if a Pathname already exists on disk when one of the real_paths for metasploit-models factories is generated or derived, which would indicate that a prior spec did not clean up properly.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pathname) ⇒ PathnameCollision

Returns a new instance of PathnameCollision.

Parameters:

  • pathname (Pathname)

    Pathname that already exists on disk


16
17
18
19
20
21
# File 'lib/metasploit/model/spec/pathname_collision.rb', line 16

def initialize(pathname)
  super(
      "#{pathname} already exists.  " \
            "Metasploit::Model::Spec.remove_temporary_pathname was not called after the previous spec."
  )
end

Class Method Details

.check!(pathname) ⇒ void

This method returns an undefined value.

Checks if there is a pathname collision.

Parameters:

  • pathname (Pathname)

    Pathname that already exists on disk

Raises:


9
10
11
12
13
# File 'lib/metasploit/model/spec/pathname_collision.rb', line 9

def self.check!(pathname)
  if pathname.exist?
    raise new(pathname)
  end
end