Do not vendor cookbooks using Berkshelf anymore
Instead, use the Berkshelf support in knife-solo and the vagrant-berkshelf plugin on Vagrant
This commit is contained in:
@@ -1,97 +0,0 @@
|
||||
#
|
||||
# Author:: Chris Marchesi <cmarchesi@paybyphone.com>
|
||||
# Cookbook:: php
|
||||
# Resource:: fpm_pool
|
||||
#
|
||||
# Copyright:: 2015-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.
|
||||
# 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.
|
||||
#
|
||||
|
||||
property :pool_name, String, name_property: true
|
||||
property :listen, String, default: lazy { node['php']['fpm_socket'] }
|
||||
property :user, String, default: lazy { node['php']['fpm_user'] }
|
||||
property :group, String, default: lazy { node['php']['fpm_group'] }
|
||||
property :listen_user, String, default: lazy { node['php']['fpm_listen_user'] }
|
||||
property :listen_group, String, default: lazy { node['php']['fpm_listen_group'] }
|
||||
property :process_manager, String, default: 'dynamic'
|
||||
property :max_children, Integer, default: 5
|
||||
property :start_servers, Integer, default: 2
|
||||
property :min_spare_servers, Integer, default: 1
|
||||
property :max_spare_servers, Integer, default: 3
|
||||
property :chdir, String, default: '/'
|
||||
property :additional_config, Hash, default: {}
|
||||
|
||||
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?
|
||||
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
|
||||
end
|
||||
|
||||
action :uninstall do
|
||||
# Ensure the FPM pacakge is installed, and the service is registered
|
||||
register_fpm_service
|
||||
# Delete the FPM pool.
|
||||
file "#{node['php']['fpm_pooldir']}/#{new_resource.pool_name}.conf" do
|
||||
action :delete
|
||||
end
|
||||
end
|
||||
|
||||
action_class do
|
||||
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
|
||||
end
|
||||
@@ -1,38 +0,0 @@
|
||||
#
|
||||
# Author:: Seth Chisamore <schisamo@chef.io>
|
||||
# Cookbook:: php
|
||||
# Resource:: pear_package
|
||||
#
|
||||
# Copyright:: 2011-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.
|
||||
#
|
||||
|
||||
default_action :install
|
||||
actions :install, :upgrade, :remove, :purge
|
||||
|
||||
state_attrs :channel,
|
||||
:directives,
|
||||
:options,
|
||||
:package_name,
|
||||
:preferred_state,
|
||||
:version,
|
||||
:zend_extensions
|
||||
|
||||
attribute :package_name, kind_of: String, name_attribute: true
|
||||
attribute :version, default: nil
|
||||
attribute :channel, kind_of: String
|
||||
attribute :options, kind_of: String
|
||||
attribute :directives, kind_of: Hash, default: {}
|
||||
attribute :zend_extensions, kind_of: Array, default: []
|
||||
attribute :preferred_state, default: 'stable'
|
||||
@@ -1,83 +0,0 @@
|
||||
#
|
||||
# Author:: Seth Chisamore <schisamo@chef.io>
|
||||
# Author:: Jennifer Davis <sigje@chef.io>
|
||||
# Cookbook:: php
|
||||
# Resource:: pear_channel
|
||||
#
|
||||
# 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.
|
||||
# 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.
|
||||
#
|
||||
|
||||
property :channel_xml, kind_of: String
|
||||
property :channel_name, kind_of: String, name_property: true
|
||||
property :pear, kind_of: String, default: lazy { node['php']['pear'] }
|
||||
# TODO: add authenticated channel support!
|
||||
# property :username, :kind_of => String
|
||||
# property :password, :kind_of => String
|
||||
|
||||
action :discover do
|
||||
unless exists?
|
||||
Chef::Log.info("Discovering pear channel #{new_resource}")
|
||||
execute "#{new_resource.pear} channel-discover #{new_resource.channel_name}" do
|
||||
action :run
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
action :add do
|
||||
unless exists?
|
||||
Chef::Log.info("Adding pear channel #{new_resource} from #{new_resource.channel_xml}")
|
||||
execute "#{new_resource.pear} channel-add #{new_resource.channel_xml}" do
|
||||
action :run
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
action :update do
|
||||
if exists?
|
||||
update_needed = false
|
||||
begin
|
||||
update_needed = true if shell_out("#{new_resource.pear} search -c #{new_resource.channel_name} NNNNNN").stdout =~ /channel-update/
|
||||
rescue Chef::Exceptions::CommandTimeout
|
||||
# CentOS can hang on 'pear search' if a channel needs updating
|
||||
Chef::Log.info("Timed out checking if channel-update needed...forcing update of pear channel #{new_resource}")
|
||||
update_needed = true
|
||||
end
|
||||
if update_needed
|
||||
description = "update pear channel #{new_resource}"
|
||||
converge_by(description) do
|
||||
Chef::Log.info("Updating pear channel #{new_resource}")
|
||||
shell_out!("#{new_resource.pear} channel-update #{new_resource.channel_name}")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
action :remove do
|
||||
if exists?
|
||||
Chef::Log.info("Deleting pear channel #{new_resource}")
|
||||
execute "#{new_resource.pear} channel-delete #{new_resource.channel_name}" do
|
||||
action :run
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
action_class do
|
||||
def exists?
|
||||
shell_out!("#{new_resource.pear} channel-info #{new_resource.channel_name}")
|
||||
true
|
||||
rescue Mixlib::ShellOut::ShellCommandFailed
|
||||
false
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user