Update cookbooks and add wordpress cookbook
This commit is contained in:
@@ -1,27 +1,50 @@
|
||||
v4.1.1 (2015-05-07)
|
||||
-------------------
|
||||
# iis Cookbook CHANGELOG
|
||||
This file is used to list changes made in each version of the iis cookbook.
|
||||
|
||||
## v4.1.6 (2016-02-01)
|
||||
- Resolves issues with [Unable to set app pool to be "No Managed Code"](https://github.com/chef-cookbooks/iis/issues/240)
|
||||
- Resolves [Add_mime_maps is throwing compile error](https://github.com/chef-cookbooks/iis/issues/238)
|
||||
- Resolves [FATAL: NameError: iis_root "xxx" had an error: NameError: No resource, method, or local variable named `was _updated' for`LWRP provider iis_root from cookbook iis](https://github.com/chef-cookbooks/iis/issues/236)
|
||||
|
||||
## v4.1.5 (2015-11-18)
|
||||
- Resolves issues with `iis_root` [#222](https://github.com/chef-cookbooks/iis/issues/222)
|
||||
|
||||
## v4.1.4 (2015-11-2)
|
||||
- Re-added functionality for iis_pool auto_start, this was a breaking change
|
||||
|
||||
## v4.1.3 (2015-10-30)
|
||||
- Resolves Robucop issues
|
||||
- Bug Fix for [#217](https://github.com/chef-cookbooks/iis/issues/217)
|
||||
|
||||
## v4.1.2 (2015-10-21)
|
||||
- Bug fixes for application pool provider and site provider
|
||||
- Added the ability to detect the IIS Version, allowing for some properties to only exist for specific IIS versions
|
||||
- Fixed issue with Win32 being required on linux
|
||||
- Added support for mimeTypes and defaultDocuments on iis_sites
|
||||
- Added iis config set and clear abilities
|
||||
|
||||
## v4.1.1 (2015-05-07)
|
||||
- Detects changes in the physical path of apps.
|
||||
- Adds support for gMSA identity.
|
||||
- Performing add on a site will now reconfigure it if necessary.
|
||||
- Lock and unlock commands on configuration sections now use -commit:apphost.
|
||||
- Fix issue where popeline_mode was ignored during configuration of a pool.
|
||||
|
||||
v4.1.0 (2015-03-04)
|
||||
-------------------
|
||||
## v4.1.0 (2015-03-04)
|
||||
- Removed iis_pool attribute 'set_profile_environment' incompatible with < IIS-8.
|
||||
- Added pester test framework.
|
||||
- Condensed and fixed change-log to show public releases only.
|
||||
- Fixed bug where bindings were being overwritten by :config.
|
||||
- Code-cleanup and cosmetic fixes.
|
||||
|
||||
v4.0.0 (2015-02-12)
|
||||
-------------------
|
||||
## v4.0.0 (2015-02-12)
|
||||
- [#91](https://github.com/chef-cookbooks/iis/pull/91) - bulk addition of new features
|
||||
- Virtual Directory Support (allows virtual directories to be added to both websites and to webapplications under sites).
|
||||
- section unlock and lock support (this is used to allow for the web.config of a site to define the authentication methods).
|
||||
- fixed issue with :add on pool provider not running all config (this was a known issue and is now resolved).
|
||||
- fixed issue with :config on all providers causing application pool recycles (every chef-client run).
|
||||
- moved to better method for XML checking of previous settings to detect changes (changed all check to use xml searching with appcmd instead of the previous method [none]).
|
||||
|
||||
- Improved pool resource with many more apppool properties that can be set.
|
||||
- Fixed bug with default attribute inheritance.
|
||||
- New recipe to enable ASP.NET 4.5.
|
||||
@@ -34,150 +57,112 @@ v4.0.0 (2015-02-12)
|
||||
- [#98] Fixed issues with bindings.
|
||||
- added backwards compatibility for chef-client < 12.x.x Chef::Util::PathHelper.
|
||||
|
||||
v2.1.6 (2014-11-12)
|
||||
-------------------
|
||||
## v2.1.6 (2014-11-12)
|
||||
- [#78] Adds new_resource.updated_by_last_action calls
|
||||
|
||||
v2.1.5 (2014-09-15)
|
||||
-------------------
|
||||
## v2.1.5 (2014-09-15)
|
||||
- [#68] Add win_friendly_path to all appcmd.exe /physicalPath arguments
|
||||
|
||||
v2.1.4 (2014-09-13)
|
||||
-------------------
|
||||
## v2.1.4 (2014-09-13)
|
||||
- [#72] Adds chefspec matchers
|
||||
- [#57] Fixes site_id not being updated on a :config action
|
||||
|
||||
v2.1.2 (2014-04-23)
|
||||
-------------------
|
||||
## v2.1.2 (2014-04-23)
|
||||
- [COOK-4559] Remove invalid UTF-8 characters
|
||||
|
||||
## v2.1.0 (2014-03-25)
|
||||
[COOK-4426] - feature order correction for proper installation [COOK-4428] - Add IIS FTP Feature Installation
|
||||
|
||||
v2.1.0 (2014-03-25)
|
||||
-------------------
|
||||
[COOK-4426] - feature order correction for proper installation
|
||||
[COOK-4428] - Add IIS FTP Feature Installation
|
||||
|
||||
|
||||
v2.0.4 (2014-03-18)
|
||||
-------------------
|
||||
## v2.0.4 (2014-03-18)
|
||||
- [COOK-4420] Corrected incorrect feature names for mod_security
|
||||
|
||||
|
||||
v2.0.2 (2014-02-25)
|
||||
-------------------
|
||||
## v2.0.2 (2014-02-25)
|
||||
- [COOK-4108] - Add documentation for the 'bindings' attribute in 'iis_site' LWRP
|
||||
|
||||
|
||||
v2.0.0 (2014-01-03)
|
||||
-------------------
|
||||
## v2.0.0 (2014-01-03)
|
||||
Major version bump
|
||||
|
||||
|
||||
v1.6.6
|
||||
------
|
||||
## v1.6.6
|
||||
Adding extra windows platform checks to helper library
|
||||
|
||||
|
||||
v1.6.4
|
||||
------
|
||||
## v1.6.4
|
||||
### Bug
|
||||
- **[COOK-4138](https://tickets.chef.io/browse/COOK-4138)** - iis cookbook won't load on non-Windows platforms
|
||||
|
||||
|
||||
v1.6.2
|
||||
------
|
||||
## v1.6.2
|
||||
### Improvement
|
||||
- **[COOK-3634](https://tickets.chef.io/browse/COOK-3634)** - provide ability to set app pool managedRuntimeVersion to "No Managed Code"
|
||||
|
||||
|
||||
v1.6.0
|
||||
------
|
||||
## v1.6.0
|
||||
### Improvement
|
||||
- **[COOK-3922](https://tickets.chef.io/browse/COOK-3922)** - refactor IIS cookbook to not require WebPI
|
||||
|
||||
|
||||
v1.5.6
|
||||
------
|
||||
## v1.5.6
|
||||
### Improvement
|
||||
- **[COOK-3770](https://tickets.chef.io/browse/COOK-3770)** - Add Enabled Protocols to IIS App Recipe
|
||||
|
||||
|
||||
v1.5.4
|
||||
------
|
||||
## v1.5.4
|
||||
### New Feature
|
||||
- **[COOK-3675](https://tickets.chef.io/browse/COOK-3675)** - Add recipe for CGI module
|
||||
|
||||
v1.5.2
|
||||
------
|
||||
## v1.5.2
|
||||
### Bug
|
||||
- **[COOK-3232](https://tickets.chef.io/browse/COOK-3232)** - Allow `iis_app` resource `:config` action with a virtual path
|
||||
|
||||
v1.5.0
|
||||
------
|
||||
## v1.5.0
|
||||
### Improvement
|
||||
|
||||
- [COOK-2370]: add MVC2, escape `application_pool` and add options for
|
||||
recycling
|
||||
- recycling
|
||||
- [COOK-2694]: update iis documentation to show that Windows 2012 and
|
||||
Windows 8 are supported
|
||||
- Windows 8 are supported
|
||||
|
||||
### Bug
|
||||
|
||||
- [COOK-2325]: `load_current_resource` does not load state of pool
|
||||
correctly, always sets running to false
|
||||
- correctly, always sets running to false
|
||||
- [COOK-2526]: Installing IIS after .NET framework will leave
|
||||
installation in non-working state
|
||||
- installation in non-working state
|
||||
- [COOK-2596]: iis cookbook fails with indecipherable error if EULA
|
||||
not accepted
|
||||
- not accepted
|
||||
|
||||
v1.4.0
|
||||
------
|
||||
* [COOK-2181] -Adding full module support to iis cookbook
|
||||
## v1.4.0
|
||||
- [COOK-2181] -Adding full module support to iis cookbook
|
||||
|
||||
v1.3.6
|
||||
------
|
||||
* [COOK-2084] - Add support for additional options during site creation
|
||||
* [COOK-2152] - Add recipe for IIS6 metabase compatibility
|
||||
## v1.3.6
|
||||
- [COOK-2084] - Add support for additional options during site creation
|
||||
- [COOK-2152] - Add recipe for IIS6 metabase compatibility
|
||||
|
||||
v1.3.4
|
||||
------
|
||||
* [COOK-2050] - IIS cookbook does not have returns resource defined
|
||||
## v1.3.4
|
||||
- [COOK-2050] - IIS cookbook does not have returns resource defined
|
||||
|
||||
v1.3.2
|
||||
------
|
||||
* [COOK-1251] - Fix LWRP "NotImplementedError"
|
||||
## v1.3.2
|
||||
- [COOK-1251] - Fix LWRP "NotImplementedError"
|
||||
|
||||
v1.3.0
|
||||
------
|
||||
* [COOK-1301] - Add a recycle action to the iis_pool resource
|
||||
* [COOK-1665] - app pool identity and new node[iis][component] attribute
|
||||
* [COOK-1666] - Recipe to remove default site and app pool
|
||||
* [COOK-1858] - Recipe misspelled
|
||||
## v1.3.0
|
||||
- [COOK-1301] - Add a recycle action to the iis_pool resource
|
||||
- [COOK-1665] - app pool identity and new node[iis][component] attribute
|
||||
- [COOK-1666] - Recipe to remove default site and app pool
|
||||
- [COOK-1858] - Recipe misspelled
|
||||
|
||||
v1.2.0
|
||||
------
|
||||
* [COOK-1061] - `iis_site` doesn't allow setting the pool
|
||||
* [COOK-1078] - handle advanced bindings
|
||||
* [COOK-1283] - typo on pool
|
||||
* [COOK-1284] - install iis application initialization
|
||||
* [COOK-1285] - allow multiple host_header, port and protocol
|
||||
* [COOK-1286] - allow directly setting which app pool on site creation
|
||||
* [COOK-1449] - iis pool regex returns true if similar site exists
|
||||
* [COOK-1647] - mod_ApplicationInitialization isn't RC
|
||||
## v1.2.0
|
||||
- [COOK-1061] - `iis_site` doesn't allow setting the pool
|
||||
- [COOK-1078] - handle advanced bindings
|
||||
- [COOK-1283] - typo on pool
|
||||
- [COOK-1284] - install iis application initialization
|
||||
- [COOK-1285] - allow multiple host_header, port and protocol
|
||||
- [COOK-1286] - allow directly setting which app pool on site creation
|
||||
- [COOK-1449] - iis pool regex returns true if similar site exists
|
||||
- [COOK-1647] - mod_ApplicationInitialization isn't RC
|
||||
|
||||
v1.1.0
|
||||
------
|
||||
* [COOK-1012] - support adding apps
|
||||
* [COOK-1028] - support for config command
|
||||
* [COOK-1041] - fix removal in app pools
|
||||
* [COOK-835] - add app pool management
|
||||
* [COOK-950] - documentation correction for version of IIS/OS
|
||||
## v1.1.0
|
||||
- [COOK-1012] - support adding apps
|
||||
- [COOK-1028] - support for config command
|
||||
- [COOK-1041] - fix removal in app pools
|
||||
- [COOK-835] - add app pool management
|
||||
- [COOK-950] - documentation correction for version of IIS/OS
|
||||
|
||||
v1.0.2
|
||||
------
|
||||
* Ruby 1.9 compat fixes
|
||||
* ensure carriage returns are removed before applying regex
|
||||
## v1.0.2
|
||||
- Ruby 1.9 compat fixes
|
||||
- ensure carriage returns are removed before applying regex
|
||||
|
||||
v1.0.0
|
||||
------
|
||||
* [COOK-718] initial release
|
||||
## v1.0.0
|
||||
- [COOK-718] initial release
|
||||
|
||||
2
cookbooks/iis/CONTRIBUTING.md
Normal file
2
cookbooks/iis/CONTRIBUTING.md
Normal file
@@ -0,0 +1,2 @@
|
||||
Please refer to
|
||||
https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD
|
||||
25
cookbooks/iis/MAINTAINERS.md
Normal file
25
cookbooks/iis/MAINTAINERS.md
Normal file
@@ -0,0 +1,25 @@
|
||||
<!-- This is a generated file. Please do not edit directly -->
|
||||
|
||||
# Maintainers
|
||||
This file lists how this cookbook project is maintained. When making changes to the system, this
|
||||
file tells you who needs to review your patch - you need a simple majority of maintainers
|
||||
for the relevant subsystems to provide a :+1: on your pull request. Additionally, you need
|
||||
to not receive a veto from a Lieutenant or the Project Lead.
|
||||
|
||||
Check out [How Cookbooks are Maintained](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD)
|
||||
for details on the process and how to become a maintainer or the project lead.
|
||||
|
||||
# Project Maintainer
|
||||
* [Adam Edwards](https://github.com/adamedx)
|
||||
|
||||
# Maintainers
|
||||
* [Adam Edwards](https://github.com/adamedx)
|
||||
* [Kartik Null Cating-Subramanian](https://github.com/ksubrama)
|
||||
* [Steven Murawski](https://github.com/smurawski)
|
||||
* [Matt Wrock](https://github.com/mwrock)
|
||||
* [Jay Mundrawala](https://github.com/jaym)
|
||||
* [Claire McQuin](https://github.com/mcquin)
|
||||
* [Salim Alam](https://github.com/chefsalim)
|
||||
* [Sean OMeara](https://github.com/someara)
|
||||
* [Tim Smith](https://github.com/tas50)
|
||||
* [Jennifer Davis](https://github.com/sigje)
|
||||
File diff suppressed because one or more lines are too long
@@ -25,3 +25,5 @@ default['iis']['docroot'] = "#{ENV['SYSTEMDRIVE']}\\inetpub\\wwwroot"
|
||||
default['iis']['log_dir'] = "#{ENV['SYSTEMDRIVE']}\\inetpub\\logs\\LogFiles"
|
||||
default['iis']['cache_dir'] = "#{ENV['SYSTEMDRIVE']}\\inetpub\\temp"
|
||||
default['iis']['components'] = []
|
||||
|
||||
default['iis']['source'] = nil
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
# Library:: helper
|
||||
#
|
||||
# Author:: Julian C. Dunn <jdunn@chef.io>
|
||||
# Author:: Justin Schuhmann <jmschu02@gmail.com>
|
||||
#
|
||||
# Copyright 2013, Chef Software, Inc.
|
||||
#
|
||||
@@ -23,11 +24,17 @@ module Opscode
|
||||
module IIS
|
||||
# Contains functions that are used throughout this cookbook
|
||||
module Helper
|
||||
@iis_version = nil
|
||||
|
||||
if RUBY_PLATFORM =~ /mswin|mingw32|windows/
|
||||
require 'chef/win32/version'
|
||||
require 'win32/registry'
|
||||
end
|
||||
|
||||
require 'rexml/document'
|
||||
require 'chef/mixin/shell_out'
|
||||
|
||||
include Chef::Mixin::ShellOut
|
||||
include REXML
|
||||
include Windows::Helper
|
||||
|
||||
@@ -82,6 +89,15 @@ module Opscode
|
||||
"#{node['iis']['home']}\\appcmd.exe"
|
||||
end
|
||||
end
|
||||
|
||||
def iis_version
|
||||
if @iis_version.nil?
|
||||
version_string = Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\Microsoft\InetStp').read('VersionString')[1]
|
||||
version_string.slice! 'Version '
|
||||
@iis_version = version_string
|
||||
end
|
||||
@iis_version
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,57 +5,59 @@ if defined?(ChefSpec)
|
||||
end
|
||||
|
||||
[:config, :add, :delete].each do |action|
|
||||
self.class.send(:define_method, "#{action}_iis_app", proc do |app_name|
|
||||
self.class.send(:define_method, "#{action}_iis_app", proc do |app_name|
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:iis_app, action, app_name)
|
||||
end
|
||||
)
|
||||
)
|
||||
end
|
||||
|
||||
[:config].each do |action|
|
||||
self.class.send(:define_method, "#{action}_iis_lock", proc do |section|
|
||||
self.class.send(:define_method, "#{action}_iis_lock", proc do |section|
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:iis_lock, action, section)
|
||||
end
|
||||
)
|
||||
)
|
||||
end
|
||||
|
||||
[:add, :delete].each do |action|
|
||||
[:add, :delete, :install, :uninstall].each do |action|
|
||||
self.class.send(:define_method, "#{action}_iis_module", proc do |module_name|
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:iis_module, action, module_name)
|
||||
end
|
||||
)
|
||||
)
|
||||
end
|
||||
|
||||
[:add, :config, :delete, :start, :stop, :restart, :recycle].each do |action|
|
||||
self.class.send(:define_method, "#{action}_iis_pool", proc do |pool_name|
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:iis_pool, action, pool_name)
|
||||
end
|
||||
)
|
||||
)
|
||||
end
|
||||
|
||||
[:add, :delete, :start, :stop, :restart, :config].each do |action|
|
||||
self.class.send(:define_method, "#{action}_iis_site", proc do |site_name|
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:iis_site, action, site_name)
|
||||
end
|
||||
)
|
||||
)
|
||||
end
|
||||
|
||||
[:config].each do |action|
|
||||
self.class.send(:define_method, "#{action}_iis_unlock", proc do |section|
|
||||
self.class.send(:define_method, "#{action}_iis_unlock", proc do |section|
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:iis_unlock, action, section)
|
||||
end
|
||||
)
|
||||
)
|
||||
end
|
||||
|
||||
[:add, :config, :delete].each do |action|
|
||||
self.class.send(:define_method, "#{action}_iis_vdir", proc do |section|
|
||||
self.class.send(:define_method, "#{action}_iis_vdir", proc do |section|
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:iis_vdir, action, section)
|
||||
end
|
||||
)
|
||||
)
|
||||
end
|
||||
|
||||
define_method = (Gem.loaded_specs['chefspec'].version < Gem::Version.new('4.1.0')) ?
|
||||
ChefSpec::Runner.method(:define_runner_method) :
|
||||
ChefSpec.method(:define_matcher)
|
||||
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.call :iis_app
|
||||
define_method.call :iis_config
|
||||
|
||||
117
cookbooks/iis/libraries/processors.rb
Normal file
117
cookbooks/iis/libraries/processors.rb
Normal file
@@ -0,0 +1,117 @@
|
||||
#
|
||||
# Cookbook Name:: iis
|
||||
# Library:: helper
|
||||
#
|
||||
# Author:: Justin Schuhmann <jmschu02@gmail.com>
|
||||
#
|
||||
# Copyright 2013, 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.
|
||||
# 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.
|
||||
#
|
||||
|
||||
module Opscode
|
||||
module IIS
|
||||
# Contains functions that are used throughout this cookbook
|
||||
module Processors
|
||||
def default_documents(default_document, default_documents_enabled, add = true, remove = true, specifier = '')
|
||||
cmd = shell_out! get_default_documents_command specifier
|
||||
return unless cmd.stderr.empty?
|
||||
xml = cmd.stdout
|
||||
doc = REXML::Document.new xml
|
||||
|
||||
is_new_default_documents_enabled = new_value?(doc.root, 'CONFIG/system.webServer-defaultDocument/@enabled', default_documents_enabled.to_s)
|
||||
current_default_documents = REXML::XPath.match(doc.root, 'CONFIG/system.webServer-defaultDocument/files/add/@value').map(&:value)
|
||||
cmd = default_documents_command specifier
|
||||
|
||||
if is_new_default_documents_enabled
|
||||
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
|
||||
end
|
||||
end
|
||||
|
||||
if add && remove
|
||||
current_default_documents.each do |document|
|
||||
unless default_document.include? document
|
||||
cmd << " /-files.[value='#{document}']"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return unless cmd != default_documents_command(specifier)
|
||||
shell_out! cmd
|
||||
Chef::Log.info('Default Documents updated')
|
||||
@was_updated = true
|
||||
end
|
||||
|
||||
def mime_maps(new_resource_mime_maps, add = true, remove = true, specifier = '')
|
||||
# handles mime maps
|
||||
cmd = shell_out get_mime_map_command specifier
|
||||
return unless cmd.stderr.empty?
|
||||
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
|
||||
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))
|
||||
shell_out! cmd
|
||||
Chef::Log.info('mime maps updated')
|
||||
@was_updated = true
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def get_default_documents_command(specifier = '')
|
||||
"#{appcmd(node)} list config #{specifier} /section:defaultDocument /config:* /xml"
|
||||
end
|
||||
|
||||
def default_documents_command(specifier = '')
|
||||
"#{appcmd(node)} set config #{specifier} /section:defaultDocument"
|
||||
end
|
||||
|
||||
def get_mime_map_command(specifier = '')
|
||||
"#{appcmd(node)} list config #{specifier} /section:staticContent /config:* /xml"
|
||||
end
|
||||
|
||||
def mime_map_command(specifier = '')
|
||||
"#{appcmd(node)} set config #{specifier} /section:staticContent"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
File diff suppressed because one or more lines are too long
@@ -25,6 +25,7 @@ require 'rexml/document'
|
||||
include Chef::Mixin::ShellOut
|
||||
include REXML
|
||||
include Opscode::IIS::Helper
|
||||
include Opscode::IIS::Processors
|
||||
|
||||
action :add do
|
||||
if !@current_resource.exists
|
||||
@@ -33,6 +34,7 @@ action :add do
|
||||
cmd << " /applicationPool:\"#{new_resource.application_pool}\"" if new_resource.application_pool
|
||||
cmd << " /physicalPath:\"#{windows_cleanpath(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)
|
||||
new_resource.updated_by_last_action(true)
|
||||
@@ -43,7 +45,7 @@ action :add do
|
||||
end
|
||||
|
||||
action :config do
|
||||
was_updated = false
|
||||
@was_updated = false
|
||||
cmd_current_values = "#{appcmd(node)} list app \"#{site_identifier}\" /config:* /xml"
|
||||
Chef::Log.debug(cmd_current_values)
|
||||
cmd_current_values = shell_out(cmd_current_values)
|
||||
@@ -56,9 +58,9 @@ action :config do
|
||||
is_new_physical_path = new_or_empty_value?(doc.root, 'APP/application/virtualDirectory/@physicalPath', new_resource.physical_path.to_s)
|
||||
|
||||
# only get the beginning of the command if there is something that changeds
|
||||
cmd = "#{appcmd(node)} set app \"#{site_identifier}\"" if ((new_resource.path && is_new_path) ||
|
||||
(new_resource.application_pool && is_new_application_pool) ||
|
||||
(new_resource.enabled_protocols && is_new_enabled_protocols))
|
||||
cmd = "#{appcmd(node)} set app \"#{site_identifier}\"" if (new_resource.path && is_new_path) ||
|
||||
(new_resource.application_pool && is_new_application_pool) ||
|
||||
(new_resource.enabled_protocols && is_new_enabled_protocols)
|
||||
# adds path to the cmd
|
||||
cmd << " /path:\"#{new_resource.path}\"" if new_resource.path && is_new_path
|
||||
# adds applicationPool to the cmd
|
||||
@@ -67,27 +69,27 @@ action :config do
|
||||
cmd << " /enabledProtocols:\"#{new_resource.enabled_protocols}\"" if new_resource.enabled_protocols && is_new_enabled_protocols
|
||||
Chef::Log.debug(cmd)
|
||||
|
||||
if (cmd.nil?)
|
||||
if cmd.nil?
|
||||
Chef::Log.debug("#{new_resource} application - nothing to do")
|
||||
else
|
||||
shell_out!(cmd)
|
||||
was_updated = true
|
||||
@was_updated = true
|
||||
end
|
||||
|
||||
if ((new_resource.path && is_new_path) ||
|
||||
(new_resource.application_pool && is_new_application_pool) ||
|
||||
(new_resource.enabled_protocols && is_new_enabled_protocols))
|
||||
was_updated = true
|
||||
if (new_resource.path && is_new_path) ||
|
||||
(new_resource.application_pool && is_new_application_pool) ||
|
||||
(new_resource.enabled_protocols && is_new_enabled_protocols)
|
||||
@was_updated = true
|
||||
end
|
||||
|
||||
if new_resource.physical_path && is_new_physical_path
|
||||
was_updated = true
|
||||
@was_updated = true
|
||||
cmd = "#{appcmd(node)} set vdir /vdir.name:\"#{vdir_identifier}\""
|
||||
cmd << " /physicalPath:\"#{windows_cleanpath(new_resource.physical_path)}\""
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
end
|
||||
if was_updated
|
||||
if @was_updated
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info("#{new_resource} configured application")
|
||||
else
|
||||
|
||||
@@ -23,9 +23,23 @@ require 'chef/mixin/shell_out'
|
||||
|
||||
include Chef::Mixin::ShellOut
|
||||
include Opscode::IIS::Helper
|
||||
include Opscode::IIS::Processors
|
||||
|
||||
# :config deprecated, use :set instead
|
||||
action :config do
|
||||
cmd = "#{appcmd(node)} set config #{new_resource.cfg_cmd}"
|
||||
config
|
||||
end
|
||||
|
||||
action :set do
|
||||
config
|
||||
end
|
||||
|
||||
action :clear do
|
||||
config(:clear)
|
||||
end
|
||||
|
||||
def config(action = :set)
|
||||
cmd = "#{appcmd(node)} #{action} config #{new_resource.cfg_cmd}"
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd, returns: new_resource.returns)
|
||||
Chef::Log.info('IIS Config command run')
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
require 'chef/mixin/shell_out'
|
||||
include Chef::Mixin::ShellOut
|
||||
include Opscode::IIS::Helper
|
||||
include Opscode::IIS::Processors
|
||||
|
||||
# Support whyrun
|
||||
def whyrun_supported?
|
||||
@@ -38,15 +39,13 @@ action :add do
|
||||
cmd << " /app.name:\"#{new_resource.application}\""
|
||||
end
|
||||
|
||||
if new_resource.type
|
||||
cmd << " /type:\"#{new_resource.type}\""
|
||||
end
|
||||
cmd << " /type:\"#{new_resource.type}\"" if new_resource.type
|
||||
|
||||
if new_resource.precondition
|
||||
cmd << " /preCondition:\"#{new_resource.precondition}\""
|
||||
end
|
||||
|
||||
shell_out!(cmd, returns: [0, 42])
|
||||
shell_out!(cmd, returns: [0, 42])
|
||||
|
||||
Chef::Log.info("#{new_resource} added module '#{new_resource.module_name}'")
|
||||
end
|
||||
@@ -63,7 +62,7 @@ action :delete do
|
||||
cmd << " /app.name:\"#{new_resource.application}\""
|
||||
end
|
||||
|
||||
shell_out!(cmd, returns: [0, 42])
|
||||
shell_out!(cmd, returns: [0, 42])
|
||||
end
|
||||
|
||||
Chef::Log.info("#{new_resource} deleted")
|
||||
@@ -72,6 +71,40 @@ action :delete do
|
||||
end
|
||||
end
|
||||
|
||||
# appcmd syntax for installing native modules
|
||||
# appcmd install module /name:string /add:string(true|false) /image:string
|
||||
action :install do
|
||||
if !@current_resource.exists
|
||||
converge_by("install IIS module #{new_resource.module_name}") do
|
||||
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
|
||||
|
||||
shell_out!(cmd, returns: [0, 42])
|
||||
|
||||
Chef::Log.info("#{new_resource} installed module '#{new_resource.module_name}'")
|
||||
end
|
||||
else
|
||||
Chef::Log.debug("#{new_resource} module already exists - nothing to do")
|
||||
end
|
||||
end
|
||||
|
||||
# appcmd syntax for uninstalling native modules
|
||||
# appcmd uninstall module <name>
|
||||
action :uninstall do
|
||||
if @current_resource.exists
|
||||
converge_by("uninstall IIS module #{new_resource.module_name}") do
|
||||
cmd = "#{appcmd(node)} uninstall module \"#{new_resource.module_name}\""
|
||||
|
||||
shell_out!(cmd, returns: [0, 42])
|
||||
end
|
||||
|
||||
Chef::Log.info("#{new_resource} uninstalled module '#{new_resource.module_name}'")
|
||||
else
|
||||
Chef::Log.debug("#{new_resource} module does not exists - nothing to do")
|
||||
end
|
||||
end
|
||||
|
||||
def load_current_resource
|
||||
@current_resource = Chef::Resource::IisModule.new(new_resource.name)
|
||||
@current_resource.module_name(new_resource.module_name)
|
||||
|
||||
@@ -25,13 +25,18 @@ require 'rexml/document'
|
||||
include Chef::Mixin::ShellOut
|
||||
include REXML
|
||||
include Opscode::IIS::Helper
|
||||
include Opscode::IIS::Processors
|
||||
|
||||
action :add do
|
||||
if !@current_resource.exists
|
||||
cmd = "#{appcmd(node)} add apppool /name:\"#{new_resource.pool_name}\""
|
||||
cmd << ' /managedRuntimeVersion:' if new_resource.runtime_version || new_resource.no_managed_code
|
||||
cmd << "v#{new_resource.runtime_version}" if new_resource.runtime_version && !new_resource.no_managed_code
|
||||
if new_resource.no_managed_code
|
||||
cmd << ' /managedRuntimeVersion:'
|
||||
else
|
||||
cmd << " /managedRuntimeVersion:v#{new_resource.runtime_version}" if new_resource.runtime_version
|
||||
end
|
||||
cmd << " /managedPipelineMode:#{new_resource.pipeline_mode.capitalize}" if new_resource.pipeline_mode
|
||||
cmd << " /commit:\"MACHINE/WEBROOT/APPHOST\""
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
configure
|
||||
@@ -43,7 +48,7 @@ action :add do
|
||||
end
|
||||
|
||||
action :config do
|
||||
configure
|
||||
new_resource.updated_by_last_action(true) if configure
|
||||
end
|
||||
|
||||
action :delete do
|
||||
@@ -98,7 +103,7 @@ def load_current_resource
|
||||
Chef::Log.debug("#{new_resource} list apppool command output: #{cmd.stdout}")
|
||||
if cmd.stderr.empty?
|
||||
result = cmd.stdout.gsub(/\r\n?/, "\n") # ensure we have no carriage returns
|
||||
result = result.match(/^APPPOOL\s\"(#{new_resource.pool_name})\"\s\(MgdVersion:(.*),MgdMode:(.*),state:(.*)\)$/)
|
||||
result = result.match(/^APPPOOL\s\"(#{new_resource.pool_name})\"\s\(MgdVersion:(.*),MgdMode:(.*),state:(.*)\)$/i)
|
||||
Chef::Log.debug("#{new_resource} current_resource match output: #{result}")
|
||||
if result
|
||||
@current_resource.exists = true
|
||||
@@ -108,7 +113,7 @@ def load_current_resource
|
||||
@current_resource.running = false
|
||||
end
|
||||
else
|
||||
log "Failed to run iis_pool action :load_current_resource, #{cmd_current_values.stderr}" do
|
||||
log "Failed to run iis_pool action :load_current_resource, #{cmd.stderr}" do
|
||||
level :warn
|
||||
end
|
||||
end
|
||||
@@ -131,23 +136,36 @@ def configure
|
||||
|
||||
# root items
|
||||
is_new_managed_runtime_version = new_value?(doc.root, 'APPPOOL/@RuntimeVersion', "v#{new_resource.runtime_version}")
|
||||
is_new_pipeline_mode = new_value?(doc.root, 'APPPOOL/@PipelineMode'.capitalize, "#{new_resource.pipeline_mode}".to_s.capitalize)
|
||||
is_new_pipeline_mode = new_value?(doc.root, 'APPPOOL/@PipelineMode', new_resource.pipeline_mode)
|
||||
|
||||
# add items
|
||||
is_new_start_mode = new_value?(doc.root, 'APPPOOL/add/@startMode', new_resource.start_mode.to_s)
|
||||
is_new_auto_start = new_value?(doc.root, 'APPPOOL/add/@autoStart', new_resource.auto_start.to_s)
|
||||
if iis_version >= '7.0'
|
||||
is_new_auto_start = new_value?(doc.root, 'APPPOOL/add/@autoStart', new_resource.auto_start.to_s)
|
||||
end
|
||||
|
||||
if iis_version > '7.0'
|
||||
is_new_start_mode = new_value?(doc.root, 'APPPOOL/add/@startMode', new_resource.start_mode.to_s)
|
||||
end
|
||||
|
||||
is_new_queue_length = new_value?(doc.root, 'APPPOOL/add/@queueLength', new_resource.queue_length.to_s)
|
||||
is_new_enable_32_bit_app_on_win_64 = new_value?(doc.root, 'APPPOOL/add/@enable32BitAppOnWin64', new_resource.thirty_two_bit.to_s)
|
||||
|
||||
# processModel items
|
||||
is_new_max_processes = new_or_empty_value?(doc.root, 'APPPOOL/add/processModel/@maxProcesses', new_resource.max_proc.to_s)
|
||||
is_new_load_user_profile = new_value?(doc.root, 'APPPOOL/add/processModel/@loadUserProfile', new_resource.load_user_profile.to_s)
|
||||
is_new_identity_type = new_value?(doc.root, 'APPPOOL/add/processModel/@identityType', new_resource.pool_identity.to_s)
|
||||
if iis_version > '7.0'
|
||||
is_new_identity_type = new_value?(doc.root, 'APPPOOL/add/processModel/@identityType', new_resource.pool_identity.to_s)
|
||||
end
|
||||
is_new_user_name = new_or_empty_value?(doc.root, 'APPPOOL/add/processModel/@userName', new_resource.pool_username.to_s)
|
||||
is_new_password = new_or_empty_value?(doc.root, 'APPPOOL/add/processModel/@password', new_resource.pool_password.to_s)
|
||||
is_new_logon_type = new_value?(doc.root, 'APPPOOL/add/processModel/@logonType', new_resource.logon_type.to_s)
|
||||
if iis_version > '7.0'
|
||||
is_new_logon_type = new_value?(doc.root, 'APPPOOL/add/processModel/@logonType', new_resource.logon_type.to_s)
|
||||
end
|
||||
is_new_manual_group_membership = new_value?(doc.root, 'APPPOOL/add/processModel/@manualGroupMembership', new_resource.manual_group_membership.to_s)
|
||||
is_new_idle_timeout = new_value?(doc.root, 'APPPOOL/add/processModel/@idleTimeout', new_resource.idle_timeout.to_s)
|
||||
if iis_version >= '8.5'
|
||||
is_new_idle_timeout_action = new_value?(doc.root, 'APPPOOL/add/processModel/@idleTimeoutAction', new_resource.idle_timeout_action)
|
||||
end
|
||||
is_new_shutdown_time_limit = new_value?(doc.root, 'APPPOOL/add/processModel/@shutdownTimeLimit', new_resource.shutdown_time_limit.to_s)
|
||||
is_new_startup_time_limit = new_value?(doc.root, 'APPPOOL/add/processModel/@startupTimeLimit', new_resource.startup_time_limit.to_s)
|
||||
is_new_pinging_enabled = new_value?(doc.root, 'APPPOOL/add/processModel/@pingingEnabled', new_resource.pinging_enabled.to_s)
|
||||
@@ -169,7 +187,7 @@ def configure
|
||||
is_new_disallow_overlapping_rotation = new_value?(doc.root, 'APPPOOL/add/recycling/@disallowOverlappingRotation', new_resource.disallow_overlapping_rotation.to_s)
|
||||
is_new_disallow_rotation_on_config_change = new_value?(doc.root, 'APPPOOL/add/recycling/@disallowRotationOnConfigChange', new_resource.disallow_rotation_on_config_change.to_s)
|
||||
is_new_recycle_after_time = new_or_empty_value?(doc.root, 'APPPOOL/add/recycling/periodicRestart/@time', new_resource.recycle_after_time.to_s)
|
||||
is_new_recycle_at_time = new_or_empty_value?(doc.root, 'APPPOOL/add/recycling/periodicRestart/schedule/add/@value', new_resource.recycle_at_time.to_s)
|
||||
is_new_recycle_at_time = new_or_empty_value?(doc.root, "APPPOOL/add/recycling/periodicRestart/schedule/add[@value='#{new_resource.recycle_at_time}']/@value", new_resource.recycle_at_time.to_s)
|
||||
is_new_private_memory = new_or_empty_value?(doc.root, 'APPPOOL/add/recycling/periodicRestart/@privateMemory', new_resource.private_mem.to_s)
|
||||
is_new_log_event_on_recycle = new_value?(doc.root, 'APPPOOL/add/recycling/@logEventOnRecycle', 'Time, Requests, Schedule, Memory, IsapiUnhealthy, OnDemand, ConfigChange, PrivateMemory')
|
||||
|
||||
@@ -185,9 +203,19 @@ def configure
|
||||
@cmd = "#{appcmd(node)} set config /section:applicationPools"
|
||||
|
||||
# root items
|
||||
configure_application_pool(is_new_auto_start, "autoStart:#{new_resource.auto_start}")
|
||||
configure_application_pool(is_new_start_mode, "startMode:#{new_resource.start_mode}")
|
||||
configure_application_pool(new_resource.runtime_version && is_new_managed_runtime_version, "managedRuntimeVersion:v#{new_resource.runtime_version}")
|
||||
if iis_version >= '7.0'
|
||||
configure_application_pool(is_new_auto_start, "autoStart:#{new_resource.auto_start}")
|
||||
end
|
||||
|
||||
if iis_version >= '7.5'
|
||||
configure_application_pool(is_new_start_mode, "startMode:#{new_resource.start_mode}")
|
||||
end
|
||||
|
||||
if new_resource.no_managed_code
|
||||
configure_application_pool(is_new_managed_runtime_version, 'managedRuntimeVersion:')
|
||||
else
|
||||
configure_application_pool(new_resource.runtime_version && is_new_managed_runtime_version, "managedRuntimeVersion:v#{new_resource.runtime_version}")
|
||||
end
|
||||
configure_application_pool(new_resource.pipeline_mode && is_new_pipeline_mode, "managedPipelineMode:#{new_resource.pipeline_mode}")
|
||||
configure_application_pool(new_resource.thirty_two_bit && is_new_enable_32_bit_app_on_win_64, "enable32BitAppOnWin64:#{new_resource.thirty_two_bit}")
|
||||
configure_application_pool(new_resource.queue_length && is_new_queue_length, "queueLength:#{new_resource.queue_length}")
|
||||
@@ -198,20 +226,28 @@ def configure
|
||||
configure_application_pool(is_new_logon_type, "processModel.logonType:#{new_resource.logon_type}")
|
||||
configure_application_pool(is_new_manual_group_membership, "processModel.manualGroupMembership:#{new_resource.manual_group_membership}")
|
||||
configure_application_pool(is_new_idle_timeout, "processModel.idleTimeout:#{new_resource.idle_timeout}")
|
||||
if iis_version >= '8.5'
|
||||
configure_application_pool(is_new_idle_timeout_action, "processModel.idleTimeoutAction:#{new_resource.idle_timeout_action}")
|
||||
end
|
||||
configure_application_pool(is_new_shutdown_time_limit, "processModel.shutdownTimeLimit:#{new_resource.shutdown_time_limit}")
|
||||
configure_application_pool(is_new_startup_time_limit, "processModel.startupTimeLimit:#{new_resource.startup_time_limit}")
|
||||
configure_application_pool(is_new_pinging_enabled, "processModel.pingingEnabled:#{new_resource.pinging_enabled}")
|
||||
configure_application_pool(is_new_ping_interval, "processModel.pingInterval:#{new_resource.ping_interval}")
|
||||
configure_application_pool(is_new_ping_response_time, "processModel.pingResponseTime:#{new_resource.ping_response_time}")
|
||||
|
||||
node_array = XPath.match(doc.root, 'APPPOOL/add/recycling/periodicRestart/schedule/add')
|
||||
should_clear_apppool_schedules = (new_resource.recycle_at_time && is_new_recycle_at_time) || node_array.length > 1
|
||||
|
||||
# recycling items
|
||||
## Special case this collection removal for now.
|
||||
if (new_resource.recycle_at_time && is_new_recycle_at_time)
|
||||
if should_clear_apppool_schedules
|
||||
@was_updated = true
|
||||
cmd = "#{appcmd(node)} set config /section:applicationPools \"/-[name='#{new_resource.pool_name}'].recycling.periodicRestart.schedule\""
|
||||
Chef::Log.debug(@cmd)
|
||||
shell_out!(@cmd)
|
||||
is_new_recycle_at_time = true
|
||||
clear_pool_schedule_cmd = "#{appcmd(node)} set config /section:applicationPools \"/-[name='#{new_resource.pool_name}'].recycling.periodicRestart.schedule\""
|
||||
Chef::Log.debug(clear_pool_schedule_cmd)
|
||||
shell_out!(clear_pool_schedule_cmd)
|
||||
end
|
||||
|
||||
configure_application_pool(new_resource.recycle_after_time && is_new_recycle_after_time, "recycling.periodicRestart.time:#{new_resource.recycle_after_time}")
|
||||
configure_application_pool(new_resource.recycle_at_time && is_new_recycle_at_time, "recycling.periodicRestart.schedule.[value='#{new_resource.recycle_at_time}']", '+')
|
||||
configure_application_pool(is_new_log_event_on_recycle, 'recycling.logEventOnRecycle:PrivateMemory,Memory,Schedule,Requests,Time,ConfigChange,OnDemand,IsapiUnhealthy')
|
||||
@@ -244,17 +280,17 @@ def configure
|
||||
end
|
||||
|
||||
# Application Pool Identity Settings
|
||||
if ((new_resource.pool_username && new_resource.pool_username != '') && (is_new_user_name || is_new_password))
|
||||
if (new_resource.pool_username && new_resource.pool_username != '') && (is_new_user_name || is_new_password)
|
||||
@was_updated = true
|
||||
cmd = "#{appcmd(node)} set config /section:applicationPools"
|
||||
cmd << " \"/[name='#{new_resource.pool_name}'].processModel.identityType:SpecificUser\""
|
||||
cmd << " \"/[name='#{new_resource.pool_name}'].processModel.userName:#{new_resource.pool_username}\""
|
||||
cmd << " \"/[name='#{new_resource.pool_name}'].processModel.password:#{new_resource.pool_password}\"" if (new_resource.pool_password && new_resource.pool_password != '' && is_new_password)
|
||||
cmd << " \"/[name='#{new_resource.pool_name}'].processModel.password:#{new_resource.pool_password}\"" if new_resource.pool_password && new_resource.pool_password != '' && is_new_password
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
elsif ((new_resource.pool_username.nil? || new_resource.pool_username == '') &&
|
||||
(new_resource.pool_password.nil? || new_resource.pool_username == '') &&
|
||||
(is_new_identity_type && new_resource.pool_identity != 'SpecificUser'))
|
||||
elsif (new_resource.pool_username.nil? || new_resource.pool_username == '') &&
|
||||
(new_resource.pool_password.nil? || new_resource.pool_username == '') &&
|
||||
(is_new_identity_type && new_resource.pool_identity != 'SpecificUser')
|
||||
@was_updated = true
|
||||
cmd = "#{appcmd(node)} set config /section:applicationPools"
|
||||
cmd << " \"/[name='#{new_resource.pool_name}'].processModel.identityType:#{new_resource.pool_identity}\""
|
||||
@@ -263,7 +299,6 @@ def configure
|
||||
end
|
||||
|
||||
if @was_updated
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info("#{new_resource} configured application pool")
|
||||
else
|
||||
Chef::Log.debug("#{new_resource} application pool - nothing to do")
|
||||
@@ -273,14 +308,14 @@ def configure
|
||||
level :warn
|
||||
end
|
||||
end
|
||||
|
||||
@was_updated
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def configure_application_pool(condition, config, add_remove = '')
|
||||
unless condition
|
||||
return
|
||||
end
|
||||
return unless condition
|
||||
|
||||
@was_updated = true
|
||||
@cmd << " \"/#{add_remove}[name='#{new_resource.pool_name}'].#{config}\""
|
||||
|
||||
68
cookbooks/iis/providers/root.rb
Normal file
68
cookbooks/iis/providers/root.rb
Normal file
@@ -0,0 +1,68 @@
|
||||
#
|
||||
# Author:: Justin Schuhmann (<jmschu02@gmail.com>)
|
||||
# Cookbook Name:: iis
|
||||
# Provider:: root
|
||||
#
|
||||
# Copyright:: Justin Schuhmann
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
include Opscode::IIS::Helper
|
||||
include Opscode::IIS::Processors
|
||||
|
||||
action :add do
|
||||
@was_updated = false
|
||||
|
||||
@was_updated = default_documents(new_resource.add_default_documents, new_resource.default_documents_enabled, true, false) | @was_updated
|
||||
@was_updated = mime_maps(new_resource.add_mime_maps, true, false) | @was_updated
|
||||
|
||||
if @was_updated
|
||||
new_resource.updated_by_last_action(true)
|
||||
else
|
||||
Chef::Log.debug("#{new_resource} - nothing to do")
|
||||
end
|
||||
end
|
||||
|
||||
action :delete do
|
||||
@was_updated = false
|
||||
|
||||
@was_updated = default_documents(new_resource.delete_default_documents, new_resource.default_documents_enabled, false) | @was_updated
|
||||
@was_updated = mime_maps(new_resource.delete_mime_maps, false) | @was_updated
|
||||
|
||||
if @was_updated
|
||||
new_resource.updated_by_last_action(true)
|
||||
else
|
||||
Chef::Log.debug("#{new_resource} - nothing to do")
|
||||
end
|
||||
end
|
||||
|
||||
action :config do
|
||||
@was_updated = false
|
||||
|
||||
@was_updated = default_documents(new_resource.default_documents, new_resource.default_documents_enabled) | @was_updated
|
||||
@was_updated = mime_maps(new_resource.mime_maps) | @was_updated
|
||||
|
||||
if @was_updated
|
||||
new_resource.updated_by_last_action(true)
|
||||
else
|
||||
Chef::Log.debug("#{new_resource} - nothing to do")
|
||||
end
|
||||
end
|
||||
|
||||
def load_current_resource
|
||||
@current_resource = Chef::Resource::IisRoot.new(new_resource.name)
|
||||
@current_resource.default_documents(new_resource.default_documents)
|
||||
@current_resource.default_documents_enabled(new_resource.default_documents_enabled)
|
||||
@current_resource.mime_maps(new_resource.mime_maps)
|
||||
end
|
||||
@@ -24,11 +24,12 @@ require 'rexml/document'
|
||||
include Chef::Mixin::ShellOut
|
||||
include REXML
|
||||
include Opscode::IIS::Helper
|
||||
include Opscode::IIS::Processors
|
||||
|
||||
action :lock do
|
||||
@current_resource.exists = new_value?(doc.root, 'CONFIG/@overrideMode', 'Deny')
|
||||
|
||||
if !@current_resource.exists
|
||||
if @current_resource.exists
|
||||
cmd = "#{appcmd(node)} lock config -section:\"#{new_resource.section}\" -commit:apphost"
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd, returns: new_resource.returns)
|
||||
@@ -42,7 +43,7 @@ end
|
||||
action :unlock do
|
||||
@current_resource.exists = new_value?(doc.root, 'CONFIG/@overrideMode', 'Allow')
|
||||
|
||||
if !@current_resource.exists
|
||||
if @current_resource.exists
|
||||
cmd = "#{appcmd(node)} unlock config -section:\"#{new_resource.section}\" -commit:apphost"
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd, returns: new_resource.returns)
|
||||
@@ -59,7 +60,7 @@ def load_current_resource
|
||||
end
|
||||
|
||||
def doc
|
||||
cmd_current_values = "#{appcmd(node)} list config \"\" -section:#{new_resource.section} /config:* /xml"
|
||||
cmd_current_values = "#{appcmd(node)} list config -section:#{new_resource.section} /config:* /xml"
|
||||
Chef::Log.debug(cmd_current_values)
|
||||
cmd_current_values = shell_out(cmd_current_values)
|
||||
if cmd_current_values.stderr.empty?
|
||||
|
||||
@@ -24,6 +24,7 @@ require 'rexml/document'
|
||||
include Chef::Mixin::ShellOut
|
||||
include REXML
|
||||
include Opscode::IIS::Helper
|
||||
include Opscode::IIS::Processors
|
||||
|
||||
action :add do
|
||||
if !@current_resource.exists
|
||||
@@ -39,15 +40,13 @@ action :add do
|
||||
end
|
||||
|
||||
# support for additional options -logDir, -limits, -ftpServer, etc...
|
||||
if new_resource.options
|
||||
cmd << " #{new_resource.options}"
|
||||
end
|
||||
shell_out!(cmd, returns: [0, 42])
|
||||
cmd << " #{new_resource.options}" if new_resource.options
|
||||
shell_out!(cmd, returns: [0, 42])
|
||||
|
||||
configure
|
||||
|
||||
if new_resource.application_pool
|
||||
shell_out!("#{appcmd(node)} set app \"#{new_resource.site_name}/\" /applicationPool:\"#{new_resource.application_pool}\"", returns: [0, 42])
|
||||
shell_out!("#{appcmd(node)} set app \"#{new_resource.site_name}/\" /applicationPool:\"#{new_resource.application_pool}\"", returns: [0, 42])
|
||||
end
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info("#{new_resource} added new site '#{new_resource.site_name}'")
|
||||
@@ -57,13 +56,13 @@ action :add do
|
||||
end
|
||||
|
||||
action :config do
|
||||
configure
|
||||
new_resource.updated_by_last_action(true) if configure
|
||||
end
|
||||
|
||||
action :delete do
|
||||
if @current_resource.exists
|
||||
Chef::Log.info("#{appcmd(node)} stop site /site.name:\"#{new_resource.site_name}\"")
|
||||
shell_out!("#{appcmd(node)} delete site /site.name:\"#{new_resource.site_name}\"", returns: [0, 42])
|
||||
shell_out!("#{appcmd(node)} delete site /site.name:\"#{new_resource.site_name}\"", returns: [0, 42])
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info("#{new_resource} deleted")
|
||||
else
|
||||
@@ -73,7 +72,7 @@ end
|
||||
|
||||
action :start do
|
||||
if !@current_resource.running
|
||||
shell_out!("#{appcmd(node)} start site /site.name:\"#{new_resource.site_name}\"", returns: [0, 42])
|
||||
shell_out!("#{appcmd(node)} start site /site.name:\"#{new_resource.site_name}\"", returns: [0, 42])
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info("#{new_resource} started")
|
||||
else
|
||||
@@ -84,7 +83,7 @@ end
|
||||
action :stop do
|
||||
if @current_resource.running
|
||||
Chef::Log.info("#{appcmd(node)} stop site /site.name:\"#{new_resource.site_name}\"")
|
||||
shell_out!("#{appcmd(node)} stop site /site.name:\"#{new_resource.site_name}\"", returns: [0, 42])
|
||||
shell_out!("#{appcmd(node)} stop site /site.name:\"#{new_resource.site_name}\"", returns: [0, 42])
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info("#{new_resource} stopped")
|
||||
else
|
||||
@@ -93,9 +92,9 @@ action :stop do
|
||||
end
|
||||
|
||||
action :restart do
|
||||
shell_out!("#{appcmd(node)} stop site /site.name:\"#{new_resource.site_name}\"", returns: [0, 42])
|
||||
shell_out!("#{appcmd(node)} stop site /site.name:\"#{new_resource.site_name}\"", returns: [0, 42])
|
||||
sleep 2
|
||||
shell_out!("#{appcmd(node)} start site /site.name:\"#{new_resource.site_name}\"", returns: [0, 42])
|
||||
shell_out!("#{appcmd(node)} start site /site.name:\"#{new_resource.site_name}\"", returns: [0, 42])
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info("#{new_resource} restarted")
|
||||
end
|
||||
@@ -109,7 +108,7 @@ def load_current_resource
|
||||
Chef::Log.debug("#{new_resource} list site command output: #{cmd.stdout}")
|
||||
if cmd.stderr.empty?
|
||||
result = cmd.stdout.gsub(/\r\n?/, "\n") # ensure we have no carriage returns
|
||||
result = result.match(/^SITE\s\"(#{new_resource.site_name})\"\s\(id:(.*),bindings:(.*),state:(.*)\)$/)
|
||||
result = result.match(/^SITE\s\"(#{new_resource.site_name})\"\s\(id:(.*),bindings:(.*),state:(.*)\)$/i)
|
||||
Chef::Log.debug("#{new_resource} current_resource match output: #{result}")
|
||||
if result
|
||||
@current_resource.site_id(result[2].to_i)
|
||||
@@ -128,94 +127,100 @@ def load_current_resource
|
||||
end
|
||||
|
||||
private
|
||||
def configure
|
||||
was_updated = false
|
||||
cmd_current_values = "#{appcmd(node)} list site \"#{new_resource.site_name}\" /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)
|
||||
is_new_bindings = new_value?(doc.root, 'SITE/@bindings', new_resource.bindings.to_s)
|
||||
is_new_physical_path = new_or_empty_value?(doc.root, 'SITE/site/application/virtualDirectory/@physicalPath', new_resource.path.to_s)
|
||||
is_new_port_host_provided = !"#{XPath.first(doc.root, 'SITE/@bindings')},".include?("#{new_resource.protocol}/*:#{new_resource.port}:#{new_resource.host_header},")
|
||||
is_new_site_id = new_value?(doc.root, 'SITE/site/@id', new_resource.site_id.to_s)
|
||||
is_new_log_directory = new_or_empty_value?(doc.root, 'SITE/logFiles/@directory', new_resource.log_directory.to_s)
|
||||
is_new_log_period = new_or_empty_value?(doc.root, 'SITE/logFile/@period', new_resource.log_period.to_s)
|
||||
is_new_log_trunc = new_or_empty_value?(doc.root, 'SITE/logFiles/@truncateSize', new_resource.log_truncsize.to_s)
|
||||
is_new_application_pool = new_value?(doc.root, 'SITE/site/application/@applicationPool', new_resource.application_pool)
|
||||
|
||||
if (new_resource.bindings && is_new_bindings)
|
||||
was_updated = true
|
||||
cmd = "#{appcmd(node)} set site /site.name:\"#{new_resource.site_name}\""
|
||||
cmd << " /bindings:\"#{new_resource.bindings}\""
|
||||
shell_out!(cmd)
|
||||
new_resource.updated_by_last_action(true)
|
||||
elsif (((new_resource.port || new_resource.host_header || new_resource.protocol) && is_new_port_host_provided) && !new_resource.bindings)
|
||||
was_updated = true
|
||||
cmd = "#{appcmd(node)} set site \"#{new_resource.site_name}\""
|
||||
cmd << " /bindings:#{new_resource.protocol}/*:#{new_resource.port}:#{new_resource.host_header}"
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
def configure
|
||||
@was_updated = false
|
||||
cmd_current_values = "#{appcmd(node)} list site \"#{new_resource.site_name}\" /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)
|
||||
is_new_bindings = new_value?(doc.root, 'SITE/@bindings', new_resource.bindings.to_s)
|
||||
is_new_physical_path = new_or_empty_value?(doc.root, 'SITE/site/application/virtualDirectory/@physicalPath', new_resource.path.to_s)
|
||||
is_new_port_host_provided = !"#{XPath.first(doc.root, 'SITE/@bindings')},".include?("#{new_resource.protocol}/*:#{new_resource.port}:#{new_resource.host_header},")
|
||||
is_new_site_id = new_value?(doc.root, 'SITE/site/@id', new_resource.site_id.to_s)
|
||||
is_new_log_directory = new_or_empty_value?(doc.root, 'SITE/logFiles/@directory', new_resource.log_directory.to_s)
|
||||
is_new_log_period = new_or_empty_value?(doc.root, 'SITE/logFile/@period', new_resource.log_period.to_s)
|
||||
is_new_log_trunc = new_or_empty_value?(doc.root, 'SITE/logFiles/@truncateSize', new_resource.log_truncsize.to_s)
|
||||
is_new_application_pool = new_value?(doc.root, 'SITE/site/application/@applicationPool', new_resource.application_pool)
|
||||
|
||||
if new_resource.application_pool && is_new_application_pool
|
||||
was_updated = true
|
||||
cmd = "#{appcmd(node)} set app \"#{new_resource.site_name}/\" /applicationPool:\"#{new_resource.application_pool}\""
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd, returns: [0, 42])
|
||||
end
|
||||
|
||||
if new_resource.path && is_new_physical_path
|
||||
was_updated = true
|
||||
cmd = "#{appcmd(node)} set vdir \"#{new_resource.site_name}/\""
|
||||
cmd << " /physicalPath:\"#{windows_cleanpath(new_resource.path)}\""
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
end
|
||||
if new_resource.bindings && is_new_bindings
|
||||
@was_updated = true
|
||||
cmd = "#{appcmd(node)} set site /site.name:\"#{new_resource.site_name}\""
|
||||
cmd << " /bindings:\"#{new_resource.bindings}\""
|
||||
shell_out!(cmd)
|
||||
new_resource.updated_by_last_action(true)
|
||||
elsif ((new_resource.port || new_resource.host_header || new_resource.protocol) && is_new_port_host_provided) && !new_resource.bindings
|
||||
@was_updated = true
|
||||
cmd = "#{appcmd(node)} set site \"#{new_resource.site_name}\""
|
||||
cmd << " /bindings:#{new_resource.protocol}/*:#{new_resource.port}:#{new_resource.host_header}"
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
|
||||
if new_resource.site_id && is_new_site_id
|
||||
cmd = "#{appcmd(node)} set site \"#{new_resource.site_name}\""
|
||||
cmd << " /id:#{new_resource.site_id}"
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
if new_resource.application_pool && is_new_application_pool
|
||||
@was_updated = true
|
||||
cmd = "#{appcmd(node)} set app \"#{new_resource.site_name}/\" /applicationPool:\"#{new_resource.application_pool}\""
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd, returns: [0, 42])
|
||||
end
|
||||
|
||||
if new_resource.log_directory && is_new_log_directory
|
||||
cmd = "#{appcmd(node)} set site \"#{new_resource.site_name}\""
|
||||
cmd << " /logFile.directory:#{windows_cleanpath(new_resource.log_directory)}"
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
if new_resource.path && is_new_physical_path
|
||||
@was_updated = true
|
||||
cmd = "#{appcmd(node)} set vdir \"#{new_resource.site_name}/\""
|
||||
cmd << " /physicalPath:\"#{windows_cleanpath(new_resource.path)}\""
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
end
|
||||
|
||||
if new_resource.log_period && is_new_log_period
|
||||
cmd = "#{appcmd(node)} set site \"#{new_resource.site_name}\""
|
||||
cmd << " /logFile.period:#{new_resource.log_period}"
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
if new_resource.site_id && is_new_site_id
|
||||
@was_updated = true
|
||||
cmd = "#{appcmd(node)} set site \"#{new_resource.site_name}\""
|
||||
cmd << " /id:#{new_resource.site_id}"
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
|
||||
if new_resource.log_truncsize && is_new_log_trunc
|
||||
cmd = "#{appcmd(node)} set site \"#{new_resource.site_name}\""
|
||||
cmd << " /logFile.truncateSize:#{new_resource.log_truncsize}"
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
if new_resource.log_directory && is_new_log_directory
|
||||
@was_updated = true
|
||||
cmd = "#{appcmd(node)} set site \"#{new_resource.site_name}\""
|
||||
cmd << " /logFile.directory:#{windows_cleanpath(new_resource.log_directory)}"
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
|
||||
if was_updated
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info("#{new_resource} configured site '#{new_resource.site_name}'")
|
||||
else
|
||||
Chef::Log.debug("#{new_resource} site - nothing to do")
|
||||
end
|
||||
if new_resource.log_period && is_new_log_period
|
||||
@was_updated = true
|
||||
cmd = "#{appcmd(node)} set site \"#{new_resource.site_name}\""
|
||||
cmd << " /logFile.period:#{new_resource.log_period}"
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
|
||||
if new_resource.log_truncsize && is_new_log_trunc
|
||||
@was_updated = true
|
||||
cmd = "#{appcmd(node)} set site \"#{new_resource.site_name}\""
|
||||
cmd << " /logFile.truncateSize:#{new_resource.log_truncsize}"
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
|
||||
if @was_updated
|
||||
Chef::Log.info("#{new_resource} configured site '#{new_resource.site_name}'")
|
||||
else
|
||||
log "Failed to run iis_site action :config, #{cmd_current_values.stderr}" do
|
||||
level :warn
|
||||
end
|
||||
Chef::Log.debug("#{new_resource} site - nothing to do")
|
||||
end
|
||||
else
|
||||
log "Failed to run iis_site action :config, #{cmd_current_values.stderr}" do
|
||||
level :warn
|
||||
end
|
||||
end
|
||||
|
||||
@was_updated
|
||||
end
|
||||
|
||||
@@ -24,6 +24,7 @@ require 'rexml/document'
|
||||
include Chef::Mixin::ShellOut
|
||||
include REXML
|
||||
include Opscode::IIS::Helper
|
||||
include Opscode::IIS::Processors
|
||||
|
||||
action :add do
|
||||
if !@current_resource.exists
|
||||
@@ -34,9 +35,10 @@ action :add do
|
||||
cmd << " /password:\"#{new_resource.password}\"" if new_resource.password
|
||||
cmd << " /logonMethod:#{new_resource.logon_method}" if new_resource.logon_method
|
||||
cmd << " /allowSubDirConfig:#{new_resource.allow_sub_dir_config}" if new_resource.allow_sub_dir_config
|
||||
cmd << " /commit:\"MACHINE/WEBROOT/APPHOST\""
|
||||
|
||||
Chef::Log.info(cmd)
|
||||
shell_out!(cmd, returns: [0, 42, 183])
|
||||
shell_out!(cmd, returns: [0, 42, 183])
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info("#{new_resource} added new virtual directory to application: '#{new_resource.application_name}'")
|
||||
else
|
||||
@@ -45,7 +47,7 @@ action :add do
|
||||
end
|
||||
|
||||
action :config do
|
||||
was_updated = false
|
||||
@was_updated = false
|
||||
cmd_current_values = "#{appcmd(node)} list vdir \"#{application_identifier}\" /config:* /xml"
|
||||
Chef::Log.debug(cmd_current_values)
|
||||
cmd_current_values = shell_out!(cmd_current_values)
|
||||
@@ -59,41 +61,41 @@ action :config do
|
||||
is_new_allow_sub_dir_config = new_or_empty_value?(doc.root, 'VDIR/virtualDirectory/@allowSubDirConfig', new_resource.allow_sub_dir_config.to_s)
|
||||
|
||||
if new_resource.physical_path && is_new_physical_path
|
||||
was_updated = true
|
||||
@was_updated = true
|
||||
cmd = "#{appcmd(node)} set vdir \"#{application_identifier}\" /physicalPath:\"#{new_resource.physical_path}\""
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
end
|
||||
|
||||
if new_resource.username && is_new_user_name
|
||||
was_updated = true
|
||||
@was_updated = true
|
||||
cmd = "#{appcmd(node)} set vdir \"#{application_identifier}\" /userName:\"#{new_resource.username}\""
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
end
|
||||
|
||||
if new_resource.password && is_new_password
|
||||
was_updated = true
|
||||
@was_updated = true
|
||||
cmd = "#{appcmd(node)} set vdir \"#{application_identifier}\" /password:\"#{new_resource.password}\""
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
end
|
||||
|
||||
if new_resource.logon_method && is_new_logon_method
|
||||
was_updated = true
|
||||
@was_updated = true
|
||||
cmd = "#{appcmd(node)} set vdir \"#{application_identifier}\" /logonMethod:#{new_resource.logon_method}"
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
end
|
||||
|
||||
if new_resource.allow_sub_dir_config && is_new_allow_sub_dir_config
|
||||
was_updated = true
|
||||
@was_updated = true
|
||||
cmd = "#{appcmd(node)} set vdir \"#{application_identifier}\" /allowSubDirConfig:#{new_resource.allow_sub_dir_config}"
|
||||
Chef::Log.debug(cmd)
|
||||
shell_out!(cmd)
|
||||
end
|
||||
|
||||
if was_updated
|
||||
if @was_updated
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info("#{new_resource} configured virtual directory to application: '#{new_resource.application_name}'")
|
||||
else
|
||||
@@ -108,7 +110,7 @@ end
|
||||
|
||||
action :delete do
|
||||
if @current_resource.exists
|
||||
shell_out!("#{appcmd(node)} delete vdir \"#{application_identifier}\"", returns: [0, 42])
|
||||
shell_out!("#{appcmd(node)} delete vdir \"#{application_identifier}\"", returns: [0, 42])
|
||||
new_resource.updated_by_last_action(true)
|
||||
Chef::Log.info("#{new_resource} deleted")
|
||||
else
|
||||
@@ -121,13 +123,13 @@ def load_current_resource
|
||||
@current_resource.application_name(application_name_check)
|
||||
@current_resource.path(new_resource.path)
|
||||
@current_resource.physical_path(new_resource.physical_path)
|
||||
cmd = shell_out("#{ appcmd(node) } list vdir \"#{application_identifier}\"")
|
||||
Chef::Log.debug("#{ new_resource } list vdir command output: #{ cmd.stdout }")
|
||||
cmd = shell_out("#{appcmd(node)} list vdir \"#{application_identifier}\"")
|
||||
Chef::Log.debug("#{new_resource} list vdir command output: #{cmd.stdout}")
|
||||
|
||||
if cmd.stderr.empty?
|
||||
# VDIR "Testfu Site/Content/Test"
|
||||
result = cmd.stdout.match(/^VDIR\s\"#{Regexp.escape(application_identifier)}\"/)
|
||||
Chef::Log.debug("#{ new_resource } current_resource match output: #{ result }")
|
||||
Chef::Log.debug("#{new_resource} current_resource match output: #{result}")
|
||||
if result
|
||||
@current_resource.exists = true
|
||||
else
|
||||
|
||||
@@ -25,6 +25,7 @@ default = Opscode::IIS::Helper.older_than_windows2008r2? ? 'Web-Server' : 'IIS-W
|
||||
windows_feature feature do
|
||||
action :install
|
||||
all !Opscode::IIS::Helper.older_than_windows2012?
|
||||
source node['iis']['source'] unless node['iis']['source'].nil?
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -26,4 +26,7 @@ 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: []
|
||||
|
||||
attr_accessor :exists, :running
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
actions :config
|
||||
default_action :config
|
||||
actions :config, :clear, :set
|
||||
default_action :set
|
||||
|
||||
attribute :cfg_cmd, kind_of: String, name_attribute: true
|
||||
attribute :returns, kind_of: [Integer, Array], default: 0
|
||||
|
||||
@@ -18,11 +18,13 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
actions :add, :delete
|
||||
actions :add, :delete, :install, :uninstall
|
||||
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
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ attribute :pool_password, kind_of: String
|
||||
attribute :logon_type, kind_of: Symbol, equal_to: [:LogonBatch, :LogonService], default: :LogonBatch
|
||||
attribute :manual_group_membership, kind_of: [TrueClass, FalseClass], default: false
|
||||
attribute :idle_timeout, kind_of: String, default: '00:20:00'
|
||||
attribute :idle_timeout_action, kind_of: Symbol, equal_to: [:Terminate, :Suspend], default: :Terminate
|
||||
attribute :shutdown_time_limit, kind_of: String, default: '00:01:30'
|
||||
attribute :startup_time_limit, kind_of: String, default: '00:01:30'
|
||||
attribute :pinging_enabled, kind_of: [TrueClass, FalseClass], default: true
|
||||
|
||||
31
cookbooks/iis/resources/root.rb
Normal file
31
cookbooks/iis/resources/root.rb
Normal file
File diff suppressed because one or more lines are too long
@@ -30,7 +30,7 @@ attribute :host_header, kind_of: String, default: nil
|
||||
attribute :bindings, kind_of: String, default: nil
|
||||
attribute :application_pool, kind_of: String, default: nil
|
||||
attribute :options, kind_of: String, default: ''
|
||||
attribute :log_directory, kind_of: String, default: "#{node['iis']['pubroot']}\\logs\\LogFiles"
|
||||
attribute :log_directory, kind_of: String, default: node['iis']['log_dir']
|
||||
attribute :log_period, kind_of: Symbol, default: :Daily, equal_to: [:Daily, :Hourly, :MaxSize, :Monthly, :Weekly]
|
||||
attribute :log_truncsize, kind_of: Integer, default: 1_048_576
|
||||
|
||||
|
||||
Reference in New Issue
Block a user