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



84
85
86
87
88
89
90
91
92
93
94
# File 'lib/chef/provider/mount.rb', line 84

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 successfully")
    else
      Chef::Log.debug("#{@new_resource}: not disabling, already disabled")
    end
  end
end

#action_enableObject



72
73
74
75
76
77
78
79
80
81
82
# File 'lib/chef/provider/mount.rb', line 72

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 successfully")
    else
      Chef::Log.debug("#{@new_resource}: not enabling, already enabled")
    end
  end
end

#action_mountObject



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

def action_mount
  unless @current_resource.mounted
    Chef::Log.debug("#{@new_resource}: attempting to mount")
    status = mount_fs()
    if status
      @new_resource.updated_by_last_action(true)
      Chef::Log.info("#{@new_resource}: mounted successfully")
    end
  else
    Chef::Log.debug("#{@new_resource}: not mounting, already mounted")
  end
end

#action_remountObject



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

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

#action_umountObject



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

def action_umount
  if @current_resource.mounted
    Chef::Log.debug("#{@new_resource}: attempting to unmount")
    status = umount_fs()
    if status
      @new_resource.updated_by_last_action(true)
      Chef::Log.info("#{@new_resource}: unmounted successfully")
    end
  else
    Chef::Log.debug("#{@new_resource}: not unmounting, already unmounted")
  end
end

#disable_fsObject



112
113
114
# File 'lib/chef/provider/mount.rb', line 112

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

#enable_fsObject



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

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

#mount_fsObject



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

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

#remount_fsObject



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

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

#umount_fsObject



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

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