2013-03-21 18:51:18 -04:00
|
|
|
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 install_feature(name)
|
2014-08-14 14:20:52 -04:00
|
|
|
raise Chef::Exceptions::UnsupportedAction, "#{self} does not support :install"
|
2013-03-21 18:51:18 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def remove_feature(name)
|
2014-08-14 14:20:52 -04:00
|
|
|
raise Chef::Exceptions::UnsupportedAction, "#{self} does not support :remove"
|
2013-03-21 18:51:18 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def installed?
|
2014-08-14 14:20:52 -04:00
|
|
|
raise Chef::Exceptions::Override, "You must override installed? in #{self}"
|
2013-03-21 18:51:18 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|