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



48
49
50
51
52
53
54
# File 'lib/chef/util/windows/volume.rb', line 48

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

#deleteObject



40
41
42
43
44
45
46
# File 'lib/chef/util/windows/volume.rb', line 40

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

#deviceObject



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

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