Class: Chef::Provider::Mount

Inherits:
Chef::Provider show all
Includes:
Mixin::Command
Defined in:
lib/chef/provider/mount.rb,
lib/chef/provider/mount/mount.rb,
lib/chef/provider/mount/windows.rb

Direct Known Subclasses

Mount, Windows

Defined Under Namespace

Classes: Mount, Windows

Instance Attribute Summary

Attributes inherited from Chef::Provider

#current_resource, #new_resource, #run_context

Instance Method Summary collapse

Methods included from Mixin::Command

#chdir_or_tmpdir, #handle_command_failures, #not_if, #only_if, #output_of_command, #run_command, #run_command_with_systems_locale

Methods included from Mixin::Command::Windows

#popen4

Methods included from Mixin::Command::Unix

#popen4

Methods inherited from Chef::Provider

#action_nothing, build_from_file, #cookbook_name, #initialize, #load_current_resource, #node, #resource_collection

Methods included from Mixin::ConvertToClassName

#convert_to_class_name, #convert_to_snake_case, #filename_to_qualified_string, #snake_case_basename

Methods included from Mixin::RecipeDefinitionDSLCore

#method_missing

Methods included from Mixin::Language

#data_bag, #data_bag_item, #platform?, #search, #value_for_platform

Constructor Details

This class inherits a constructor from Chef::Provider

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Chef::Mixin::RecipeDefinitionDSLCore

Instance Method Details

#action_disableObject



81
82
83
84
85
86
87
88
89
90
91
# File 'lib/chef/provider/mount.rb', line 81

def action_disable
  if @current_resource.enabled
    status = disable_fs
    if status
      @new_resource.updated_by_last_action(true)            
      Chef::Log.info("#{@new_resource} disabled")
    else
      Chef::Log.debug("#{@new_resource} already disabled")
    end
  end
end

#action_enableObject



69
70
71
72
73
74
75
76
77
78
79
# File 'lib/chef/provider/mount.rb', line 69

def action_enable
  unless @current_resource.enabled
    status = enable_fs
    if status
      @new_resource.updated_by_last_action(true)
      Chef::Log.info("#{@new_resource} enabled")
    else
      Chef::Log.debug("#{@new_resource} already enabled")
    end
  end
end

#action_mountObject



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/chef/provider/mount.rb', line 29

def action_mount
  unless @current_resource.mounted
    status = mount_fs()
    if status
      @new_resource.updated_by_last_action(true)
      Chef::Log.info("#{@new_resource} mounted")
    end
  else
    Chef::Log.debug("#{@new_resource} is already mounted")
  end
end

#action_remountObject



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/chef/provider/mount.rb', line 53

def action_remount
  unless @new_resource.supports[:remount]
    raise Chef::Exceptions::UnsupportedAction, "#{self.to_s} does not support :remount"
  else
    if @current_resource.mounted
      status = remount_fs()
      if status
        @new_resource.updated_by_last_action(true)
        Chef::Log.info("#{@new_resource} remounted")
      end
    else
      Chef::Log.debug("#{@new_resource} not mounted, nothing to remount")
    end
  end
end

#action_umountObject



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/chef/provider/mount.rb', line 41

def action_umount
  if @current_resource.mounted
    status = umount_fs()
    if status
      @new_resource.updated_by_last_action(true)
      Chef::Log.info("#{@new_resource} unmounted")
    end
  else
    Chef::Log.debug("#{@new_resource} is already unmounted")
  end
end

#disable_fsObject



109
110
111
# File 'lib/chef/provider/mount.rb', line 109

def disable_fs
  raise Chef::Exceptions::UnsupportedAction, "#{self.to_s} does not support :disable"        
end

#enable_fsObject



105
106
107
# File 'lib/chef/provider/mount.rb', line 105

def enable_fs
  raise Chef::Exceptions::UnsupportedAction, "#{self.to_s} does not support :enable"        
end

#mount_fsObject



93
94
95
# File 'lib/chef/provider/mount.rb', line 93

def mount_fs
  raise Chef::Exceptions::UnsupportedAction, "#{self.to_s} does not support :mount"
end

#remount_fsObject



101
102
103
# File 'lib/chef/provider/mount.rb', line 101

def remount_fs
  raise Chef::Exceptions::UnsupportedAction, "#{self.to_s} does not support :remount"
end

#umount_fsObject



97
98
99
# File 'lib/chef/provider/mount.rb', line 97

def umount_fs
  raise Chef::Exceptions::UnsupportedAction, "#{self.to_s} does not support :umount"
end