Sha256: 0017c7e8915c1462d3f20dcbed83790ec88b1df37e4f709b15bc72a1e4afa9e5

Contents?: true

Size: 1.78 KB

Versions: 11

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

11 entries across 11 versions & 1 rubygems

Version Path
madscience-0.0.29 cookbooks/windows/libraries/feature_base.rb
madscience-0.0.28 cookbooks/windows/libraries/feature_base.rb
madscience-0.0.27 cookbooks/windows/libraries/feature_base.rb
madscience-0.0.26 cookbooks/windows/libraries/feature_base.rb
madscience-0.0.25 cookbooks/windows/libraries/feature_base.rb
madscience-0.0.24 cookbooks/windows/libraries/feature_base.rb
madscience-0.0.23 cookbooks/windows/libraries/feature_base.rb
madscience-0.0.21 cookbooks/windows/libraries/feature_base.rb
madscience-0.0.20 cookbooks/windows/libraries/feature_base.rb
madscience-0.0.19 cookbooks/windows/libraries/feature_base.rb
madscience-0.0.17 cookbooks/windows/libraries/feature_base.rb