Skip to content

Commit

Permalink
[sous-chefsGH-476] Review Feedback changes
Browse files Browse the repository at this point in the history
- Fixes Kitchen.yaml formatting error
- 'install' and 'manage' resources correctly define install_method property
as being a Symbol type and then specify the valid symbols
- iis -> windows_feature_install_method attribute is now defaulted
to the default value that windows_feature uses which is :windows_feature_dism
- Change log entry added
- Updates documentation for 'install' and 'managed' resources
- Usage of new attribute is done with a coercion to a symbol

Signed-off-by: dave-q <24652224+dave-q@users.noreply.github.com>
  • Loading branch information
dave-q committed Apr 1, 2021
1 parent 750315b commit 973ddf0
Show file tree
Hide file tree
Showing 25 changed files with 29 additions and 56 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ This file is used to list changes made in each version of the iis cookbook.

## Unreleased

- Allow specifying install method for windows_feature resources

## 7.5.1 - *2021-03-25*

- Cookstyle fixes
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of
- `node['iis']['pubroot']` - . default is `%SYSTEMDRIVE%\inetpub`
- `node['iis']['docroot']` - IIS web site home directory. default is `%SYSTEMDRIVE%\inetpub\wwwroot`
- `node['iis']['cache_dir']` - location of cached data. default is `%SYSTEMDRIVE%\inetpub\temp`
- `node['iis']['windows_feature_install_method']` - specify the install method that will be used by any windows_feature resources. If ommitted it will not be specified and will the windows_feature supply a default. Valid options are ':windows_feature_dism, :windows_feature_powershell, :windows_feature_servermanagercmd'
- `node['iis']['windows_feature_install_method']` - specify the install method that will be used by any windows_feature resources. If ommitted it will not be specified and will the windows_feature supply a default. Valid options are ':windows_feature_dism, :windows_feature_powershell, :windows_feature_servermanagercmd'. Default is :windows_feature_dism

## Resources

Expand Down
2 changes: 2 additions & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@
default['iis']['source'] = nil

default['iis']['recycle']['log_events'] = 'Time, Requests, Schedule, Memory, IsapiUnhealthy, OnDemand, ConfigChange, PrivateMemory'

default['iis']['windows_feature_install_method'] = :windows_feature_dism
2 changes: 1 addition & 1 deletion documentation/iis_install.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Simple resource to install the IIS feature
| ----------------------- | -------- | -------- | ------------------------------------ |
| `source` | String | No | Source to install the features from. |
| `additional_components` | Array | No | Features of IIS to install |
| `install_method` | :windows_feature_dism, :windows_feature_powershell, :windows_feature_servermanagercmd | No | install_method to be used to any windows_features resources |
| `install_method` | :windows_feature_dism, :windows_feature_powershell, :windows_feature_servermanagercmd | No | install_method to be used to any windows_features resources. Default is :windows_feature_dism |

## Examples

Expand Down
2 changes: 1 addition & 1 deletion documentation/iis_manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Configures the IIS Manager service
| `enable_remote_management` | true, false | `true` | If remote access allowed |
| `log_directory` | String | | Optional. The directory to write log files to |
| `port` | Integer | `8172` | The port the service listens on. |
| `install_method` | :windows_feature_dism, :windows_feature_powershell, :windows_feature_servermanagercmd | | Optional: install_method to be used to any windows_features resources |
| `install_method` | :windows_feature_dism, :windows_feature_powershell, :windows_feature_servermanagercmd | `:windows_feature_dism` | Optional. install_method to be used to any windows_features resources |

## Examples

Expand Down
4 changes: 2 additions & 2 deletions kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ suites:
- recipe[test::vdir]
- name: default-windowsfeatures-powershell
run_list:
-recipe[iis::default]
- recipe[iis::default]
attributes:
iis:
windows_feature_install_method: :windows_feature_powershell
windows_feature_install_method: windows_feature_powershell
2 changes: 1 addition & 1 deletion recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
iis_install 'install IIS' do
additional_components node['iis']['components']
source node['iis']['source']
install_method node['iis']['windows_feature_install_method']
install_method node['iis']['windows_feature_install_method']&.to_sym
end

service 'iis' do
Expand Down
3 changes: 1 addition & 2 deletions recipes/mod_application_initialization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

include_recipe 'iis'

install_method = node['iis']['windows_feature_install_method']
windows_feature 'IIS-ApplicationInit' do
install_method install_method unless install_method.nil?
install_method node['iis']['windows_feature_install_method']&.to_sym
end
4 changes: 1 addition & 3 deletions recipes/mod_aspnet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@
include_recipe 'iis'
include_recipe 'iis::mod_isapi'

install_method = node['iis']['windows_feature_install_method']

windows_feature %w(IIS-NetFxExtensibility IIS-ASPNET) do
action :install
all !IISCookbook::Helper.older_than_windows2012?
source node['iis']['source'] unless node['iis']['source'].nil?
install_method install_method unless install_method.nil?
install_method node['iis']['windows_feature_install_method']&.to_sym
end
4 changes: 1 addition & 3 deletions recipes/mod_aspnet45.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
include_recipe 'iis'
include_recipe 'iis::mod_isapi'

install_method = node['iis']['windows_feature_install_method']

windows_feature %w(NetFx4Extended-ASPNET45 IIS-NetFxExtensibility45 IIS-ASPNET45) do
install_method install_method unless install_method.nil?
install_method node['iis']['windows_feature_install_method']&.to_sym
end
4 changes: 1 addition & 3 deletions recipes/mod_auth_basic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@

include_recipe 'iis'

install_method = node['iis']['windows_feature_install_method']

windows_feature 'IIS-BasicAuthentication' do
install_method install_method unless install_method.nil?
install_method node['iis']['windows_feature_install_method']&.to_sym
end

iis_section 'unlocks basic authentication control in web.config' do
Expand Down
4 changes: 1 addition & 3 deletions recipes/mod_auth_digest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@

include_recipe 'iis'

install_method = node['iis']['windows_feature_install_method']

windows_feature 'IIS-DigestAuthentication' do
install_method install_method unless install_method.nil?
install_method node['iis']['windows_feature_install_method']&.to_sym
end

iis_section 'unlocks digest authentication control in web.config' do
Expand Down
4 changes: 1 addition & 3 deletions recipes/mod_auth_windows.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@

include_recipe 'iis'

install_method = node['iis']['windows_feature_install_method']

windows_feature 'IIS-WindowsAuthentication' do
install_method install_method unless install_method.nil?
install_method node['iis']['windows_feature_install_method']&.to_sym
end

iis_section 'unlocks windows authentication control in web.config' do
Expand Down
4 changes: 1 addition & 3 deletions recipes/mod_cgi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

include_recipe 'iis'

install_method = node['iis']['windows_feature_install_method']

windows_feature 'IIS-CGI' do
install_method install_method unless install_method.nil?
install_method node['iis']['windows_feature_install_method']&.to_sym
end
4 changes: 1 addition & 3 deletions recipes/mod_compress_dynamic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

include_recipe 'iis'

install_method = node['iis']['windows_feature_install_method']

windows_feature 'IIS-HttpCompressionDynamic' do
install_method install_method unless install_method.nil?
install_method node['iis']['windows_feature_install_method']&.to_sym
end
4 changes: 1 addition & 3 deletions recipes/mod_compress_static.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

include_recipe 'iis'

install_method = node['iis']['windows_feature_install_method']

windows_feature 'IIS-HttpCompressionStatic' do
install_method install_method unless install_method.nil?
install_method node['iis']['windows_feature_install_method']&.to_sym
end
4 changes: 1 addition & 3 deletions recipes/mod_ftp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

include_recipe 'iis'

install_method = node['iis']['windows_feature_install_method']

windows_feature %w(IIS-FTPServer IIS-FTPSvc IIS-FTPExtensibility) do
install_method install_method unless install_method.nil?
install_method node['iis']['windows_feature_install_method']&.to_sym
end
4 changes: 1 addition & 3 deletions recipes/mod_iis6_metabase_compat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

include_recipe 'iis'

install_method = node['iis']['windows_feature_install_method']

windows_feature %w(IIS-IIS6ManagementCompatibility IIS-Metabase) do
install_method install_method unless install_method.nil?
install_method node['iis']['windows_feature_install_method']&.to_sym
end
4 changes: 1 addition & 3 deletions recipes/mod_isapi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

include_recipe 'iis'

install_method = node['iis']['windows_feature_install_method']

windows_feature %w(IIS-ISAPIFilter IIS-ISAPIExtensions) do
install_method install_method unless install_method.nil?
install_method node['iis']['windows_feature_install_method']&.to_sym
end
4 changes: 1 addition & 3 deletions recipes/mod_logging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

include_recipe 'iis'

install_method = node['iis']['windows_feature_install_method']

windows_feature 'IIS-CustomLogging' do
install_method install_method unless install_method.nil?
install_method node['iis']['windows_feature_install_method']&.to_sym
end
4 changes: 1 addition & 3 deletions recipes/mod_management.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@

include_recipe 'iis'

install_method = node['iis']['windows_feature_install_method']

windows_feature %w(IIS-ManagementConsole IIS-ManagementService) do
action :install
all !IISCookbook::Helper.older_than_windows2012?
install_method install_method unless install_method.nil?
install_method node['iis']['windows_feature_install_method']&.to_sym
end
4 changes: 1 addition & 3 deletions recipes/mod_security.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

include_recipe 'iis'

install_method = node['iis']['windows_feature_install_method']

windows_feature %w(IIS-URLAuthorization IIS-RequestFiltering IIS-IPSecurity) do
install_method install_method unless install_method.nil?
install_method node['iis']['windows_feature_install_method']&.to_sym
end
4 changes: 1 addition & 3 deletions recipes/mod_tracing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

include_recipe 'iis'

install_method = node['iis']['windows_feature_install_method']

windows_feature 'IIS-HttpTracing' do
install_method install_method unless install_method.nil?
install_method node['iis']['windows_feature_install_method']&.to_sym
end
4 changes: 2 additions & 2 deletions resources/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

property :source, String
property :additional_components, Array, default: []
property :install_method, [:windows_feature_dism, :windows_feature_powershell, :windows_feature_servermanagercmd], required: false
property :install_method, Symbol, required: false, equal_to: [:windows_feature_dism, :windows_feature_powershell, :windows_feature_servermanagercmd], default: :windows_feature_dism

action :install do
features_to_install = ['IIS-WebServerRole'].concat new_resource.additional_components
Expand All @@ -31,6 +31,6 @@
action :install
all !IISCookbook::Helper.older_than_windows2012?
source new_resource.source unless new_resource.source.nil?
install_method new_resource.install_method unless new_resource.install_method.nil?
install_method new_resource.install_method
end
end
2 changes: 1 addition & 1 deletion resources/manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
property :enable_remote_management, [true, false], default: true
property :log_directory, String
property :port, Integer, default: 8172
property :install_method, [:windows_feature_dism, :windows_feature_powershell, :windows_feature_servermanagercmd], required: false
property :install_method, Symbol, required: false, equal_to: [:windows_feature_dism, :windows_feature_powershell, :windows_feature_servermanagercmd], default: :windows_feature_dism

action :config do
iis_install 'Web-Mgmt-Service' do
Expand Down

0 comments on commit 973ddf0

Please sign in to comment.