(#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
This commit is contained in:
Carl Caum 2012-04-12 12:02:58 -05:00
parent 98d774eaa8
commit a35ede5126

View File

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