Skip to content

Commit

Permalink
Merge pull request #124 from djberg96/miq_tempfile
Browse files Browse the repository at this point in the history
Move miq_tempfile here
  • Loading branch information
agrare authored May 8, 2020
2 parents 36f7091 + f593a0e commit 0e68f7d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'util/miq_tempfile'
require 'miq_tempfile'
require_relative '../../MiqVm/MiqVm'
require_relative 'MiqOpenStackCommon'

Expand Down
15 changes: 15 additions & 0 deletions lib/miq_tempfile.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require 'delegate'
require 'tempfile'

class MiqTempfile < DelegateClass(Tempfile)
# TODO: share this definition with appliance console code.
MIQ_TMP_DIR = '/var/www/miq_tmp'.freeze

def initialize(basename, *options)
if File.directory?(MIQ_TMP_DIR)
super(Tempfile.new(basename, MIQ_TMP_DIR, *options))
else
super(Tempfile.new(basename, *options))
end
end
end

0 comments on commit 0e68f7d

Please sign in to comment.