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

Calls to firewallchain failing due to undefined Facter::ResolvedFact.flush #1070

Closed
dwysocki opened this issue Sep 1, 2022 · 1 comment
Closed

Comments

@dwysocki
Copy link

dwysocki commented Sep 1, 2022

Describe the Bug

Multiple calls to firewallchain are failing with the error

Could not evaluate: undefined method `flush' for #<Facter::ResolvedFact:0x00005586af5f6820>

which I believe is triggered by this line, as it's the only call to that method. However, in my rudimentary understanding of Ruby, this line should never cause an error, as it is explicitly checking that the method is defined before attempting to call it.

Expected Behavior

Either the flush method shouldn't be called, as it's undefined, or it should be called when it is defined.

Steps to Reproduce

I'm not sure I can reproduce this in a simplified environment, as the error is occurring on a new VM, but was not happening on older VMs. Here's part of my offending class:

# pre.pp
class profile::firewall_rules::pre() {
  Firewall {
    require => undef
  }

   ...

    # This triggers the error
    firewallchain { 'INPUT:filter:IPv4':
      purge  => true,
      ignore => [ '-j fail2ban', '-j f2b' ],
      policy => 'drop',
    }

    ...
}

Environment

  • Version
    • Puppet: 7.18.0
    • Puppet-firewall: 1.14.0
    • Ruby: 2.7.6p219
  • Platform
    • Debian 10
    • Linux 4.19.0-21-amd64
@dwysocki
Copy link
Author

Looks like this was actually fixed 2 years ago in #906 and the version we're using is 2 years older than that.

To anybody stumbling across this issue in the future: just upgrade to version 2.3.0 or later!

Closing now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants