diff options
author | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-08-26 14:09:05 -0700 |
---|---|---|
committer | Kartik Null Cating-Subramanian <ksubramanian@chef.io> | 2015-08-27 11:54:47 -0400 |
commit | 652b582c1ca7ceabe57cdf6b170fe97f4d661584 (patch) | |
tree | 919c0dd88cefaaa0c2c5699d267eb185761400eb /lib/chef/util | |
parent | 3fff2b493fe51398cc139f4c4239beee193b0097 (diff) | |
download | chef-652b582c1ca7ceabe57cdf6b170fe97f4d661584.tar.gz |
Rewrite DeleteVolumeMountPoint to use FFI
Diffstat (limited to 'lib/chef/util')
-rw-r--r-- | lib/chef/util/windows/volume.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/chef/util/windows/volume.rb b/lib/chef/util/windows/volume.rb index 08c3a53793..15780d61a1 100644 --- a/lib/chef/util/windows/volume.rb +++ b/lib/chef/util/windows/volume.rb @@ -18,6 +18,7 @@ #simple wrapper around Volume APIs. might be possible with WMI, but possibly more complex. +require 'chef/win32/api/file' require 'chef/util/windows' require 'windows/volume' @@ -25,9 +26,6 @@ class Chef::Util::Windows::Volume < Chef::Util::Windows private include Windows::Volume - #XXX not defined in the current windows-pr release - DeleteVolumeMountPoint = - Windows::API.new('DeleteVolumeMountPoint', 'S', 'B') unless defined? DeleteVolumeMountPoint public @@ -46,8 +44,10 @@ class Chef::Util::Windows::Volume < Chef::Util::Windows end def delete - unless DeleteVolumeMountPoint.call(@name) - raise ArgumentError, get_last_error + begin + Chef::ReservedNames::Win32::File.delete_volume_mount_point(@name) + rescue Chef::Exceptions::Win32APIError => e + raise ArgumentError, e end end |