2 # Cookbook Name:: apache
3 # Provider:: apache_module
5 # Copyright 2013, OpenStreetMap Foundation
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
26 package package_name do
27 version new_resource.version
36 t = template available_name("conf") do
37 source new_resource.conf
41 variables new_resource.variables
42 notifies :reload, "service[apache2]" if enabled?
45 updated = updated || t.updated_by_last_action?
48 new_resource.updated_by_last_action(updated)
53 link enabled_name("load") do
54 to available_name("load")
57 notifies :restart, "service[apache2]"
60 link enabled_name("conf") do
61 to available_name("conf")
64 notifies :reload, "service[apache2]"
65 only_if { ::File.exists?(available_name("conf")) }
68 new_resource.updated_by_last_action(true)
74 link enabled_name("load") do
76 notifies :restart, "service[apache2]"
79 link enabled_name("conf") do
81 notifies :reload, "service[apache2]"
84 new_resource.updated_by_last_action(true)
90 package package_name do
94 new_resource.updated_by_last_action(true)
99 new_resource.package || "libapache2-mod-#{new_resource.name}"
102 def available_name(extension)
103 "/etc/apache2/mods-available/#{new_resource.name}.#{extension}"
106 def enabled_name(extension)
107 "/etc/apache2/mods-enabled/#{new_resource.name}.#{extension}"
111 ::File.exists?(available_name("load"))
115 ::File.exists?(enabled_name("load"))