Initial Chef repository
This commit is contained in:
38
cookbooks/mariadb/providers/configuration.rb
Normal file
38
cookbooks/mariadb/providers/configuration.rb
Normal file
@@ -0,0 +1,38 @@
|
||||
#
|
||||
# Cookbook Name:: mariadb
|
||||
# Provider:: configuration
|
||||
#
|
||||
|
||||
use_inline_resources if defined?(use_inline_resources)
|
||||
|
||||
def whyrun_supported?
|
||||
true
|
||||
end
|
||||
|
||||
action :add do
|
||||
variables_hash = {
|
||||
section: new_resource.section,
|
||||
options: new_resource.option
|
||||
}
|
||||
template node['mariadb']['configuration']['includedir'] + \
|
||||
'/' + new_resource.name + '.cnf' do
|
||||
source 'conf.d.generic.erb'
|
||||
owner 'root'
|
||||
group 'mysql'
|
||||
mode '0640'
|
||||
cookbook new_resource.cookbook
|
||||
variables variables_hash
|
||||
end
|
||||
end
|
||||
|
||||
action :remove do
|
||||
if ::File.exist?(node['mariadb']['configuration']['includedir'] + \
|
||||
'/' + new_resource.name + '.cnf')
|
||||
Chef::Log.info "Removing #{new_resource.name} repository from " + \
|
||||
node['mariadb']['configuration']['includedir']
|
||||
file node['mariadb']['configuration']['includedir'] + \
|
||||
'/' + new_resource.name + '.cnf' do
|
||||
action :delete
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user