Added ensure block to always delete file

This commit is contained in:
Jeremy J. Miller 2015-12-15 14:40:57 -05:00
parent 652392918d
commit af55cb41d8

View file

@ -40,12 +40,12 @@ class SecurityPolicy < Inspec.resource(1)
@policy = cmd.stdout
@loaded = true
# delete temp file
cmd = inspec.command('Remove-Item win_secpol.cfg')
return nil if cmd.exit_status.to_i != 0
# returns self
self
ensure
# delete temp file
inspec.command('Remove-Item win_secpol.cfg').exit_status.to_i
end
def method_missing(method)