Class: Chef::Provider::Mount
- Inherits:
-
Chef::Provider
- Object
- Chef::Provider
- Chef::Provider::Mount
- Includes:
- Mixin::ShellOut
- Defined in:
- lib/chef/provider/mount.rb,
lib/chef/provider/mount/aix.rb,
lib/chef/provider/mount/mount.rb,
lib/chef/provider/mount/solaris.rb,
lib/chef/provider/mount/windows.rb
Defined Under Namespace
Classes: Aix, Mount, Solaris, Windows
Constant Summary
Constants included from Mixin::ShellOut
Mixin::ShellOut::DEPRECATED_OPTIONS
Instance Attribute Summary collapse
-
#unmount_retries ⇒ Object
Returns the value of attribute unmount_retries.
Attributes inherited from Chef::Provider
#action, #cookbook_name, #current_resource, #new_resource, #recipe_name, #run_context
Instance Method Summary collapse
- #action_disable ⇒ Object
- #action_enable ⇒ Object
- #action_mount ⇒ Object
- #action_remount ⇒ Object
- #action_umount ⇒ Object
-
#disable_fs ⇒ Object
should implement disabling of the filesystem (e.g. in /etc/fstab), raises if action does not succeed.
-
#enable_fs ⇒ Object
should implement enabling of the filesystem (e.g. in /etc/fstab), raises if action does not succeed.
-
#initialize(new_resource, run_context) ⇒ Mount
constructor
A new instance of Mount.
- #load_current_resource ⇒ Object
-
#mount_fs ⇒ Object
should implement mounting of the filesystem, raises if action does not succeed.
-
#mount_options_unchanged? ⇒ Boolean
should check new_resource against current_resource to see if mount options need updating, returns true/false.
-
#mounted? ⇒ Boolean
should actually check if the filesystem is mounted (not just return current_resource) and return true/false.
-
#remount_fs ⇒ Object
should implement remounting of the filesystem (via a -o remount or some other atomic-ish action that isn’t simply a umount/mount style remount), raises if action does not succeed.
-
#umount_fs ⇒ Object
should implement unmounting of the filesystem, raises if action does not succeed.
- #whyrun_supported? ⇒ Boolean
Methods included from Mixin::ShellOut
#run_command_compatible_options, #shell_out, #shell_out!, #shell_out_with_systems_locale, #shell_out_with_systems_locale!
Methods inherited from Chef::Provider
#action_nothing, #check_resource_semantics!, #cleanup_after_converge, #converge_by, #converge_if_changed, #define_resource_requirements, #events, include_resource_dsl, include_resource_dsl_module, #node, #process_resource_requirements, provides, provides?, #requirements, #resource_collection, #resource_updated?, #run_action, #set_updated_status, supports?, use_inline_resources, #whyrun_mode?
Methods included from Mixin::Provides
#provided_as, #provides, #provides?
Methods included from Mixin::DescendantsTracker
#descendants, descendants, direct_descendants, #direct_descendants, find_descendants_by_name, #find_descendants_by_name, #inherited, store_inherited
Methods included from DeprecatedLWRPClass
#const_missing, #deprecated_constants, #register_deprecated_lwrp_class
Methods included from Mixin::LazyModuleInclude
#descendants, #include, #included
Methods included from Mixin::NotifyingBlock
#notifying_block, #subcontext_block
Methods included from DSL::DeclareResource
#build_resource, #declare_resource, #delete_resource, #delete_resource!, #edit_resource, #edit_resource!, #find_resource, #find_resource!, #with_run_context
Methods included from Mixin::PowershellOut
#powershell_out, #powershell_out!
Methods included from Mixin::WindowsArchitectureHelper
#assert_valid_windows_architecture!, #disable_wow64_file_redirection, #forced_32bit_override_required?, #is_i386_process_on_x86_64_windows?, #node_supports_windows_architecture?, #node_windows_architecture, #restore_wow64_file_redirection, #valid_windows_architecture?, #with_os_architecture, #wow64_architecture_override_required?, #wow64_directory
Methods included from DSL::PlatformIntrospection
#docker?, #platform?, #platform_family?, #value_for_platform, #value_for_platform_family
Constructor Details
#initialize(new_resource, run_context) ⇒ Mount
Returns a new instance of Mount.
39 40 41 42 |
# File 'lib/chef/provider/mount.rb', line 39 def initialize(new_resource, run_context) super self.unmount_retries = 20 end |
Instance Attribute Details
#unmount_retries ⇒ Object
Returns the value of attribute unmount_retries.
29 30 31 |
# File 'lib/chef/provider/mount.rb', line 29 def unmount_retries @unmount_retries end |
Instance Method Details
#action_disable ⇒ Object
100 101 102 103 104 105 106 107 108 109 |
# File 'lib/chef/provider/mount.rb', line 100 def action_disable if current_resource.enabled converge_by("disable #{current_resource.device}") do disable_fs Chef::Log.info("#{new_resource} disabled") end else Chef::Log.debug("#{new_resource} already disabled") end end |
#action_enable ⇒ Object
89 90 91 92 93 94 95 96 97 98 |
# File 'lib/chef/provider/mount.rb', line 89 def action_enable unless current_resource.enabled && converge_by("enable #{current_resource.device}") do enable_fs Chef::Log.info("#{new_resource} enabled") end else Chef::Log.debug("#{new_resource} already enabled") end end |
#action_mount ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/chef/provider/mount.rb', line 44 def action_mount unless current_resource.mounted converge_by("mount #{current_resource.device} to #{current_resource.mount_point}") do mount_fs Chef::Log.info("#{new_resource} mounted") end else Chef::Log.debug("#{new_resource} is already mounted") end end |
#action_remount ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/chef/provider/mount.rb', line 66 def action_remount if current_resource.mounted if new_resource.supports[:remount] converge_by("remount #{current_resource.device}") do remount_fs Chef::Log.info("#{new_resource} remounted") end else converge_by("unmount #{current_resource.device}") do umount_fs Chef::Log.info("#{new_resource} unmounted") end wait_until_unmounted(unmount_retries) converge_by("mount #{current_resource.device}") do mount_fs Chef::Log.info("#{new_resource} mounted") end end else Chef::Log.debug("#{new_resource} not mounted, nothing to remount") end end |
#action_umount ⇒ Object
55 56 57 58 59 60 61 62 63 64 |
# File 'lib/chef/provider/mount.rb', line 55 def action_umount if current_resource.mounted converge_by("unmount #{current_resource.device}") do umount_fs Chef::Log.info("#{new_resource} unmounted") end else Chef::Log.debug("#{new_resource} is already unmounted") end end |
#disable_fs ⇒ Object
should implement disabling of the filesystem (e.g. in /etc/fstab), raises if action does not succeed
153 154 155 |
# File 'lib/chef/provider/mount.rb', line 153 def disable_fs raise Chef::Exceptions::UnsupportedAction, "#{self} does not support :disable" end |
#enable_fs ⇒ Object
should implement enabling of the filesystem (e.g. in /etc/fstab), raises if action does not succeed
148 149 150 |
# File 'lib/chef/provider/mount.rb', line 148 def enable_fs raise Chef::Exceptions::UnsupportedAction, "#{self} does not support :enable" end |
#load_current_resource ⇒ Object
35 36 37 |
# File 'lib/chef/provider/mount.rb', line 35 def load_current_resource true end |
#mount_fs ⇒ Object
should implement mounting of the filesystem, raises if action does not succeed
132 133 134 |
# File 'lib/chef/provider/mount.rb', line 132 def mount_fs raise Chef::Exceptions::UnsupportedAction, "#{self} does not support :mount" end |
#mount_options_unchanged? ⇒ Boolean
should check new_resource against current_resource to see if mount options need updating, returns true/false
121 122 123 |
# File 'lib/chef/provider/mount.rb', line 121 def raise Chef::Exceptions::UnsupportedAction, "#{self} does not implement #mount_options_unchanged?" end |
#mounted? ⇒ Boolean
should actually check if the filesystem is mounted (not just return current_resource) and return true/false
116 117 118 |
# File 'lib/chef/provider/mount.rb', line 116 def mounted? raise Chef::Exceptions::UnsupportedAction, "#{self} does not implement #mounted?" end |
#remount_fs ⇒ Object
should implement remounting of the filesystem (via a -o remount or some other atomic-ish action that isn’t simply a umount/mount style remount), raises if action does not succeed
143 144 145 |
# File 'lib/chef/provider/mount.rb', line 143 def remount_fs raise Chef::Exceptions::UnsupportedAction, "#{self} does not support :remount" end |
#umount_fs ⇒ Object
should implement unmounting of the filesystem, raises if action does not succeed
137 138 139 |
# File 'lib/chef/provider/mount.rb', line 137 def umount_fs raise Chef::Exceptions::UnsupportedAction, "#{self} does not support :umount" end |
#whyrun_supported? ⇒ Boolean
31 32 33 |
# File 'lib/chef/provider/mount.rb', line 31 def whyrun_supported? true end |