Update more cookbooks

This commit is contained in:
Greg Karékinian
2017-06-16 11:25:49 +02:00
parent 7da2c5a738
commit f5858319a7
129 changed files with 1095 additions and 101571 deletions

View File

@@ -1,89 +0,0 @@
#
# Author:: Chris Marchesi <cmarchesi@paybyphone.com>
# Cookbook:: php
# Provider:: fpm_pool
#
# Copyright:: 2015-2016, Chef Software, Inc <legal@chef.io>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
use_inline_resources
def whyrun_supported?
true
end
def install_fpm_package
# Install the FPM pacakge for this platform, if it's available
# Fail the run if it's an unsupported OS (FPM pacakge name not populated)
# also, this is skipped for source
return if node['php']['install_method'] == 'source'
raise 'PHP-FPM package not found (you probably have an unsupported distro)' if node['php']['fpm_package'].nil?
file node['php']['fpm_default_conf'] do
action :nothing
end
package node['php']['fpm_package'] do
action :install
notifies :delete, "file[#{node['php']['fpm_default_conf']}]", :immediately
end
end
def register_fpm_service
service node['php']['fpm_service'] do
action :enable
end
end
action :install do
# Ensure the FPM pacakge is installed, and the service is registered
install_fpm_package
register_fpm_service
# I wanted to have this as a function in itself, but doing this seems to
# break testing suites?
t = template "#{node['php']['fpm_pooldir']}/#{new_resource.pool_name}.conf" do
source 'fpm-pool.conf.erb'
action :create
cookbook 'php'
variables(
fpm_pool_name: new_resource.pool_name,
fpm_pool_user: new_resource.user,
fpm_pool_group: new_resource.group,
fpm_pool_listen: new_resource.listen,
fpm_pool_listen_user: new_resource.listen_user,
fpm_pool_listen_group: new_resource.listen_group,
fpm_pool_manager: new_resource.process_manager,
fpm_pool_max_children: new_resource.max_children,
fpm_pool_start_servers: new_resource.start_servers,
fpm_pool_min_spare_servers: new_resource.min_spare_servers,
fpm_pool_max_spare_servers: new_resource.max_spare_servers,
fpm_pool_chdir: new_resource.chdir,
fpm_pool_additional_config: new_resource.additional_config
)
notifies :restart, "service[#{node['php']['fpm_service']}]"
end
new_resource.updated_by_last_action(t.updated_by_last_action?)
end
action :uninstall do
# Ensure the FPM pacakge is installed, and the service is registered
register_fpm_service
# Delete the FPM pool.
f = file "#{node['php']['fpm_pooldir']}/#{new_resource.pool_name}.conf" do
action :delete
end
new_resource.updated_by_last_action(f.updated_by_last_action?)
end

View File

@@ -3,7 +3,7 @@
# Cookbook:: php
# Provider:: pear_package
#
# Copyright:: 2011-2016, Chef Software, Inc <legal@chef.io>
# Copyright:: 2011-2017, Chef Software, Inc <legal@chef.io>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -102,7 +102,7 @@ end
# so refactoring into core Chef should be easy
def load_current_resource
@current_resource = Chef::Resource::PhpPear.new(@new_resource.name)
@current_resource = new_resource.class.new(new_resource.name)
@current_resource.package_name(@new_resource.package_name)
@bin = node['php']['pear']
if pecl?
@@ -177,13 +177,13 @@ end
def enable_package(name)
execute "#{node['php']['enable_mod']} #{name}" do
only_if { platform?('ubuntu') && node['platform_version'].to_f >= 12.04 && ::File.exist?(node['php']['enable_mod']) }
only_if { platform?('ubuntu') && ::File.exist?(node['php']['enable_mod']) }
end
end
def disable_package(name)
execute "#{node['php']['disable_mod']} #{name}" do
only_if { platform?('ubuntu') && node['platform_version'].to_f >= 12.04 && ::File.exist?(node['php']['disable_mod']) }
only_if { platform?('ubuntu') && ::File.exist?(node['php']['disable_mod']) }
end
end