Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.1.2 #8

Merged
merged 5 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
cookbook-rb-firewall CHANGELOG
===============

## 0.1.2

- Pablo Pérez
- [d7ab30b] delete random file
- [39f0883] deleted unnecesary notifies
- [f6ae60e] Check if needs to reload or not

## 0.1.1

- manegron
Expand Down
2 changes: 1 addition & 1 deletion resources/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
maintainer_email 'git@redborder.com'
license 'AGPL-3.0'
description 'Installs/Configures Firewall'
version '0.1.1'
version '0.1.2'
14 changes: 12 additions & 2 deletions resources/providers/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@
action :delete
permanent true
only_if "firewall-cmd --permanent --zone=public --query-rich-rule='rule family=\"ipv4\" source address=\"#{ip}\" port port=\"9092\" protocol=\"tcp\" accept'"
notifies :reload, 'service[firewalld]', :delayed
end
end
end
Expand All @@ -93,11 +92,22 @@
action :create
permanent true
not_if "firewall-cmd --permanent --zone=public --query-rich-rule='rule family=\"ipv4\" source address=\"#{ip}\" port port=\"9092\" protocol=\"tcp\" accept'"
notifies :reload, 'service[firewalld]', :delayed
end
end
end

# Reload firewalld only if the runtime rules are different than the permanent rules
# (a rule has been added/deleted and the service needs to be reloaded)
execute 'reload_firewalld' do
command 'firewall-cmd --reload'
only_if do
runtime_rules = `firewall-cmd --zone=public --list-rich-rules`.strip
permanent_rules = `firewall-cmd --permanent --zone=public --list-rich-rules`.strip
runtime_rules != permanent_rules
end
action :run
end

Chef::Log.info('Firewall configuration has been applied.')
end

Expand Down
Loading