Update upstream cookbooks
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
#
|
||||
# Cookbook Name:: iis
|
||||
# Cookbook:: iis
|
||||
# Library:: helper
|
||||
#
|
||||
# Author:: Julian C. Dunn <jdunn@chef.io>
|
||||
# Author:: Justin Schuhmann <jmschu02@gmail.com>
|
||||
#
|
||||
# Copyright 2013, Chef Software, Inc.
|
||||
# Copyright:: 2013-2016, 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.
|
||||
@@ -67,11 +67,11 @@ module Opscode
|
||||
end
|
||||
|
||||
def windows_cleanpath(path)
|
||||
if !defined?(Chef::Util::PathHelper.cleanpath).nil?
|
||||
path = Chef::Util::PathHelper.cleanpath(path)
|
||||
else
|
||||
path = win_friendly_path(path)
|
||||
end
|
||||
path = if defined?(Chef::Util::PathHelper.cleanpath).nil?
|
||||
win_friendly_path(path)
|
||||
else
|
||||
Chef::Util::PathHelper.cleanpath(path)
|
||||
end
|
||||
# Remove any trailing slashes to prevent them from accidentally escaping any quotes.
|
||||
path.chomp('/').chomp('\\')
|
||||
end
|
||||
@@ -96,7 +96,7 @@ module Opscode
|
||||
version_string.slice! 'Version '
|
||||
@iis_version = version_string
|
||||
end
|
||||
@iis_version
|
||||
@iis_version.to_f
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
if defined?(ChefSpec)
|
||||
|
||||
def config_iis_config(command)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:iis_config, :config, command)
|
||||
[:set, :clear, :config].each do |action|
|
||||
self.class.send(:define_method, "#{action}_iis_config", proc do |config_name|
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:iis_config, action, config_name)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
[:config, :add, :delete].each do |action|
|
||||
@@ -53,11 +56,11 @@ if defined?(ChefSpec)
|
||||
)
|
||||
end
|
||||
|
||||
if Gem.loaded_specs['chefspec'].version < Gem::Version.new('4.1.0')
|
||||
define_method = ChefSpec::Runner.method(:define_runner_method)
|
||||
else
|
||||
define_method = ChefSpec.method(:define_matcher)
|
||||
end
|
||||
define_method = if Gem.loaded_specs['chefspec'].version < Gem::Version.new('4.1.0')
|
||||
ChefSpec::Runner.method(:define_runner_method)
|
||||
else
|
||||
ChefSpec.method(:define_matcher)
|
||||
end
|
||||
|
||||
define_method.call :iis_app
|
||||
define_method.call :iis_config
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#
|
||||
# Cookbook Name:: iis
|
||||
# Cookbook:: iis
|
||||
# Library:: helper
|
||||
#
|
||||
# Author:: Justin Schuhmann <jmschu02@gmail.com>
|
||||
#
|
||||
# Copyright 2013, Chef Software, Inc.
|
||||
# Copyright:: 2013-2016, 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.
|
||||
@@ -37,21 +37,19 @@ module Opscode
|
||||
cmd << " /enabled:#{default_documents_enabled}"
|
||||
end
|
||||
|
||||
if add || remove
|
||||
default_document.each do |document|
|
||||
if !current_default_documents.include?(document) && add
|
||||
cmd << " /+files.[value='#{document}']"
|
||||
elsif current_default_documents.include?(document) && remove
|
||||
cmd << " /-files.[value='#{document}']"
|
||||
end
|
||||
if add
|
||||
(default_document - current_default_documents).each do |document|
|
||||
cmd << " /+files.[value='#{document}']"
|
||||
end
|
||||
end
|
||||
|
||||
if add && remove
|
||||
current_default_documents.each do |document|
|
||||
unless default_document.include? document
|
||||
cmd << " /-files.[value='#{document}']"
|
||||
end
|
||||
if remove && !add
|
||||
(default_document - current_default_documents).each do |document|
|
||||
cmd << " /-files.[value='#{document}']"
|
||||
end
|
||||
end
|
||||
if remove && add
|
||||
(current_default_documents - default_document).each do |document|
|
||||
cmd << " /-files.[value='#{document}']"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -68,28 +66,25 @@ module Opscode
|
||||
xml = cmd.stdout
|
||||
doc = REXML::Document.new xml
|
||||
current_mime_maps = REXML::XPath.match(doc.root, 'CONFIG/system.webServer-staticContent/mimeMap').map { |x| "fileExtension='#{x.attribute 'fileExtension'}',mimeType='#{x.attribute 'mimeType'}'" }
|
||||
|
||||
cmd = mime_map_command specifier
|
||||
|
||||
if add || remove
|
||||
new_resource_mime_maps.each do |mime_map|
|
||||
if !current_mime_maps.include?(mime_map) && add
|
||||
cmd << " /+\"[#{mime_map}]\""
|
||||
elsif current_mime_maps.include?(mime_map) && remove
|
||||
cmd << " /-\"[#{mime_map}]\""
|
||||
end
|
||||
if add
|
||||
(new_resource_mime_maps - current_mime_maps).each do |mime_map|
|
||||
cmd << " /+\"[#{mime_map}]\""
|
||||
end
|
||||
end
|
||||
if remove && !add
|
||||
(new_resource_mime_maps - current_mime_maps).each do |mime_map|
|
||||
cmd << " /-\"[#{mime_map}]\""
|
||||
end
|
||||
end
|
||||
if remove && add
|
||||
(current_mime_maps - new_resource_mime_maps).each do |mime_map|
|
||||
cmd << " /-\"[#{mime_map}]\""
|
||||
end
|
||||
end
|
||||
|
||||
if add && remove
|
||||
current_mime_maps.each do |mime_map|
|
||||
unless new_resource_mime_maps.include? mime_map
|
||||
cmd << " /-\"[#{mime_map}]\""
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return unless (cmd != mime_map_command(specifier))
|
||||
return unless cmd != mime_map_command(specifier)
|
||||
shell_out! cmd
|
||||
Chef::Log.info('mime maps updated')
|
||||
@was_updated = true
|
||||
|
||||
Reference in New Issue
Block a user