Implemented review comments to use mktmpdir to create temp dir
This commit is contained in:
Родитель
fbaebc2105
Коммит
0970699061
|
@ -20,9 +20,12 @@ require 'fileutils'
|
||||||
require "securerandom"
|
require "securerandom"
|
||||||
require 'knife-azure/version'
|
require 'knife-azure/version'
|
||||||
|
|
||||||
|
def temp_dir
|
||||||
|
@_temp_dir ||= Dir.mktmpdir
|
||||||
|
end
|
||||||
|
|
||||||
def tmpFile filename
|
def tmpFile filename
|
||||||
Dir::mkdir @tmpdir unless FileTest::directory?(@tmpdir)
|
temp_dir + "/" + filename
|
||||||
@tmpdir + '/' + filename
|
|
||||||
end
|
end
|
||||||
|
|
||||||
RSpec.configure do |c|
|
RSpec.configure do |c|
|
||||||
|
@ -30,18 +33,15 @@ RSpec.configure do |c|
|
||||||
|
|
||||||
c.before(:all) do
|
c.before(:all) do
|
||||||
#Create an empty mock certificate file
|
#Create an empty mock certificate file
|
||||||
@cert_file = 'AzureLinuxCert.pem'
|
@cert_file = tmpFile('AzureLinuxCert.pem')
|
||||||
FileUtils.touch(@cert_file)
|
FileUtils.touch(@cert_file)
|
||||||
|
|
||||||
@tmpdir = 'tmp'
|
|
||||||
Chef::Log.init(tmpFile('debug.log'), 'daily')
|
Chef::Log.init(tmpFile('debug.log'), 'daily')
|
||||||
Chef::Log.level=:debug
|
Chef::Log.level=:debug
|
||||||
end
|
end
|
||||||
|
|
||||||
c.after(:all) do
|
c.after(:all) do
|
||||||
#Cleanup files and dirs
|
#Cleanup files and dirs
|
||||||
FileUtils.rm_rf(@cert_file)
|
FileUtils.rm_rf("#{temp_dir}")
|
||||||
FileUtils.rm_rf(@tmpdir)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче