Downgrade mysql cookbook for now

It doesn't play well with our current dev server setup
This commit is contained in:
Greg Karékinian
2017-06-16 22:43:51 +02:00
parent e39792ea36
commit bdfb3a1afb
398 changed files with 12716 additions and 10889 deletions

View File

@@ -1,9 +1,8 @@
#
# Author:: Kendrick Martin (kendrick.martin@webtrends.com>)
# Cookbook:: iis
# Resource:: app
#
# Copyright:: 2011-2016, Webtrends Inc.
# Copyright:: 2011-2017, Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -18,15 +17,130 @@
# limitations under the License.
#
actions :add, :delete, :config
require 'rexml/document'
include REXML
include Opscode::IIS::Helper
property :site_name, String, name_property: true
property :path, String, default: '/'
property :application_pool, String
property :physical_path, String
property :enabled_protocols, String
default_action :add
attribute :site_name, kind_of: String, name_attribute: true
attribute :path, kind_of: String, default: '/'
attribute :application_pool, kind_of: String
attribute :physical_path, kind_of: String
attribute :enabled_protocols, kind_of: String
attribute :default_documents, kind_of: Array, default: []
attribute :mime_maps, kind_of: Array, default: []
load_current_value do |desired|
site_name desired.site_name
# Sanitize physical path
desired.physical_path = windows_cleanpath(desired.physical_path) if desired.physical_path
cmd = shell_out("#{appcmd(node)} list app \"#{desired.site_name}#{desired.path}\"")
Chef::Log.debug("#{appcmd(node)} list app command output: #{cmd.stdout}")
if cmd.stderr.empty?
Chef::Log.debug('Running regex')
regex = /^APP\s\"#{desired.site_name}#{desired.path}\"/
result = cmd.stdout.match(regex)
Chef::Log.debug("#{desired} current_resource match output: #{result}")
if !result.nil?
cmd_current_values = "#{appcmd(node)} list app \"#{desired.site_name}#{desired.path}\" /config:* /xml"
Chef::Log.debug(cmd_current_values)
cmd_current_values = shell_out(cmd_current_values)
if cmd_current_values.stderr.empty?
xml = cmd_current_values.stdout
doc = Document.new(xml)
path value doc.root, 'APP/application/@path'
application_pool value doc.root, 'APP/application/@applicationPool'
enabled_protocols value doc.root, 'APP/application/@enabledProtocols'
physical_path windows_cleanpath(value(doc.root, 'APP/application/virtualDirectory/@physicalPath'))
end
else
path ''
end
else
Chef::Log.warn "Failed to run iis_app action :load_current_resource, #{cmd_current_values.stderr}"
end
end
attr_accessor :exists, :running
action :add do
if exists
Chef::Log.debug("#{new_resource.inspect} app already exists - nothing to do")
else
converge_by "Creating the Application - \"#{new_resource}\"" do
cmd = "#{appcmd(node)} add app /site.name:\"#{new_resource.site_name}\""
cmd << " /path:\"#{new_resource.path}\""
cmd << " /applicationPool:\"#{new_resource.application_pool}\"" if new_resource.application_pool
cmd << " /physicalPath:\"#{new_resource.physical_path}\"" if new_resource.physical_path
cmd << " /enabledProtocols:\"#{new_resource.enabled_protocols}\"" if new_resource.enabled_protocols
cmd << ' /commit:\"MACHINE/WEBROOT/APPHOST\"'
Chef::Log.debug(cmd)
shell_out!(cmd)
end
end
end
action :config do
if exists
# only get the beginning of the command if there is something that changes
cmd = cmd_set_app
converge_if_changed :path do
# adds path to the cmd
cmd << " /path:\"#{new_resource.path}\"" if new_resource.path
end
converge_if_changed :application_pool do
# adds applicationPool to the cmd
cmd << " /applicationPool:\"#{new_resource.application_pool}\"" if new_resource.application_pool
end
converge_if_changed :enabled_protocols do
# adds enabledProtocols to the cmd
cmd << " /enabledProtocols:\"#{new_resource.enabled_protocols}\"" if new_resource.enabled_protocols
end
Chef::Log.debug(cmd)
if cmd == cmd_set_app
Chef::Log.debug("#{new_resource.inspect} application - nothing to do")
else
converge_by "Updating the Application - \"#{new_resource}\"" do
shell_out!(cmd)
end
end
converge_if_changed :physical_path do
cmd = "#{appcmd(node)} set vdir /vdir.name:\"#{vdir_identifier}\""
cmd << " /physicalPath:\"#{new_resource.physical_path}\""
Chef::Log.debug(cmd)
shell_out!(cmd)
end
else
Chef::Log.debug("#{new_resource.inspect} app needs to be added - cannot configure non-existent items")
end
end
action :delete do
if exists
converge_by "Deleting the Application - \"#{new_resource}\"" do
shell_out!("#{appcmd(node)} delete app \"#{site_identifier}\"")
Chef::Log.info("#{new_resource} deleted")
end
else
Chef::Log.debug("#{new_resource.inspect} app does not exist - nothing to do")
end
end
action_class.class_eval do
def exists
!current_resource.path.empty?
end
def cmd_set_app
"#{appcmd(node)} set app \"#{site_identifier}\""
end
def site_identifier
"#{new_resource.site_name}#{new_resource.path}"
end
# Ensure VDIR identifier has a trailing slash
def vdir_identifier
site_identifier.end_with?('/') ? site_identifier : site_identifier + '/'
end
end