From a35ede51266d784e724564bcc8eb21d7d0ed8a68 Mon Sep 17 00:00:00 2001 From: Carl Caum Date: Thu, 12 Apr 2012 12:02:58 -0500 Subject: [PATCH] (#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 --- lib/puppet/provider/a2mod/a2mod.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/puppet/provider/a2mod/a2mod.rb b/lib/puppet/provider/a2mod/a2mod.rb index a2fdd7c..56e293e 100644 --- a/lib/puppet/provider/a2mod/a2mod.rb +++ b/lib/puppet/provider/a2mod/a2mod.rb @@ -1,21 +1,21 @@ Puppet::Type.type(:a2mod).provide(:a2mod) do desc "Manage Apache 2 modules on Debian and Ubuntu" - - commands :encmd => "a2enmod" - commands :discmd => "a2dismod" - + + 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" + mod= "/etc/apache2/mods-enabled/" + resource[:name] + ".load" File.exists?(mod) end end