Update upstream cookbooks

This commit is contained in:
Greg Karékinian
2017-03-20 13:19:10 +00:00
parent bfd2d52ea8
commit bcfd44b923
340 changed files with 12576 additions and 5465 deletions

View File

@@ -1,6 +1,6 @@
#
# Author:: Sander van Harmelen (<svanharmelen@schubergphilis.com>)
# Cookbook Name:: firewall
# Cookbook:: firewall
# Provider:: windows
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -29,10 +29,13 @@ class Chef
action :install do
next if disabled?(new_resource)
converge_by('enable and start Windows Firewall service') do
service 'MpsSvc' do
action [:enable, :start]
end
svc = service 'MpsSvc' do
action :nothing
end
[:enable, :start].each do |act|
svc.run_action(act)
new_resource.updated_by_last_action(true) if svc.updated_by_last_action?
end
end
@@ -57,6 +60,13 @@ class Chef
end
end
input_policy = node['firewall']['windows']['defaults']['policy']['input']
output_policy = node['firewall']['windows']['defaults']['policy']['output']
unless new_resource.rules['windows'].key?("set currentprofile firewallpolicy #{input_policy},#{output_policy}")
# Make this the possible last rule in the list
new_resource.rules['windows']["set currentprofile firewallpolicy #{input_policy},#{output_policy}"] = 99999
end
# ensure a file resource exists with the current rules
begin
windows_file = run_context.resource_collection.find(file: windows_rules_filename)
@@ -87,18 +97,21 @@ class Chef
action :disable do
next if disabled?(new_resource)
converge_by('disable and stop Windows Firewall service') do
if active?
disable!
Chef::Log.info("#{new_resource} disabled.")
new_resource.updated_by_last_action(true)
else
Chef::Log.debug("#{new_resource} already disabled.")
end
if active?
disable!
Chef::Log.info("#{new_resource} disabled.")
new_resource.updated_by_last_action(true)
else
Chef::Log.debug("#{new_resource} already disabled.")
end
service 'MpsSvc' do
action [:disable, :stop]
end
svc = service 'MpsSvc' do
action :nothing
end
[:disable, :stop].each do |act|
svc.run_action(act)
new_resource.updated_by_last_action(true) if svc.updated_by_last_action?
end
end
@@ -107,6 +120,7 @@ class Chef
reset!
Chef::Log.info("#{new_resource} reset.")
new_resource.updated_by_last_action(true)
end
end
end