Carl Caum a35ede5126 (#13860) Make a2enmod/a2dismo commands optional
Previous to this comit, the a2enmod and a2dismod commands were required
for the a2mod provider to be used by puppet on the first run.  Since
these commands are not always available on the first run, the catalog
application might fail.  This commit makes the commands optional, so the
provider's validity will be evaluated when an a2mod resource is enforced
2012-04-12 12:02:58 -05:00

22 lines
478 B
Ruby

Puppet::Type.type(:a2mod).provide(:a2mod) do
desc "Manage Apache 2 modules on Debian and Ubuntu"
optional_commands :encmd => "a2enmod"
optional_commands :discmd => "a2dismod"
defaultfor :operatingsystem => [:debian, :ubuntu]
def create
encmd resource[:name]
end
def destroy
discmd resource[:name]
end
def exists?
mod= "/etc/apache2/mods-enabled/" + resource[:name] + ".load"
File.exists?(mod)
end
end