Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Commit

Permalink
Changed to only attempt loading rules and routes after the ufw is ins…
Browse files Browse the repository at this point in the history
…talled

Signed-off-by: Evgeny Soynov <esoynov@kogito.network>
  • Loading branch information
ZloeSabo committed Aug 18, 2021
1 parent 3679b26 commit 4aec466
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/puppet/provider/ufw_route/ufw_route.rb
Expand Up @@ -23,6 +23,7 @@ def initialize

def get(context)
context.debug('Returning list of routes')
return [] unless ufw_installed?

@instances = []
route_list_lines.each do |line|
Expand Down Expand Up @@ -149,4 +150,8 @@ def delete(context, name)
params = rule_to_ufw_params_nocomment(is)
Puppet::Util::Execution.execute("/usr/sbin/ufw route delete #{params}", failonfail: true)
end

def ufw_installed?
File.file?('/usr/sbin/ufw')
end
end
5 changes: 5 additions & 0 deletions lib/puppet/provider/ufw_rule/ufw_rule.rb
Expand Up @@ -25,6 +25,7 @@ def initialize

def get(context)
context.debug('Returning list of rules')
return [] unless ufw_installed?

@instances = []
rule_list_lines.each do |line|
Expand Down Expand Up @@ -180,4 +181,8 @@ def delete(context, name)
params = rule_to_ufw_params_nocomment(is)
Puppet::Util::Execution.execute("/usr/sbin/ufw delete #{params}", failonfail: true)
end

def ufw_installed?
File.file?('/usr/sbin/ufw')
end
end

0 comments on commit 4aec466

Please sign in to comment.