Sha256: 881de75c852968840883981ac7f1ddd861e099a7bdb82f241da1a2f92e322ef1

Contents?: true

Size: 1.78 KB

Versions: 15

Compression:

Stored size: 1.78 KB

Contents

class Chef
  class Provider
    class WindowsFeature
      module Base

        def action_install
          unless installed?
            install_feature(@new_resource.feature_name)
            @new_resource.updated_by_last_action(true)
            Chef::Log.info("#{@new_resource} installed feature")
          else
            Chef::Log.debug("#{@new_resource} is already installed - nothing to do")
          end
        end

        def action_remove
          if installed?
            remove_feature(@new_resource.feature_name)
            @new_resource.updated_by_last_action(true)
            Chef::Log.info("#{@new_resource} removed")
          else
            Chef::Log.debug("#{@new_resource} feature does not exist - nothing to do")
          end
        end

        def action_delete
          if available?
            delete_feature(@new_resource.feature_name)
            @new_resource.updated_by_last_action(true)
            Chef::Log.info("#{@new_resource} deleted")
          else
            Chef::Log.debug("#{@new_resource} feature is not installed - nothing to do")
          end
        end

        def install_feature(name)
          raise Chef::Exceptions::UnsupportedAction, "#{self.to_s} does not support :install"
        end

        def remove_feature(name)
          raise Chef::Exceptions::UnsupportedAction, "#{self.to_s} does not support :remove"
        end

        def delete_feature(name)
          raise Chef::Exceptions::UnsupportedAction, "#{self.to_s} does not support :delete"
        end

        def installed?
          raise Chef::Exceptions::Override, "You must override installed? in #{self.to_s}"
        end

        def available?
          raise Chef::Exceptions::Override, "You must override available? in #{self.to_s}"
        end
      end
    end
  end
end
      

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
madscience-0.0.16 cookbooks/windows/libraries/feature_base.rb
madscience-0.0.15 cookbooks/windows/libraries/feature_base.rb
madscience-0.0.14 cookbooks/windows/libraries/feature_base.rb
madscience-0.0.13 cookbooks/windows/libraries/feature_base.rb
madscience-0.0.11 cookbooks/windows/libraries/feature_base.rb
madscience-0.0.10 cookbooks/windows/libraries/feature_base.rb
madscience-0.0.9 cookbooks/windows/libraries/feature_base.rb
madscience-0.0.8 cookbooks/windows/libraries/feature_base.rb
madscience-0.0.7 cookbooks/windows/libraries/feature_base.rb
madscience-0.0.6 cookbooks/windows/libraries/feature_base.rb
madscience-0.0.5 cookbooks/windows/libraries/feature_base.rb
madscience-0.0.4 cookbooks/windows/libraries/feature_base.rb
madscience-0.0.3 cookbooks/windows/libraries/feature_base.rb
madscience-0.0.2 cookbooks/windows/libraries/feature_base.rb
madscience-0.0.1 cookbooks/windows/libraries/feature_base.rb