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:: Jon DeCamp (<jon.decamp@nordstrom.com>)
# Cookbook:: iis
# Resource:: module
#
# Copyright:: 2012-2016, Nordstrom, Inc.
# Copyright:: 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,14 +17,119 @@
# limitations under the License.
#
actions :add, :delete, :install, :uninstall
include Opscode::IIS::Helper
include Opscode::IIS::Processors
include Opscode::IIS::SectionHelper
property :module_name, String, name_property: true
property :type, String
property :add, [true, false], default: false
property :image, String
property :precondition, String
property :application, String
property :previous_lock, String
default_action :add
attribute :module_name, kind_of: String, name_attribute: true
attribute :type, kind_of: String, default: nil
attribute :add, kind_of: [FalseClass, TrueClass], default: nil
attribute :image, kind_of: String, default: nil
attribute :precondition, kind_of: String, default: nil
attribute :application, kind_of: String, default: nil
load_current_value do |desired|
module_name desired.module_name
application desired.application if desired.application
# Sanitize Image Path (file system path)
desired.image = windows_cleanpath(desired.image) if desired.image
cmd = "#{appcmd(node)} list module /module.name:\"#{desired.module_name}\""
cmd << " /app.name:\"#{desired.application}\"" if desired.application
attr_accessor :exists
cmd_result = shell_out cmd
# 'MODULE "Module Name" ( type:module.type, preCondition:condition )'
# 'MODULE "Module Name" ( native, preCondition:condition )'
Chef::Log.debug("#{desired.name} list module command output: #{cmd_result.stdout}")
unless cmd_result.stdout.empty?
previous_lock get_current_lock(node, 'system.webServer/modules', desired.application)
cmd = "#{appcmd(node)} list module /module.name:\"#{desired.module_name}\""
cmd << " /app.name:\"#{desired.application}\"" if desired.application
cmd << ' /config:* /xml'
cmd_result = shell_out cmd
if cmd_result.stderr.empty?
xml = cmd_result.stdout
doc = Document.new(xml)
type value doc.root, 'MODULE/@type'
precondition value doc.root, 'MODULE/@preCondition'
end
end
end
# appcmd syntax for adding modules
# appcmd add module /name:string /type:string /preCondition:string
action :add do
if exists
Chef::Log.debug("#{new_resource} module already exists - nothing to do")
else
converge_by("add IIS module #{new_resource.module_name}") do
unlock(node, 'system.webServer/modules', new_resource.application)
cmd = "#{appcmd(node)} add module /module.name:\"#{new_resource.module_name}\""
cmd << " /app.name:\"#{new_resource.application}\"" if new_resource.application
cmd << " /type:\"#{new_resource.type}\"" if new_resource.type
cmd << " /preCondition:\"#{new_resource.precondition}\"" if new_resource.precondition
shell_out!(cmd, returns: [0, 42])
override_mode(node, current_resource.previous_lock, 'system.webServer/modules', new_resource.application)
end
end
end
action :delete do
if exists
converge_by("delete IIS module #{new_resource.module_name}") do
unlock(node, 'system.webServer/modules', new_resource.application)
cmd = "#{appcmd(node)} delete module /module.name:\"#{new_resource.module_name}\""
cmd << " /app.name:\"#{new_resource.application}\"" if new_resource.application
shell_out!(cmd, returns: [0, 42])
override_mode(node, current_resource.previous_lock, 'system.webServer/modules', new_resource.application)
end
else
Chef::Log.debug("#{new_resource} module does not exist - nothing to do")
end
end
# appcmd syntax for installing native modules
# appcmd install module /name:string /add:string(true|false) /image:string
action :install do
if exists
Chef::Log.debug("#{new_resource} module already exists - nothing to do")
else
converge_by("install IIS module #{new_resource.module_name}") do
unlock(node, 'system.webServer/modules', new_resource.application)
cmd = "#{appcmd(node)} install module /name:\"#{new_resource.module_name}\""
cmd << " /add:\"#{new_resource.add}\"" unless new_resource.add.nil?
cmd << " /image:\"#{new_resource.image}\"" if new_resource.image
cmd << " /preCondition:\"#{new_resource.precondition}\"" if new_resource.precondition
shell_out!(cmd, returns: [0, 42])
override_mode(node, current_resource.previous_lock, 'system.webServer/modules', new_resource.application)
end
end
end
# appcmd syntax for uninstalling native modules
# appcmd uninstall module <name>
action :uninstall do
if exists
converge_by("uninstall IIS module #{new_resource.module_name}") do
unlock(node, 'system.webServer/modules', new_resource.application)
cmd = "#{appcmd(node)} uninstall module \"#{new_resource.module_name}\""
shell_out!(cmd, returns: [0, 42])
override_mode(node, current_resource.previous_lock, 'system.webServer/modules', new_resource.application)
end
else
Chef::Log.debug("#{new_resource} module does not exists - nothing to do")
end
end
action_class.class_eval do
def exists
current_resource.type ? true : false
end
end