Class: Chef::Util::Windows::Volume

Inherits:
Chef::Util::Windows show all
Defined in:
lib/chef/util/windows/volume.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Volume

Returns a new instance of Volume.



27
28
29
30
# File 'lib/chef/util/windows/volume.rb', line 27

def initialize(name)
  name += "\\" unless name =~ /\\$/ # trailing slash required
  @mount_point = name
end

Instance Attribute Details

#mount_pointObject (readonly)

Returns the value of attribute mount_point.



25
26
27
# File 'lib/chef/util/windows/volume.rb', line 25

def mount_point
  @mount_point
end

Instance Method Details

#add(args) ⇒ Object



44
45
46
47
48
# File 'lib/chef/util/windows/volume.rb', line 44

def add(args)
  Chef::ReservedNames::Win32::File.set_volume_mount_point(mount_point, args[:remote])
rescue Chef::Exceptions::Win32APIError => e
  raise ArgumentError, e
end

#deleteObject



38
39
40
41
42
# File 'lib/chef/util/windows/volume.rb', line 38

def delete
  Chef::ReservedNames::Win32::File.delete_volume_mount_point(mount_point)
rescue Chef::Exceptions::Win32APIError => e
  raise ArgumentError, e
end

#deviceObject



32
33
34
35
36
# File 'lib/chef/util/windows/volume.rb', line 32

def device
  Chef::ReservedNames::Win32::File.get_volume_name_for_volume_mount_point(mount_point)
rescue Chef::Exceptions::Win32APIError => e
  raise ArgumentError, e
end