Showing with 48 additions and 9 deletions.
  1. +1 −1 .travis.yml
  2. +12 −0 CHANGELOG.md
  3. +1 −1 Dockerfile
  4. +1 −0 Gemfile
  5. +13 −0 Rakefile
  6. +8 −5 lib/puppet/provider/firewalld.rb
  7. +1 −1 metadata.json
  8. +11 −1 spec/spec_helper.rb
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
dist: xenial
dist: bionic
language: ruby
cache: bundler
before_install:
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.
Each new release typically also includes the latest modulesync defaults.
These should not affect the functionality of the module.

## [v4.1.1](https://github.com/voxpupuli/puppet-firewalld/tree/v4.1.1) (2019-11-01)

[Full Changelog](https://github.com/voxpupuli/puppet-firewalld/compare/v4.1.0...v4.1.1)

**Fixed bugs:**

- Reoccurring firewall-cmd command execution [\#240](https://github.com/voxpupuli/puppet-firewalld/issues/240)

**Merged pull requests:**

- memoize self.state [\#241](https://github.com/voxpupuli/puppet-firewalld/pull/241) ([igalic](https://github.com/igalic))

## [v4.1.0](https://github.com/voxpupuli/puppet-firewalld/tree/v4.1.0) (2019-10-22)

[Full Changelog](https://github.com/voxpupuli/puppet-firewalld/compare/v4.0.0...v4.1.0)
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RUN bundle install --without system_tests development release --path=${BUNDLE_PA
COPY . .

RUN bundle install
RUN bundle exec release_checks
RUN bundle exec rake release_checks

# Container should not saved
RUN exit 1
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ group :test do
gem 'puppet-lint-variable_contains_upcase', :require => false
gem 'puppet-lint-absolute_classname-check', :require => false
gem 'puppet-lint-topscope-variable-check', :require => false
gem 'puppet-lint-legacy_facts-check', :require => false
gem 'metadata-json-lint', :require => false
gem 'redcarpet', :require => false
gem 'rubocop', '~> 0.49.1', :require => false
Expand Down
13 changes: 13 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,19 @@ begin
metadata = JSON.load(File.read(metadata_json))
config.project = metadata['name']
end

# Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715
require 'rbconfig'
if RbConfig::CONFIG['host_os'] =~ /linux/
task :changelog do
puts 'Fixing line endings...'
changelog_file = File.join(__dir__, 'CHANGELOG.md')
changelog_txt = File.read(changelog_file)
new_contents = changelog_txt.gsub(%r{\r\n}, "\n")
File.open(changelog_file, "w") {|file| file.puts new_contents }
end
end

rescue LoadError
end
# vim: syntax=ruby
13 changes: 8 additions & 5 deletions lib/puppet/provider/firewalld.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ def state
end

def self.state
if Puppet::Provider::Firewalld.runstate.nil?
Puppet::Provider::Firewalld.runstate = check_running_state
end
Puppet::Provider::Firewalld.runstate
check_running_state
end

def check_running_state
Expand All @@ -26,7 +28,7 @@ def check_running_state
def self.check_running_state
debug("Executing --state command - current value #{@state}")
ret = execute_firewall_cmd(['--state'], nil, false, false, false)
Puppet::Provider::Firewalld.runstate = ret.exitstatus.zero?
ret.exitstatus.zero?
rescue Puppet::MissingCommand
# This exception is caught in case the module is being run before
# the package provider has installed the firewalld package, if we
Expand Down Expand Up @@ -92,7 +94,6 @@ def reload_firewall
end

def offline?
check_running_state if state.nil?
state == false || state.nil?
end

Expand All @@ -101,7 +102,10 @@ def online?
end

def self.online?
check_running_state unless state == true
# always re-check state unless we are already online:
# see #117 / 813141cbfebf98c4348b64189cb472b6f3238c99
# That means, `self.state` will be re-run, even if it has a valid value, such as `false`
Puppet::Provider::Firewalld.runstate = check_running_state unless state == true
state == true
end

Expand All @@ -114,7 +118,6 @@ def available?
end

def self.available?
check_running_state if state.nil?
!state.nil?
end
end
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppet-firewalld",
"version": "4.1.0",
"version": "4.1.1",
"author": "Vox Pupuli",
"summary": "Configure firewalld zones, services, and rich rules and direct config",
"license": "Apache-2.0",
Expand Down
12 changes: 11 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,17 @@
end

RSpec.configure do |c|
c.default_facter_version = ENV['FACTERDB_FACTS_VERSION'] || '3.9'
# getting the correct facter version is tricky. We use facterdb as a source to mock facts
# see https://github.com/camptocamp/facterdb
# people might provide a specific facter version. In that case we use it.
# Otherwise we need to match the correct facter version to the used puppet version.
# as of 2019-10-31, puppet 5 ships facter 3.11 and puppet 6 ships facter 3.14
# https://puppet.com/docs/puppet/5.5/about_agent.html
c.default_facter_version = if ENV['FACTERDB_FACTS_VERSION']
ENV['FACTERDB_FACTS_VERSION']
else
Gem::Dependency.new('', ENV['PUPPET_VERSION']).match?('', '5') ? '3.11.0' : '3.14.0'
end

# Coverage generation
c.after(:suite) do
Expand Down